Skip to content

Commit

Permalink
qlcnic: qlcnic_get_board_name() function cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Manish Chopra <[email protected]>
Signed-off-by: Shahed Shaikh <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Manish Chopra authored and davem330 committed May 25, 2013
1 parent 487042a commit 2343f06
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,27 +862,46 @@ static int qlcnic_setup_pci_map(struct pci_dev *pdev,
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)
{
struct pci_dev *pdev = adapter->pdev;
int i, found = 0;

for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
if (qlcnic_boards[i].vendor == pdev->vendor &&
qlcnic_boards[i].device == pdev->device &&
qlcnic_boards[i].sub_vendor == pdev->subsystem_vendor &&
qlcnic_boards[i].sub_device == pdev->subsystem_device) {
sprintf(name, "%pM: %s" ,
adapter->mac_addr,
qlcnic_boards[i].short_name);
found = 1;
break;
qlcnic_boards[i].device == pdev->device &&
qlcnic_validate_subsystem_id(adapter, i)) {
found = 1;
break;
}

}

if (!found)
sprintf(name, "%pM Gigabit Ethernet", adapter->mac_addr);
else
sprintf(name, "%pM: %s" , adapter->mac_addr,
qlcnic_boards[i].short_name);
}

static void
Expand Down

0 comments on commit 2343f06

Please sign in to comment.