diff options
author | Sergey Shtylyov <s.shtylyov@omp.ru> | 2022-02-09 21:25:34 +0100 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-02-19 03:18:42 +0100 |
commit | 183a4bfbd7c86fcb194dc45fdec6e5759c6283a8 (patch) | |
tree | f44a103c69761ec519bd21ee8a28e1dd1051392b /drivers | |
parent | pata_hpt3x2n: fix writing to wrong register in hpt3x2n_bmdma_stop() (diff) | |
download | linux-183a4bfbd7c86fcb194dc45fdec6e5759c6283a8.tar.xz linux-183a4bfbd7c86fcb194dc45fdec6e5759c6283a8.zip |
ata: pata_artop: use *switch* in artop_init_one()
This driver uses a string of the *if* statements in artop_init_one()
where the *switch* statement would fit better. While fixing this,
refactor the 6280 code to e.g. avoid a compound statement inside
the *case* section...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_artop.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index ad3c5808aaad..08e88403d0ab 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c @@ -28,7 +28,7 @@ #include <linux/ata.h> #define DRV_NAME "pata_artop" -#define DRV_VERSION "0.4.6" +#define DRV_VERSION "0.4.7" /* * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we @@ -394,16 +394,19 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) if (rc) return rc; - if (id->driver_data == 0) /* 6210 variant */ + switch (id->driver_data) { + case 0: /* 6210 variant */ ppi[0] = &info_6210; - else if (id->driver_data == 1) /* 6260 */ + break; + case 1: /* 6260 */ ppi[0] = &info_626x; - else if (id->driver_data == 2) { /* 6280 or 6280 + fast */ - unsigned long io = pci_resource_start(pdev, 4); - - ppi[0] = &info_628x; - if (inb(io) & 0x10) + break; + case 2: /* 6280 or 6280 + fast */ + if (inb(pci_resource_start(pdev, 4)) & 0x10) ppi[0] = &info_628x_fast; + else + ppi[0] = &info_628x; + break; } BUG_ON(ppi[0] == NULL); |