From: Shahed Shaikh <shahed.shaikh@qlogic.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <Dept_NX_Linux_NIC_Driver@qlogic.com>,
Manish Chopra <manish.chopra@qlogic.com>
Subject: [PATCH net-next 10/12] qlcnic: qlcnic_get_board_name() function cleanup
Date: Fri, 24 May 2013 03:04:34 -0400 [thread overview]
Message-ID: <1369379076-4718-11-git-send-email-shahed.shaikh@qlogic.com> (raw)
In-Reply-To: <1369379076-4718-1-git-send-email-shahed.shaikh@qlogic.com>
From: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
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 bf78903..535c53f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -867,6 +867,27 @@ 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;
@@ -874,20 +895,18 @@ static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name)
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
--
1.5.6
next prev parent reply other threads:[~2013-05-24 7:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 7:04 [PATCH net-next 00/12] qlcnic: Enhancements and cleanup Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 01/12] qlcnic: Support spoof check config Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 02/12] qlcnic: Disable INT-x interrupt for 83xx on driver unload Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 03/12] qlcnic: Update IRQ name for 8200 and 8300 Series adapter Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 04/12] qlcnic: Remove qlcnic_config_npars module parameter Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 05/12] qlcnic: Initialize trans_work and idc_aen_work at VF probe Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 06/12] qlcnic: Convert nested if-else to switch-case Shahed Shaikh
2013-05-24 8:36 ` David Laight
2013-05-24 7:04 ` [PATCH net-next 07/12] qlcnic: diagnostics routine changes Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 08/12] qlcnic: modify reset recovery path in diag mode Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 09/12] qlcnic: Implement GET_LED_STATUS command for 82xx adapter Shahed Shaikh
2013-05-24 7:04 ` Shahed Shaikh [this message]
2013-05-24 7:04 ` [PATCH net-next 11/12] qlcnic: Enhance virtual NIC logging Shahed Shaikh
2013-05-24 7:04 ` [PATCH net-next 12/12] qlcnic: Update version to 5.2.43 Shahed Shaikh
2013-05-25 6:05 ` [PATCH net-next 00/12] qlcnic: Enhancements and cleanup David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369379076-4718-11-git-send-email-shahed.shaikh@qlogic.com \
--to=shahed.shaikh@qlogic.com \
--cc=Dept_NX_Linux_NIC_Driver@qlogic.com \
--cc=davem@davemloft.net \
--cc=manish.chopra@qlogic.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).