Skip to content

Commit 2343f06

Browse files
Manish Chopradavem330
authored andcommitted
qlcnic: qlcnic_get_board_name() function cleanup
Signed-off-by: Manish Chopra <[email protected]> Signed-off-by: Shahed Shaikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 487042a commit 2343f06

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -862,27 +862,46 @@ static int qlcnic_setup_pci_map(struct pci_dev *pdev,
862862
return 0;
863863
}
864864

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+
865886
static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name)
866887
{
867888
struct pci_dev *pdev = adapter->pdev;
868889
int i, found = 0;
869890

870891
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
871892
if (qlcnic_boards[i].vendor == pdev->vendor &&
872-
qlcnic_boards[i].device == pdev->device &&
873-
qlcnic_boards[i].sub_vendor == pdev->subsystem_vendor &&
874-
qlcnic_boards[i].sub_device == pdev->subsystem_device) {
875-
sprintf(name, "%pM: %s" ,
876-
adapter->mac_addr,
877-
qlcnic_boards[i].short_name);
878-
found = 1;
879-
break;
893+
qlcnic_boards[i].device == pdev->device &&
894+
qlcnic_validate_subsystem_id(adapter, i)) {
895+
found = 1;
896+
break;
880897
}
881-
882898
}
883899

884900
if (!found)
885901
sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr);
902+
else
903+
sprintf(name, "%pM: %s" , adapter->mac_addr,
904+
qlcnic_boards[i].short_name);
886905
}
887906

888907
static void

0 commit comments

Comments
 (0)