mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] usb: usbfs: Add reset_resume for usbfs
@ 2024-07-11  8:43 Hongyu Xie
  2024-07-11  8:59 ` Oliver Neukum
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyu Xie @ 2024-07-11  8:43 UTC (permalink / raw)
  To: gregkh; +Cc: brauner, jlayton, xiehongyu1, jack, linux-usb, linux-kernel

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@kylinos.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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-07-18  3:23 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-11  8:43 [PATCH next] usb: usbfs: Add reset_resume for usbfs Hongyu Xie
2024-07-11  8:59 ` Oliver Neukum
2024-07-11 14:41   ` Alan Stern
2024-07-15  8:53     ` Oliver Neukum
2024-07-15 14:22       ` Alan Stern
2024-07-16 12:44         ` Oliver Neukum
2024-07-17  1:43           ` Hongyu Xie
2024-07-17  2:05             ` Alan Stern
2024-07-17  3:13               ` Hongyu Xie
2024-07-17  7:52                 ` Oliver Neukum
2024-07-17 13:44                 ` Alan Stern
2024-07-17 15:27                   ` Oliver Neukum
2024-07-17  7:42             ` Oliver Neukum
2024-07-18  3:23               ` Hongyu Xie
2024-07-12  3:10   ` Hongyu Xie
2024-07-13  2:22     ` Alan Stern
2024-07-15  1:13       ` Hongyu Xie
2024-07-15  8:40         ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®