[PATCH] libata: use *switch* in artop_init_one()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This driver uses a string of the *if* statements where a *switch* statement
fits better...

Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx>

---
 drivers/ata/pata_artop.c |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

Index: libata/drivers/ata/pata_artop.c
===================================================================
--- libata.orig/drivers/ata/pata_artop.c
+++ libata/drivers/ata/pata_artop.c
@@ -394,16 +394,22 @@ static int artop_init_one (struct pci_de
 	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);
+		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;
+			ppi[0] = &info_628x;
+			if (inb(io) & 0x10)
+				ppi[0] = &info_628x_fast;
+		}
+		break;
 	}
 
 	BUG_ON(ppi[0] == NULL);



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux