diff options
author | Manish Chopra <manish.chopra@qlogic.com> | 2013-05-23 17:04:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-25 02:05:05 -0400 |
commit | 2343f06a8c9549af27b885d36e26c59771d697f1 (patch) | |
tree | 3e42216353a9371b487d313e42f804a739cba289 /drivers/net/ethernet/qlogic | |
parent | 487042af928c16d2a5b4dd52a9639a03b8b40761 (diff) |
qlcnic: qlcnic_get_board_name() function cleanup
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 5b18b0accb06..da82f2eb73b4 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -862,6 +862,27 @@ static int qlcnic_setup_pci_map(struct pci_dev *pdev, | |||
862 | return 0; | 862 | return 0; |
863 | } | 863 | } |
864 | 864 | ||
865 | static inline bool qlcnic_validate_subsystem_id(struct qlcnic_adapter *adapter, | ||
866 | int index) | ||
867 | { | ||
868 | struct pci_dev *pdev = adapter->pdev; | ||
869 | unsigned short subsystem_vendor; | ||
870 | bool ret = true; | ||
871 | |||
872 | subsystem_vendor = pdev->subsystem_vendor; | ||
873 | |||
874 | if (pdev->device == PCI_DEVICE_ID_QLOGIC_QLE824X || | ||
875 | pdev->device == PCI_DEVICE_ID_QLOGIC_QLE834X) { | ||
876 | if (qlcnic_boards[index].sub_vendor == subsystem_vendor && | ||
877 | qlcnic_boards[index].sub_device == pdev->subsystem_device) | ||
878 | ret = true; | ||
879 | else | ||
880 | ret = false; | ||
881 | } | ||
882 | |||
883 | return ret; | ||
884 | } | ||
885 | |||
865 | static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name) | 886 | static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name) |
866 | { | 887 | { |
867 | struct pci_dev *pdev = adapter->pdev; | 888 | struct pci_dev *pdev = adapter->pdev; |
@@ -869,20 +890,18 @@ static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name) | |||
869 | 890 | ||
870 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { | 891 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { |
871 | if (qlcnic_boards[i].vendor == pdev->vendor && | 892 | if (qlcnic_boards[i].vendor == pdev->vendor && |
872 | qlcnic_boards[i].device == pdev->device && | 893 | qlcnic_boards[i].device == pdev->device && |
873 | qlcnic_boards[i].sub_vendor == pdev->subsystem_vendor && | 894 | qlcnic_validate_subsystem_id(adapter, i)) { |
874 | qlcnic_boards[i].sub_device == pdev->subsystem_device) { | 895 | found = 1; |
875 | sprintf(name, "%pM: %s" , | 896 | break; |
876 | adapter->mac_addr, | ||
877 | qlcnic_boards[i].short_name); | ||
878 | found = 1; | ||
879 | break; | ||
880 | } | 897 | } |
881 | |||
882 | } | 898 | } |
883 | 899 | ||
884 | if (!found) | 900 | if (!found) |
885 | sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr); | 901 | sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr); |
902 | else | ||
903 | sprintf(name, "%pM: %s" , adapter->mac_addr, | ||
904 | qlcnic_boards[i].short_name); | ||
886 | } | 905 | } |
887 | 906 | ||
888 | static void | 907 | static void |