]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: macb: ensure the device is available before accessing GEMGXL control registers
authorZong Li <zong.li@sifive.com>
Sat, 22 May 2021 09:16:11 +0000 (17:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jun 2021 09:34:52 +0000 (11:34 +0200)
commit13b036fe4eaa8ea169803fb4794aa9b2031a19dc
tree47560358eadc9c0006f47d1393c7d393df236b63
parent94d22d54e7858adf59476a06e74ed449695f081d
net: macb: ensure the device is available before accessing GEMGXL control registers

[ Upstream commit 5eff1461a6dec84f04fafa9128548bad51d96147 ]

If runtime power menagement is enabled, the gigabit ethernet PLL would
be disabled after macb_probe(). During this period of time, the system
would hang up if we try to access GEMGXL control registers.

We can't put runtime_pm_get/runtime_pm_put/ there due to the issue of
sleep inside atomic section (7fa2955ff70ce453 ("sh_eth: Fix sleeping
function called from invalid context"). Add netif_running checking to
ensure the device is available before accessing GEMGXL device.

Changed in v2:
 - Use netif_running instead of its own flag

Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/cadence/macb.c