From: Douglas Anderson Date: Thu, 30 May 2024 23:43:09 +0000 (-0700) Subject: r8152: Wake up the system if the we need a reset X-Git-Tag: v6.11-rc1~163^2~264 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c1d92a740c002f36a919a55689d0ef83b61fd1c;p=thirdparty%2Flinux.git r8152: Wake up the system if the we need a reset If we get to the end of the r8152's suspend() routine and we find that the USB device is INACCESSIBLE then it means that some of our preparation for suspend didn't take place. We need a USB reset to get ourselves back in a consistent state so we can try again and that can't happen during system suspend. Call pm_wakeup_event() to wake the system up in this case. Signed-off-by: Douglas Anderson Acked-by: Hayes Wang Link: https://lore.kernel.org/r/66590f25.170a0220.8b5ad.1752@mx.google.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 6a3f4b2114eef..09fe70bc45d48 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -8647,6 +8647,13 @@ static int rtl8152_system_suspend(struct r8152 *tp) tasklet_enable(&tp->tx_tl); } + /* If we're inaccessible here then some of the work that we did to + * get the adapter ready for suspend didn't work. Queue up a wakeup + * event so we can try again. + */ + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + pm_wakeup_event(&tp->udev->dev, 0); + return 0; }