Re: [PATCH 1/2] Revert "net: smsc911x: Make Runtime PM handling more fine-grained"

From: Geert Uytterhoeven
Date: Thu Mar 16 2023 - 05:08:05 EST


Hi Wolfram,

On Thu, Mar 16, 2023 at 8:46 AM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> This reverts commit 1e30b8d755b81b0d1585cb22bc753e9f2124fe87. Running
> 'ifconfig' with the interface down BUGs. This is the culprit:
>
> smsc911x_get_stats from dev_get_stats+0xe4/0xf4
>
> The above function is called with the clocks off, so register read
> fails. Enabling clocks in the above functions does not work, because it
> is called in atomic context. So, let's return to the simple and working
> PM we had before.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

In sh_eth this was fixed differently, by adding a check for
mdp->is_opened to sh_eth_get_stats() [1].
I believe the modern way would be to add a check for netif_running()
instead.

Would adding such a check to smsc911x_get_stats() work for you, too?

[1] 7fa2955ff70ce453 ("sh_eth: Fix sleeping function called from
invalid context")

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds