[PATCH] usb: usbfs: Add reset_resume callback to usbfs.

From: ccc194101
Date: Thu Aug 21 2025 - 22:46:51 EST


From: chenchangcheng <chenchangcheng@xxxxxxxxxx>

When an Apple device is inserted into the host, and the host
wakes up from S3/S4 power states, if the reset_resume process
is triggered, the absence of a reset_resume callback in usbfs will
cause the device to unbind.
By adding a reset_resume callback to usbfs and reporting REMOVE and ADD
uevents in reset_resume, the userspace is prompted to reissue commands
to re-establish the binding with usbfs.

Signed-off-by: chenchangcheng <chenchangcheng@xxxxxxxxxx>
---
drivers/usb/core/devio.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f6ce6e26e0d4..358850596b0d 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -749,6 +749,14 @@ static int driver_resume(struct usb_interface *intf)
return 0;
}

+static int driver_reset_resume(struct usb_interface *intf)
+{
+ struct usb_device *udev = interface_to_usbdev(intf);
+
+ kobject_uevent(&udev->dev.kobj, KOBJ_REMOVE);
+ kobject_uevent(&udev->dev.kobj, KOBJ_ADD);
+ return 0;
+}
#ifdef CONFIG_PM
/* The following routines apply to the entire device, not interfaces */
void usbfs_notify_suspend(struct usb_device *udev)
@@ -776,6 +784,7 @@ struct usb_driver usbfs_driver = {
.disconnect = driver_disconnect,
.suspend = driver_suspend,
.resume = driver_resume,
+ .reset_resume = driver_reset_resume,
.supports_autosuspend = 1,
};


base-commit: b19a97d57c15643494ac8bfaaa35e3ee472d41da
--
2.25.1