Although efx_init_port() is only called at probe time and so cannot
race with port reconfiguration, most of the functions it calls can
expect to be called with the MAC lock held.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
EFX_LOG(efx, "init port\n");
EFX_LOG(efx, "init port\n");
+ mutex_lock(&efx->mac_lock);
+
rc = efx->phy_op->init(efx);
if (rc)
rc = efx->phy_op->init(efx);
if (rc)
- return rc;
- mutex_lock(&efx->mac_lock);
efx->phy_op->reconfigure(efx);
rc = falcon_switch_mac(efx);
efx->phy_op->reconfigure(efx);
rc = falcon_switch_mac(efx);
- mutex_unlock(&efx->mac_lock);
efx->mac_op->reconfigure(efx);
efx->port_initialized = true;
efx_stats_enable(efx);
efx->mac_op->reconfigure(efx);
efx->port_initialized = true;
efx_stats_enable(efx);
+
+ mutex_unlock(&efx->mac_lock);
+fail1:
+ mutex_unlock(&efx->mac_lock);