From: Dimitris Michailidis <dm@chelsio.com>
To: netdev@vger.kernel.org
Subject: [PATCH 08/12] cxgb4: remove the name field from the adapter structure
Date: Tue, 14 Dec 2010 12:18:12 -0800 [thread overview]
Message-ID: <1292357896-14339-9-git-send-email-dm@chelsio.com> (raw)
In-Reply-To: <1292357896-14339-8-git-send-email-dm@chelsio.com>
Remove a field the driver uses to keep track of the name of the first
netdev it manages to register. Do this by changing the registration
loop to stop the first time it fails so the first registered device is
trivial to tell.
Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
---
drivers/net/cxgb4/cxgb4.h | 1 -
drivers/net/cxgb4/cxgb4_main.c | 37 +++++++++++++++----------------------
2 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index f3d9f64..9caf95f 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -486,7 +486,6 @@ struct adapter {
unsigned int fn;
unsigned int flags;
- const char *name;
int msg_enable;
struct adapter_params params;
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index ba9a67a..3db21d1 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -525,10 +525,11 @@ static void name_msix_vecs(struct adapter *adap)
int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc);
/* non-data interrupts */
- snprintf(adap->msix_info[0].desc, n, "%s", adap->name);
+ snprintf(adap->msix_info[0].desc, n, "%s", adap->port[0]->name);
/* FW events */
- snprintf(adap->msix_info[1].desc, n, "%s-FWeventq", adap->name);
+ snprintf(adap->msix_info[1].desc, n, "%s-FWeventq",
+ adap->port[0]->name);
/* Ethernet queues */
for_each_port(adap, j) {
@@ -543,11 +544,11 @@ static void name_msix_vecs(struct adapter *adap)
/* offload queues */
for_each_ofldrxq(&adap->sge, i)
snprintf(adap->msix_info[msi_idx].desc, n, "%s-ofld%d",
- adap->name, i);
+ adap->port[0]->name, i);
for_each_rdmarxq(&adap->sge, i)
snprintf(adap->msix_info[msi_idx].desc, n, "%s-rdma%d",
- adap->name, i);
+ adap->port[0]->name, i);
}
static int request_msix_queue_irqs(struct adapter *adap)
@@ -2664,7 +2665,7 @@ static int cxgb_up(struct adapter *adap)
} else {
err = request_irq(adap->pdev->irq, t4_intr_handler(adap),
(adap->flags & USING_MSI) ? 0 : IRQF_SHARED,
- adap->name, adap);
+ adap->port[0]->name, adap);
if (err)
goto irq_err;
}
@@ -3627,7 +3628,6 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter->pdev = pdev;
adapter->pdev_dev = &pdev->dev;
adapter->fn = func;
- adapter->name = pci_name(pdev);
adapter->msg_enable = dflt_msg_enable;
memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
@@ -3724,26 +3724,19 @@ static int __devinit init_one(struct pci_dev *pdev,
err = register_netdev(adapter->port[i]);
if (err)
- dev_warn(&pdev->dev,
- "cannot register net device %s, skipping\n",
- adapter->port[i]->name);
- else {
- /*
- * Change the name we use for messages to the name of
- * the first successfully registered interface.
- */
- if (!adapter->registered_device_map)
- adapter->name = adapter->port[i]->name;
-
- __set_bit(i, &adapter->registered_device_map);
- adapter->chan_map[pi->tx_chan] = i;
- print_port_info(adapter->port[i]);
- }
+ break;
+ __set_bit(i, &adapter->registered_device_map);
+ adapter->chan_map[pi->tx_chan] = i;
+ print_port_info(adapter->port[i]);
}
- if (!adapter->registered_device_map) {
+ if (i == 0) {
dev_err(&pdev->dev, "could not register any net devices\n");
goto out_free_dev;
}
+ if (err) {
+ dev_warn(&pdev->dev, "only %d net devices registered\n", i);
+ err = 0;
+ };
if (cxgb4_debugfs_root) {
adapter->debugfs_root = debugfs_create_dir(pci_name(pdev),
--
1.5.4
next prev parent reply other threads:[~2010-12-14 20:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 20:18 [PATCH 00/12 net-next] cxgb4 update Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 01/12] cxgb4: enable PCIe relaxed ordering Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 02/12] cxgb4: do not read the clock frequency from VPD Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 03/12] cxgb4: set the number of queues before device registration Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 04/12] cxgb4: distinguish between 1-lane KR/KX and 4-lane KR/KX/KX4 ports Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 05/12] cxgb4: print port information after registering each netdev Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 06/12] cxgb4: allocate more space for MSI-X interrupt names Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 07/12] cxgb4: correct formatting of " Dimitris Michailidis
2010-12-14 20:18 ` Dimitris Michailidis [this message]
2010-12-14 20:18 ` [PATCH 09/12] cxgb4: remove a bitmap Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 10/12] cxgb4: add const to static arrays Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 11/12] cxgb4: extend VPD parsing Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 12/12] cxgb4: NUMA-aware Tx queue allocations Dimitris Michailidis
2010-12-14 21:17 ` Eric Dumazet
2010-12-14 22:51 ` Dimitris Michailidis
-- strict thread matches above, loose matches on Subject: below --
2010-12-15 7:36 [PATCH 00/12 net-next] cxgb4 update v2 Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 01/12] cxgb4: enable PCIe relaxed ordering Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 02/12] cxgb4: do not read the clock frequency from VPD Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 03/12] cxgb4: set the number of queues before device registration Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 04/12] cxgb4: distinguish between 1-lane KR/KX and 4-lane KR/KX/KX4 ports Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 05/12] cxgb4: print port information after registering each netdev Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 06/12] cxgb4: allocate more space for MSI-X interrupt names Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 07/12] cxgb4: correct formatting of " Dimitris Michailidis
2010-12-15 7:36 ` [PATCH 08/12] cxgb4: remove the name field from the adapter structure Dimitris Michailidis
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=1292357896-14339-9-git-send-email-dm@chelsio.com \
--to=dm@chelsio.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).