Re: [PATCH v2] r8152: Suspend USB device before shutdown when WoL is enabled

From: Oliver Neukum
Date: Thu Jul 20 2023 - 04:59:29 EST




On 19.07.23 19:37, Alexandru Gagniuc wrote:
For Wake-on-LAN to work from S5 (shutdown), the USB link must be put
in U3 state. If it is not, and the host "disappears", the chip will
no longer respond to WoL triggers.

First, a question, does this also apply to S4?

To resolve this, add a notifier block and register it as a reboot
notifier. When WoL is enabled, work through the usb_device struct to
get to the suspend function. Calling this function puts the link in
the correct state for WoL to function.

Second, do we really want this to be done for every driver with this issue
or do we want a flag for core USB code to suspend devices when the system
goes down? UAS at least does something similar.

Third, what happens if the device is already suspended when the notifier runs?

Regards
Oliver