Skip to content

Commit b1a3c2b

Browse files
Dimitris Michailidisdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ba27816 commit b1a3c2b

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

drivers/net/cxgb4/cxgb4.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ struct adapter {
486486
unsigned int fn;
487487
unsigned int flags;
488488

489-
const char *name;
490489
int msg_enable;
491490

492491
struct adapter_params params;

drivers/net/cxgb4/cxgb4_main.c

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,11 @@ static void name_msix_vecs(struct adapter *adap)
525525
int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc);
526526

527527
/* 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);
529529

530530
/* 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);
532533

533534
/* Ethernet queues */
534535
for_each_port(adap, j) {
@@ -543,11 +544,11 @@ static void name_msix_vecs(struct adapter *adap)
543544
/* offload queues */
544545
for_each_ofldrxq(&adap->sge, i)
545546
snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d",
546-
adap->name, i);
547+
adap->port[0]->name, i);
547548

548549
for_each_rdmarxq(&adap->sge, i)
549550
snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d",
550-
adap->name, i);
551+
adap->port[0]->name, i);
551552
}
552553

553554
static int request_msix_queue_irqs(struct adapter *adap)
@@ -2664,7 +2665,7 @@ static int cxgb_up(struct adapter *adap)
26642665
} else {
26652666
err = request_irq(adap->pdev->irq, t4_intr_handler(adap),
26662667
(adap->flags & USING_MSI) ? 0 : IRQF_SHARED,
2667-
adap->name, adap);
2668+
adap->port[0]->name, adap);
26682669
if (err)
26692670
goto irq_err;
26702671
}
@@ -3627,7 +3628,6 @@ static int __devinit init_one(struct pci_dev *pdev,
36273628
adapter->pdev = pdev;
36283629
adapter->pdev_dev = &pdev->dev;
36293630
adapter->fn = func;
3630-
adapter->name = pci_name(pdev);
36313631
adapter->msg_enable = dflt_msg_enable;
36323632
memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
36333633

@@ -3724,26 +3724,19 @@ static int __devinit init_one(struct pci_dev *pdev,
37243724

37253725
err = register_netdev(adapter->port[i]);
37263726
if (err)
3727-
dev_warn(&pdev->dev,
3728-
"cannot register net device %s, skipping\n",
3729-
adapter->port[i]->name);
3730-
else {
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-
}
3727+
break;
3728+
__set_bit(i, &adapter->registered_device_map);
3729+
adapter->chan_map[pi->tx_chan] = i;
3730+
print_port_info(adapter->port[i]);
37423731
}
3743-
if (!adapter->registered_device_map) {
3732+
if (i == 0) {
37443733
dev_err(&pdev->dev, "could not register any net devices\n");
37453734
goto out_free_dev;
37463735
}
3736+
if (err) {
3737+
dev_warn(&pdev->dev, "only %d net devices registered\n", i);
3738+
err = 0;
3739+
};
37473740

37483741
if (cxgb4_debugfs_root) {
37493742
adapter->debugfs_root = debugfs_create_dir(pci_name(pdev),

0 commit comments

Comments
 (0)