aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-08-01 20:39:38 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-08-24 15:10:23 -0400
commitadeb15aa1ce3413d461ec0958a979e9d64cd764c (patch)
tree58cf2fa35cffe57f753d296df4d9103fb85d265a /drivers/net/ethernet/sfc
parent3f65ea5b2aa0f76a463c85ed39955c26faf4f5a7 (diff)
sfc: Assign efx and efx->type as early as possible in efx_pci_probe()
We also stop clearing *efx in efx_init_struct(). This is safe because alloc_etherdev_mq() already clears it for us. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/efx.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 4105a6664765..92f002029481 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -2422,13 +2422,12 @@ static const struct efx_phy_operations efx_dummy_phy_operations = {
2422/* This zeroes out and then fills in the invariants in a struct 2422/* This zeroes out and then fills in the invariants in a struct
2423 * efx_nic (including all sub-structures). 2423 * efx_nic (including all sub-structures).
2424 */ 2424 */
2425static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type, 2425static int efx_init_struct(struct efx_nic *efx,
2426 struct pci_dev *pci_dev, struct net_device *net_dev) 2426 struct pci_dev *pci_dev, struct net_device *net_dev)
2427{ 2427{
2428 int i; 2428 int i;
2429 2429
2430 /* Initialise common structures */ 2430 /* Initialise common structures */
2431 memset(efx, 0, sizeof(*efx));
2432 spin_lock_init(&efx->biu_lock); 2431 spin_lock_init(&efx->biu_lock);
2433#ifdef CONFIG_SFC_MTD 2432#ifdef CONFIG_SFC_MTD
2434 INIT_LIST_HEAD(&efx->mtd_list); 2433 INIT_LIST_HEAD(&efx->mtd_list);
@@ -2455,8 +2454,6 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
2455 goto fail; 2454 goto fail;
2456 } 2455 }
2457 2456
2458 efx->type = type;
2459
2460 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS); 2457 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS);
2461 2458
2462 /* Higher numbered interrupt modes are less capable! */ 2459 /* Higher numbered interrupt modes are less capable! */
@@ -2660,7 +2657,6 @@ static int efx_pci_probe_main(struct efx_nic *efx)
2660static int __devinit efx_pci_probe(struct pci_dev *pci_dev, 2657static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2661 const struct pci_device_id *entry) 2658 const struct pci_device_id *entry)
2662{ 2659{
2663 const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;
2664 struct net_device *net_dev; 2660 struct net_device *net_dev;
2665 struct efx_nic *efx; 2661 struct efx_nic *efx;
2666 int rc; 2662 int rc;
@@ -2670,10 +2666,12 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2670 EFX_MAX_RX_QUEUES); 2666 EFX_MAX_RX_QUEUES);
2671 if (!net_dev) 2667 if (!net_dev)
2672 return -ENOMEM; 2668 return -ENOMEM;
2673 net_dev->features |= (type->offload_features | NETIF_F_SG | 2669 efx = netdev_priv(net_dev);
2670 efx->type = (const struct efx_nic_type *) entry->driver_data;
2671 net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
2674 NETIF_F_HIGHDMA | NETIF_F_TSO | 2672 NETIF_F_HIGHDMA | NETIF_F_TSO |
2675 NETIF_F_RXCSUM); 2673 NETIF_F_RXCSUM);
2676 if (type->offload_features & NETIF_F_V6_CSUM) 2674 if (efx->type->offload_features & NETIF_F_V6_CSUM)
2677 net_dev->features |= NETIF_F_TSO6; 2675 net_dev->features |= NETIF_F_TSO6;
2678 /* Mask for features that also apply to VLAN devices */ 2676 /* Mask for features that also apply to VLAN devices */
2679 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG | 2677 net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |
@@ -2681,10 +2679,9 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2681 NETIF_F_RXCSUM); 2679 NETIF_F_RXCSUM);
2682 /* All offloads can be toggled */ 2680 /* All offloads can be toggled */
2683 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA; 2681 net_dev->hw_features = net_dev->features & ~NETIF_F_HIGHDMA;
2684 efx = netdev_priv(net_dev);
2685 pci_set_drvdata(pci_dev, efx); 2682 pci_set_drvdata(pci_dev, efx);
2686 SET_NETDEV_DEV(net_dev, &pci_dev->dev); 2683 SET_NETDEV_DEV(net_dev, &pci_dev->dev);
2687 rc = efx_init_struct(efx, type, pci_dev, net_dev); 2684 rc = efx_init_struct(efx, pci_dev, net_dev);
2688 if (rc) 2685 if (rc)
2689 goto fail1; 2686 goto fail1;
2690 2687