Skip to contentSkip to conversation

usb: kbd: Do not deregister usbkbd twice when using dm

PATCH New Hans de Goede 2 participants 2 messages Apr 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: kbd: Do not deregister usbkbd twice when using dm

The dm usb_kbd_remove function() will deregister the usb keyboard for us on a "usb reset" / "usb stop" so there is no need to manually call usb_kbd_deregister() in the dm case.

This commit removes usb_kbd_deregister() in the dm case fixing the following "usb reset" errors:

usb_kbd_remove: warning, ret=-6
device_remove: Device 'usb_kbd' failed to remove, but children are gone

---
 cmd/usb.c        | 2 +-
 common/usb_kbd.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
cmd/usb.c +1 -1
index 719f6f2..f1a7deb 100644
@@ -545,7 +545,7 @@ static int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 static int do_usb_stop_keyboard(int force)
 {
-#ifdef CONFIG_USB_KEYBOARD
+#if !defined CONFIG_DM_USB && defined CONFIG_USB_KEYBOARD
 	if (usb_kbd_deregister(force) != 0) {
 		printf("USB not stopped: usbkbd still using USB\n");
 		return 1;
common/usb_kbd.c +2 -1
index d84865f..97f79f8 100644
@@ -566,7 +566,6 @@ int drv_usb_kbd_init(void)
 	/* No USB Keyboard found */
 	return -1;
 }
-#endif
 
 /* Deregister the keyboard. */
 int usb_kbd_deregister(int force)
@@ -599,6 +598,8 @@ int usb_kbd_deregister(int force)
 #endif
 }
 
+#endif
+
 #ifdef CONFIG_DM_USB
 
 static int usb_kbd_probe(struct udevice *dev)
Signature · 1 line
2.7.2
Applied
#1 lore raw

PATCH 1/1 usb: kbd: Do not deregister usbkbd twice when using dm

Quoted 11 lines · Hans de Goede

The dm usb_kbd_remove function() will deregister the usb keyboard for us on a "usb reset" / "usb stop" so there is no need to manually call usb_kbd_deregister() in the dm case.

This commit removes usb_kbd_deregister() in the dm case fixing the following "usb reset" errors:

usb_kbd_remove: warning, ret=-6
device_remove: Device 'usb_kbd' failed to remove, but children are gone

Applied, thanks.

Best regards,
Marek Vasut