stmmac: fix concurrency in eee initialization.
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>
Tue, 4 Nov 2014 16:08:08 +0000 (17:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Nov 2014 21:22:57 +0000 (16:22 -0500)
commit4741cf9cecf8af57dc612dd96b0056fa8e2f301d
tree21296c83a3e7b9f42f1be40608adf30fc2fffcda
parentb9d73704aab92602fcadff26f61462a6445bd0cf
stmmac: fix concurrency in eee initialization.

This patch aims to fix the concurrency in eee initialization
inside the stmmac driver and related warnings when enable
DEBUG_ATOMIC_SLEEP.

Prior this patch, the stmmac_eee_init could be called in several places
as shown below:

stmmac_open  stmmac_resume         PHY Layer
    |            |                     |
  stmmac_hw_setup           stmmac_adjust_link
    |                                  |           stmmac ethtool
    |__________________________|______________|
                                       |
                                 stmmac_eee_init

The patch removes the stmmac_eee_init call inside the stmmac_hw_setup
that is unnecessary. It is sufficient to call it in the adjust_link to
always guarantee that EEE is always configured at mac level too.

Fixing the lock protection now it is covered another case (not
considered before). The stmmac_eee_init could be called by the ethtool
so critical sections must be protected inside this function too.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c