aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-12-14 16:36:51 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-16 16:16:02 -0500
commitb1a3c2b698ec333edc86bf8b5a636162ca309870 (patch)
treed3d6c15741571760a264248ae76a72cb84accdb2 /drivers/net
parentba27816cd8167c64652406d86ca78bcc5989f20f (diff)
cxgb4: remove the name field from the adapter structure
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cxgb4/cxgb4.h1
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c37
2 files changed, 15 insertions, 23 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index f3d9f64188ff..9caf95f086e0 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -486,7 +486,6 @@ struct adapter {
486 unsigned int fn; 486 unsigned int fn;
487 unsigned int flags; 487 unsigned int flags;
488 488
489 const char *name;
490 int msg_enable; 489 int msg_enable;
491 490
492 struct adapter_params params; 491 struct adapter_params params;
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 7e26fe5efbbf..4d7565cf74ee 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)
525 int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc); 525 int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc);
526 526
527 /* non-data interrupts */ 527 /* non-data interrupts */
528 snprintf(adap->msix_info[0].desc, n, "%s", adap->name); 528 snprintf(adap->msix_info[0].desc, n, "%s", adap->port[0]->name);
529 529
530 /* FW events */ 530 /* FW events */
531 snprintf(adap->msix_info[1].desc, n, "%s-FWeventq", adap->name); 531 snprintf(adap->msix_info[1].desc, n, "%s-FWeventq",
532 adap->port[0]->name);
532 533
533 /* Ethernet queues */ 534 /* Ethernet queues */
534 for_each_port(adap, j) { 535 for_each_port(adap, j) {
@@ -543,11 +544,11 @@ static void name_msix_vecs(struct adapter *adap)
543 /* offload queues */ 544 /* offload queues */
544 for_each_ofldrxq(&adap->sge, i) 545 for_each_ofldrxq(&adap->sge, i)
545 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d", 546 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d",
546 adap->name, i); 547 adap->port[0]->name, i);
547 548
548 for_each_rdmarxq(&adap->sge, i) 549 for_each_rdmarxq(&adap->sge, i)
549 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d", 550 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d",
550 adap->name, i); 551 adap->port[0]->name, i);
551} 552}
552 553
553static int request_msix_queue_irqs(struct adapter *adap) 554static int request_msix_queue_irqs(struct adapter *adap)
@@ -2664,7 +2665,7 @@ static int cxgb_up(struct adapter *adap)
2664 } else { 2665 } else {
2665 err = request_irq(adap->pdev->irq, t4_intr_handler(adap), 2666 err = request_irq(adap->pdev->irq, t4_intr_handler(adap),
2666 (adap->flags & USING_MSI) ? 0 : IRQF_SHARED, 2667 (adap->flags & USING_MSI) ? 0 : IRQF_SHARED,
2667 adap->name, adap); 2668 adap->port[0]->name, adap);
2668 if (err) 2669 if (err)
2669 goto irq_err; 2670 goto irq_err;
2670 } 2671 }
@@ -3627,7 +3628,6 @@ static int __devinit init_one(struct pci_dev *pdev,
3627 adapter->pdev = pdev; 3628 adapter->pdev = pdev;
3628 adapter->pdev_dev = &pdev->dev; 3629 adapter->pdev_dev = &pdev->dev;
3629 adapter->fn = func; 3630 adapter->fn = func;
3630 adapter->name = pci_name(pdev);
3631 adapter->msg_enable = dflt_msg_enable; 3631 adapter->msg_enable = dflt_msg_enable;
3632 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); 3632 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
3633 3633
@@ -3724,26 +3724,19 @@ static int __devinit init_one(struct pci_dev *pdev,
3724 3724
3725 err = register_netdev(adapter->port[i]); 3725 err = register_netdev(adapter->port[i]);
3726 if (err) 3726 if (err)
3727 dev_warn(&pdev->dev, 3727 break;
3728 "cannot register net device %s, skipping\n", 3728 __set_bit(i, &adapter->registered_device_map);
3729 adapter->port[i]->name); 3729 adapter->chan_map[pi->tx_chan] = i;
3730 else { 3730 print_port_info(adapter->port[i]);
3731 /*
3732 * Change the name we use for messages to the name of
3733 * the first successfully registered interface.
3734 */
3735 if (!adapter->registered_device_map)
3736 adapter->name = adapter->port[i]->name;
3737
3738 __set_bit(i, &adapter->registered_device_map);
3739 adapter->chan_map[pi->tx_chan] = i;
3740 print_port_info(adapter->port[i]);
3741 }
3742 } 3731 }
3743 if (!adapter->registered_device_map) { 3732 if (i == 0) {
3744 dev_err(&pdev->dev, "could not register any net devices\n"); 3733 dev_err(&pdev->dev, "could not register any net devices\n");
3745 goto out_free_dev; 3734 goto out_free_dev;
3746 } 3735 }
3736 if (err) {
3737 dev_warn(&pdev->dev, "only %d net devices registered\n", i);
3738 err = 0;
3739 };
3747 3740
3748 if (cxgb4_debugfs_root) { 3741 if (cxgb4_debugfs_root) {
3749 adapter->debugfs_root = debugfs_create_dir(pci_name(pdev), 3742 adapter->debugfs_root = debugfs_create_dir(pci_name(pdev),