Commit 2343f06a authored by Manish Chopra's avatar Manish Chopra Committed by David S. Miller

qlcnic: qlcnic_get_board_name() function cleanup

Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 487042af
...@@ -862,6 +862,27 @@ static int qlcnic_setup_pci_map(struct pci_dev *pdev, ...@@ -862,6 +862,27 @@ static int qlcnic_setup_pci_map(struct pci_dev *pdev,
return 0; return 0;
} }
static inline bool qlcnic_validate_subsystem_id(struct qlcnic_adapter *adapter,
int index)
{
struct pci_dev *pdev = adapter->pdev;
unsigned short subsystem_vendor;
bool ret = true;
subsystem_vendor = pdev->subsystem_vendor;
if (pdev->device == PCI_DEVICE_ID_QLOGIC_QLE824X ||
pdev->device == PCI_DEVICE_ID_QLOGIC_QLE834X) {
if (qlcnic_boards[index].sub_vendor == subsystem_vendor &&
qlcnic_boards[index].sub_device == pdev->subsystem_device)
ret = true;
else
ret = false;
}
return ret;
}
static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name) static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
...@@ -870,19 +891,17 @@ static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name) ...@@ -870,19 +891,17 @@ static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name)
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
if (qlcnic_boards[i].vendor == pdev->vendor && if (qlcnic_boards[i].vendor == pdev->vendor &&
qlcnic_boards[i].device == pdev->device && qlcnic_boards[i].device == pdev->device &&
qlcnic_boards[i].sub_vendor == pdev->subsystem_vendor && qlcnic_validate_subsystem_id(adapter, i)) {
qlcnic_boards[i].sub_device == pdev->subsystem_device) {
sprintf(name, "%pM: %s" ,
adapter->mac_addr,
qlcnic_boards[i].short_name);
found = 1; found = 1;
break; break;
} }
} }
if (!found) if (!found)
sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr); sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr);
else
sprintf(name, "%pM: %s" , adapter->mac_addr,
qlcnic_boards[i].short_name);
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment