From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] usb: have usb_rescan return count of enumerated devices
Date: Tue, 4 Oct 2022 09:48:34 +0200 [thread overview]
Message-ID: <20221004074834.GH986@pengutronix.de> (raw)
In-Reply-To: <20220929100502.895553-1-a.fatoum@pengutronix.de>
On Thu, Sep 29, 2022 at 12:05:02PM +0200, Ahmad Fatoum wrote:
> 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@pengutronix.de>
> ---
> drivers/usb/core/usb.c | 4 +++-
> include/usb/usb.h | 2 +-
> 2 files changed, 4 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
>
> 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
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2022-10-04 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 10:05 Ahmad Fatoum
2022-10-04 7:48 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221004074834.GH986@pengutronix.de \
--to=sha@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox