Some USB mass storage devices can take a comparatively long time after vbus is applied until they can be enumerated. Board code can reissue usb_rescan() to retry enumeration at a later time. It's useful for board code to check whether any new devices have been detected by a usb_rescan() call. To facilitate this, have usb_rescan() return the number of devices found in addition to printing it to the log. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/usb/core/usb.c | 4 +++- include/usb/usb.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 34a0f004f7bb..ed3a96cb9e5e 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -599,7 +599,7 @@ int usb_host_detect(struct usb_host *host) return 0; } -void usb_rescan(void) +int usb_rescan(void) { struct usb_host *host; int ret; @@ -613,6 +613,8 @@ void usb_rescan(void) } pr_info("%d USB Device(s) found\n", dev_count); + + return dev_count; } /*------------------------------------------------------------------- diff --git a/include/usb/usb.h b/include/usb/usb.h index 39f475091617..04b433ba73ca 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -201,7 +201,7 @@ int usb_clear_halt(struct usb_device *dev, int pipe); int usb_string(struct usb_device *dev, int index, char *buf, size_t size); int usb_set_interface(struct usb_device *dev, int interface, int alternate); -void usb_rescan(void); +int usb_rescan(void); /* big endian -> little endian conversion */ /* some CPUs are already little endian e.g. the ARM920T */ -- 2.30.2