Re: [PATCH next] usb: usbfs: Add reset_resume for usbfs

From: Alan Stern
Date: Tue Jul 16 2024 - 22:05:36 EST


I'm ignoring most of what you asked Oliver to focus on just one thing:

On Wed, Jul 17, 2024 at 09:43:38AM +0800, Hongyu Xie wrote:
> Even before usbfs->reset_resume is called (if there is one), the USB device
> has already been reset and in a good state.

You are wrong to think that being reset means the device is in a good
state.

The userspace driver may have very carefully put the device into some
non-default state with special settings. All those settings will be
lost when the device gets reset, and they will have to be reloaded
before the device can function properly. But the userspace driver won't
even know this has happened unless the kernel tells it somehow.

Oliver is pointing out that the kernel has to tell the userspace driver
that all the settings have been lost, so the driver will know it needs
to load them back into the device. Currently we have no way to send
this information to the driver. That's why usbfs doesn't have a
reset_resume callback now.

Alan Stern