Skip to content

Commit

Permalink
sfc: Hold MAC lock for longer in efx_init_port()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Nov 26, 2009
1 parent 26deba5 commit 1dfc5ce
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,23 +737,27 @@ static int efx_init_port(struct efx_nic *efx)

EFX_LOG(efx, "init port\n");

mutex_lock(&efx->mac_lock);

rc = efx->phy_op->init(efx);
if (rc)
return rc;
mutex_lock(&efx->mac_lock);
goto fail1;
efx->phy_op->reconfigure(efx);
rc = falcon_switch_mac(efx);
mutex_unlock(&efx->mac_lock);
if (rc)
goto fail;
goto fail2;
efx->mac_op->reconfigure(efx);

efx->port_initialized = true;
efx_stats_enable(efx);

mutex_unlock(&efx->mac_lock);
return 0;

fail:
fail2:
efx->phy_op->fini(efx);
fail1:
mutex_unlock(&efx->mac_lock);
return rc;
}

Expand Down

0 comments on commit 1dfc5ce

Please sign in to comment.