[ipq40xx][edma] Fix synchronization issue with poll_required
Add mutex locks for poll_required flag of adapter, which
is being used by ethtool apis as well as sysctls
Change-Id: Ibc83acda154ac11175c374ba0d5b83548ffb6f8b
Signed-off-by: Rakesh Nair <ranair@codeaurora.org>
diff --git a/edma.c b/edma.c
index 8d505a5..f4541d7 100644
--- a/edma.c
+++ b/edma.c
@@ -2151,6 +2151,7 @@
/* if Link polling is enabled, in our case enabled for WAN, then
* do a phy start, else always set link as UP
*/
+ mutex_lock(&adapter->poll_mutex);
if (adapter->poll_required) {
if (!IS_ERR(adapter->phydev)) {
phy_start(adapter->phydev);
@@ -2163,6 +2164,7 @@
adapter->link_state = __EDMA_LINKUP;
netif_carrier_on(netdev);
}
+ mutex_unlock(&adapter->poll_mutex);
return 0;
}
@@ -2179,10 +2181,12 @@
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
+ mutex_lock(&adapter->poll_mutex);
if (adapter->poll_required) {
if (!IS_ERR(adapter->phydev))
phy_stop(adapter->phydev);
}
+ mutex_unlock(&adapter->poll_mutex);
adapter->link_state = __EDMA_LINKDOWN;