diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2011-01-10 14:31:13 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2011-01-28 03:07:04 -0500 |
commit | 910f7bb164fa888ff925e337bf8fd479abb157f9 (patch) | |
tree | 87c834ebff3a9c60a3e48a8d76fdfde349eff449 /drivers | |
parent | 40d69ba029c8d5de51aaeb5358999266c482d00a (diff) |
pata_hpt37x: fold 'if' statement into 'switch'
hpt37x_init_one() has a large *if* statement which should really be folded into
the *switch* statement that currently constitutes its *else* branch, reducing
one level of indentation...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_hpt37x.c | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 6003a34d614e..29d8adc52733 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
25 | 25 | ||
26 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
27 | #define DRV_VERSION "0.6.20" | 27 | #define DRV_VERSION "0.6.21" |
28 | 28 | ||
29 | struct hpt_clock { | 29 | struct hpt_clock { |
30 | u8 xfer_speed; | 30 | u8 xfer_speed; |
@@ -838,7 +838,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
838 | if (rc) | 838 | if (rc) |
839 | return rc; | 839 | return rc; |
840 | 840 | ||
841 | if (dev->device == PCI_DEVICE_ID_TTI_HPT366) { | 841 | switch (dev->device) { |
842 | case PCI_DEVICE_ID_TTI_HPT366: | ||
842 | /* May be a later chip in disguise. Check */ | 843 | /* May be a later chip in disguise. Check */ |
843 | /* Older chips are in the HPT366 driver. Ignore them */ | 844 | /* Older chips are in the HPT366 driver. Ignore them */ |
844 | if (rev < 3) | 845 | if (rev < 3) |
@@ -867,50 +868,46 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
867 | "please report (%d).\n", rev); | 868 | "please report (%d).\n", rev); |
868 | return -ENODEV; | 869 | return -ENODEV; |
869 | } | 870 | } |
870 | } else { | 871 | break; |
871 | switch (dev->device) { | 872 | case PCI_DEVICE_ID_TTI_HPT372: |
872 | case PCI_DEVICE_ID_TTI_HPT372: | 873 | /* 372N if rev >= 2 */ |
873 | /* 372N if rev >= 2 */ | 874 | if (rev >= 2) |
874 | if (rev >= 2) | 875 | return -ENODEV; |
875 | return -ENODEV; | 876 | ppi[0] = &info_hpt372; |
876 | ppi[0] = &info_hpt372; | 877 | chip_table = &hpt372a; |
877 | chip_table = &hpt372a; | 878 | break; |
878 | break; | 879 | case PCI_DEVICE_ID_TTI_HPT302: |
879 | case PCI_DEVICE_ID_TTI_HPT302: | 880 | /* 302N if rev > 1 */ |
880 | /* 302N if rev > 1 */ | 881 | if (rev > 1) |
881 | if (rev > 1) | 882 | return -ENODEV; |
882 | return -ENODEV; | 883 | ppi[0] = &info_hpt302; |
883 | ppi[0] = &info_hpt302; | 884 | /* Check this */ |
884 | /* Check this */ | 885 | chip_table = &hpt302; |
885 | chip_table = &hpt302; | 886 | break; |
886 | break; | 887 | case PCI_DEVICE_ID_TTI_HPT371: |
887 | case PCI_DEVICE_ID_TTI_HPT371: | 888 | if (rev > 1) |
888 | if (rev > 1) | 889 | return -ENODEV; |
889 | return -ENODEV; | 890 | ppi[0] = &info_hpt302; |
890 | ppi[0] = &info_hpt302; | 891 | chip_table = &hpt371; |
891 | chip_table = &hpt371; | 892 | /* |
892 | /* | 893 | * Single channel device, master is not present but the BIOS |
893 | * Single channel device, master is not present | 894 | * (or us for non x86) must mark it absent |
894 | * but the BIOS (or us for non x86) must mark it | 895 | */ |
895 | * absent | 896 | pci_read_config_byte(dev, 0x50, &mcr1); |
896 | */ | 897 | mcr1 &= ~0x04; |
897 | pci_read_config_byte(dev, 0x50, &mcr1); | 898 | pci_write_config_byte(dev, 0x50, mcr1); |
898 | mcr1 &= ~0x04; | 899 | break; |
899 | pci_write_config_byte(dev, 0x50, mcr1); | 900 | case PCI_DEVICE_ID_TTI_HPT374: |
900 | break; | 901 | chip_table = &hpt374; |
901 | case PCI_DEVICE_ID_TTI_HPT374: | 902 | if (!(PCI_FUNC(dev->devfn) & 1)) |
902 | chip_table = &hpt374; | 903 | *ppi = &info_hpt374_fn0; |
903 | if (!(PCI_FUNC(dev->devfn) & 1)) | 904 | else |
904 | *ppi = &info_hpt374_fn0; | 905 | *ppi = &info_hpt374_fn1; |
905 | else | 906 | break; |
906 | *ppi = &info_hpt374_fn1; | 907 | default: |
907 | break; | 908 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", |
908 | default: | 909 | dev->device); |
909 | pr_err(DRV_NAME | 910 | return -ENODEV; |
910 | ": PCI table is bogus, please report (%d).\n", | ||
911 | dev->device); | ||
912 | return -ENODEV; | ||
913 | } | ||
914 | } | 911 | } |
915 | /* Ok so this is a chip we support */ | 912 | /* Ok so this is a chip we support */ |
916 | 913 | ||