[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250822024602.42894-1-ccc194101@163.com>
Date: Fri, 22 Aug 2025 10:46:02 +0800
From: ccc194101@....com
To: gregkh@...uxfoundation.org
Cc: jannh@...gle.com,
stern@...land.harvard.edu,
rex.nie@...uarmicro.com,
linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
chenchangcheng <chenchangcheng@...inos.cn>
Subject: [PATCH] usb: usbfs: Add reset_resume callback to usbfs.
From: chenchangcheng <chenchangcheng@...inos.cn>
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@...inos.cn>
---
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
Powered by blists - more mailing lists