[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240711084321.44916-1-xiehongyu1@kylinos.cn>
Date: Thu, 11 Jul 2024 16:43:21 +0800
From: Hongyu Xie <xiehongyu1@...inos.cn>
To: gregkh@...uxfoundation.org
Cc: brauner@...nel.org,
jlayton@...nel.org,
xiehongyu1@...inos.cn,
jack@...e.cz,
linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH next] usb: usbfs: Add reset_resume for usbfs
During hibernation, usb_resume_interface will set needs_binding to 1 if
the usb_driver has no reset_resume implimentation. The USB interface
will be rebind after usb_resume_complete.
Normally, that's fine. But if a USB interface has a matched kernel
driver, and a userspace driver or application is using this USB
interface through usbfs during hibernation, usbfs will be
detatched with the USB interface after resume. And this USB interface
will be bind with a kernel driver instead of usbfs.
So add reset_resume to fix this.
Signed-off-by: Hongyu Xie <xiehongyu1@...inos.cn>
---
drivers/usb/core/devio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 3beb6a862e80..8c07df104c9a 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -746,6 +746,11 @@ static int driver_resume(struct usb_interface *intf)
return 0;
}
+static int driver_reset_resume(struct usb_interface *intf)
+{
+ return 0;
+}
+
#ifdef CONFIG_PM
/* The following routines apply to the entire device, not interfaces */
void usbfs_notify_suspend(struct usb_device *udev)
@@ -773,6 +778,7 @@ struct usb_driver usbfs_driver = {
.disconnect = driver_disconnect,
.suspend = driver_suspend,
.resume = driver_resume,
+ .reset_resume = driver_reset_resume,
.supports_autosuspend = 1,
};
--
2.34.1
Powered by blists - more mailing lists