libata: use *switch* in artop_init_one()
PATCH v2 1/1 libata: use *switch* in artop_init_one()
This driver uses a string of the *if* statements where a *switch* statement fits better...
Signed-off-by Sergey Shtylyov <[email protected]>
---
This patch is against the 'for-next' branch of Damien Le Moal's 'libata.git' repo.
Changes in version 2:
- updated #define DRV_VERSION.
drivers/ata/pata_artop.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/ata/pata_artop.c +15 -9
@@ -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,22 @@ static int artop_init_one (struct pci_deif (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 ) - ppi[0 ] = &info_628x_fast; +break ; +case 2 :/* 6280 or 6280 + fast */ + { +unsigned long io =pci_resource_start (pdev,4 ); + + ppi[0 ] = &info_628x; +if (inb (io) &0x10 ) + ppi[0 ] = &info_628x_fast; + } +break ; }BUG_ON (ppi[0 ] ==NULL );
Quoted 11 lines · Sergey Shtylyov
This driver uses a string of the *if* statements where a *switch* statement fits better...
Signed-off-by Sergey Shtylyov <[email protected]>---
This patch is against the 'for-next' branch of Damien Le Moal's 'libata.git' repo.Changes in version 2:
- updated #defineDRV_VERSION.
Oops, wrong prefix in the subject, posting v3...
[...]
MBR, Sergey