Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sergey Shtylyov and committed by
Damien Le Moal
183a4bfb 5dfb8498

+11 -8
+11 -8
drivers/ata/pata_artop.c
··· 28 28 #include <linux/ata.h> 29 29 30 30 #define DRV_NAME "pata_artop" 31 - #define DRV_VERSION "0.4.6" 31 + #define DRV_VERSION "0.4.7" 32 32 33 33 /* 34 34 * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we ··· 394 394 if (rc) 395 395 return rc; 396 396 397 - if (id->driver_data == 0) /* 6210 variant */ 397 + switch (id->driver_data) { 398 + case 0: /* 6210 variant */ 398 399 ppi[0] = &info_6210; 399 - else if (id->driver_data == 1) /* 6260 */ 400 + break; 401 + case 1: /* 6260 */ 400 402 ppi[0] = &info_626x; 401 - else if (id->driver_data == 2) { /* 6280 or 6280 + fast */ 402 - unsigned long io = pci_resource_start(pdev, 4); 403 - 404 - ppi[0] = &info_628x; 405 - if (inb(io) & 0x10) 403 + break; 404 + case 2: /* 6280 or 6280 + fast */ 405 + if (inb(pci_resource_start(pdev, 4)) & 0x10) 406 406 ppi[0] = &info_628x_fast; 407 + else 408 + ppi[0] = &info_628x; 409 + break; 407 410 } 408 411 409 412 BUG_ON(ppi[0] == NULL);