diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-11-25 11:11:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-26 18:59:32 -0500 |
commit | 1dfc5ceacd00365a9089e98643f4b26253d5a6aa (patch) | |
tree | 41dd6ca72a535d75e331d0df71a6fba26998af17 /drivers/net/sfc/efx.c | |
parent | 26deba501371c215f95624ede81ab5b611fd7d95 (diff) |
sfc: Hold MAC lock for longer in efx_init_port()
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>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r-- | drivers/net/sfc/efx.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 4ebad613e6de..155aa1cca366 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -737,23 +737,27 @@ static int efx_init_port(struct efx_nic *efx) | |||
737 | 737 | ||
738 | EFX_LOG(efx, "init port\n"); | 738 | EFX_LOG(efx, "init port\n"); |
739 | 739 | ||
740 | mutex_lock(&efx->mac_lock); | ||
741 | |||
740 | rc = efx->phy_op->init(efx); | 742 | rc = efx->phy_op->init(efx); |
741 | if (rc) | 743 | if (rc) |
742 | return rc; | 744 | goto fail1; |
743 | mutex_lock(&efx->mac_lock); | ||
744 | efx->phy_op->reconfigure(efx); | 745 | efx->phy_op->reconfigure(efx); |
745 | rc = falcon_switch_mac(efx); | 746 | rc = falcon_switch_mac(efx); |
746 | mutex_unlock(&efx->mac_lock); | ||
747 | if (rc) | 747 | if (rc) |
748 | goto fail; | 748 | goto fail2; |
749 | efx->mac_op->reconfigure(efx); | 749 | efx->mac_op->reconfigure(efx); |
750 | 750 | ||
751 | efx->port_initialized = true; | 751 | efx->port_initialized = true; |
752 | efx_stats_enable(efx); | 752 | efx_stats_enable(efx); |
753 | |||
754 | mutex_unlock(&efx->mac_lock); | ||
753 | return 0; | 755 | return 0; |
754 | 756 | ||
755 | fail: | 757 | fail2: |
756 | efx->phy_op->fini(efx); | 758 | efx->phy_op->fini(efx); |
759 | fail1: | ||
760 | mutex_unlock(&efx->mac_lock); | ||
757 | return rc; | 761 | return rc; |
758 | } | 762 | } |
759 | 763 | ||