* [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop
@ 2024-02-28 12:45 Oleksij Rempel
2024-02-28 13:18 ` Jiri Pirko
2024-03-01 8:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2024-02-28 12:45 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
Current driver has some asymmetry in the runtime PM calls. On lan78xx_open()
it will call usb_autopm_get() and unconditionally usb_autopm_put(). And
on lan78xx_stop() it will call only usb_autopm_put(). So far, it was
working only because this driver do not activate autosuspend by default,
so it was visible only by warning "Runtime PM usage count underflow!".
Since, with current driver, we can't use runtime PM with active link,
execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise,
keep ref counting high as long as interface is open.
Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/usb/lan78xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 3ff430198512..80ee4fcdfb36 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3135,7 +3135,8 @@ static int lan78xx_open(struct net_device *net)
done:
mutex_unlock(&dev->dev_mutex);
- usb_autopm_put_interface(dev->intf);
+ if (ret < 0)
+ usb_autopm_put_interface(dev->intf);
return ret;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop
2024-02-28 12:45 [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop Oleksij Rempel
@ 2024-02-28 13:18 ` Jiri Pirko
2024-03-01 8:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2024-02-28 13:18 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Woojung Huh, kernel, linux-kernel, netdev, UNGLinuxDriver
Wed, Feb 28, 2024 at 01:45:17PM CET, o.rempel@pengutronix.de wrote:
>Current driver has some asymmetry in the runtime PM calls. On lan78xx_open()
>it will call usb_autopm_get() and unconditionally usb_autopm_put(). And
>on lan78xx_stop() it will call only usb_autopm_put(). So far, it was
>working only because this driver do not activate autosuspend by default,
>so it was visible only by warning "Runtime PM usage count underflow!".
>
>Since, with current driver, we can't use runtime PM with active link,
>execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise,
>keep ref counting high as long as interface is open.
>
>Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
>Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop
2024-02-28 12:45 [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop Oleksij Rempel
2024-02-28 13:18 ` Jiri Pirko
@ 2024-03-01 8:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-01 8:40 UTC (permalink / raw)
To: Oleksij Rempel
Cc: davem, edumazet, kuba, pabeni, woojung.huh, kernel, linux-kernel,
netdev, UNGLinuxDriver
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 28 Feb 2024 13:45:17 +0100 you wrote:
> Current driver has some asymmetry in the runtime PM calls. On lan78xx_open()
> it will call usb_autopm_get() and unconditionally usb_autopm_put(). And
> on lan78xx_stop() it will call only usb_autopm_put(). So far, it was
> working only because this driver do not activate autosuspend by default,
> so it was visible only by warning "Runtime PM usage count underflow!".
>
> Since, with current driver, we can't use runtime PM with active link,
> execute lan78xx_open()->usb_autopm_put() only in error case. Otherwise,
> keep ref counting high as long as interface is open.
>
> [...]
Here is the summary with links:
- [net,v1,1/1] net: lan78xx: fix runtime PM count underflow on link stop
https://git.kernel.org/netdev/net/c/1eecc7ab82c4
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-01 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28 12:45 [PATCH net v1 1/1] net: lan78xx: fix runtime PM count underflow on link stop Oleksij Rempel
2024-02-28 13:18 ` Jiri Pirko
2024-03-01 8:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).