Commit b1a3c2b6 authored by Dimitris Michailidis's avatar Dimitris Michailidis Committed by David S. Miller

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: default avatarDimitris Michailidis <dm@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ba27816c
...@@ -486,7 +486,6 @@ struct adapter { ...@@ -486,7 +486,6 @@ struct adapter {
unsigned int fn; unsigned int fn;
unsigned int flags; unsigned int flags;
const char *name;
int msg_enable; int msg_enable;
struct adapter_params params; struct adapter_params params;
......
...@@ -525,10 +525,11 @@ static void name_msix_vecs(struct adapter *adap) ...@@ -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); int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc);
/* non-data interrupts */ /* 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 */ /* 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 */ /* Ethernet queues */
for_each_port(adap, j) { for_each_port(adap, j) {
...@@ -543,11 +544,11 @@ static void name_msix_vecs(struct adapter *adap) ...@@ -543,11 +544,11 @@ static void name_msix_vecs(struct adapter *adap)
/* offload queues */ /* offload queues */
for_each_ofldrxq(&adap->sge, i) for_each_ofldrxq(&adap->sge, i)
snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d", 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) for_each_rdmarxq(&adap->sge, i)
snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d", 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) static int request_msix_queue_irqs(struct adapter *adap)
...@@ -2664,7 +2665,7 @@ static int cxgb_up(struct adapter *adap) ...@@ -2664,7 +2665,7 @@ static int cxgb_up(struct adapter *adap)
} else { } else {
err = request_irq(adap->pdev->irq, t4_intr_handler(adap), err = request_irq(adap->pdev->irq, t4_intr_handler(adap),
(adap->flags & USING_MSI) ? 0 : IRQF_SHARED, (adap->flags & USING_MSI) ? 0 : IRQF_SHARED,
adap->name, adap); adap->port[0]->name, adap);
if (err) if (err)
goto irq_err; goto irq_err;
} }
...@@ -3627,7 +3628,6 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3627,7 +3628,6 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter->pdev = pdev; adapter->pdev = pdev;
adapter->pdev_dev = &pdev->dev; adapter->pdev_dev = &pdev->dev;
adapter->fn = func; adapter->fn = func;
adapter->name = pci_name(pdev);
adapter->msg_enable = dflt_msg_enable; adapter->msg_enable = dflt_msg_enable;
memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
...@@ -3724,26 +3724,19 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3724,26 +3724,19 @@ static int __devinit init_one(struct pci_dev *pdev,
err = register_netdev(adapter->port[i]); err = register_netdev(adapter->port[i]);
if (err) if (err)
dev_warn(&pdev->dev, break;
"cannot register net device %s, skipping\n", __set_bit(i, &adapter->registered_device_map);
adapter->port[i]->name); adapter->chan_map[pi->tx_chan] = i;
else { print_port_info(adapter->port[i]);
/*
* 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]);
}
} }
if (!adapter->registered_device_map) { if (i == 0) {
dev_err(&pdev->dev, "could not register any net devices\n"); dev_err(&pdev->dev, "could not register any net devices\n");
goto out_free_dev; goto out_free_dev;
} }
if (err) {
dev_warn(&pdev->dev, "only %d net devices registered\n", i);
err = 0;
};
if (cxgb4_debugfs_root) { if (cxgb4_debugfs_root) {
adapter->debugfs_root = debugfs_create_dir(pci_name(pdev), adapter->debugfs_root = debugfs_create_dir(pci_name(pdev),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment