diff mbox

[U-Boot] usb_storage: skip all unknown devices when probing

Message ID 1415278311-3090-1-git-send-email-smoch@web.de
State Not Applicable
Delegated to: Marek Vasut
Headers show

Commit Message

Sören Moch Nov. 6, 2014, 12:51 p.m. UTC
Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).

This especially avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
---
 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Nov. 6, 2014, 8:41 p.m. UTC | #1
On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
> which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).
> 
> This especially avoids long timeouts when probing for external usb
> harddisks which provide "Enclosure Services".
> 
> Signed-off-by: Soeren Moch <smoch@web.de>
> --
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---
>  common/usb_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index eb7706c..0ac7b48 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev, struct
> us_data *ss, perq = usb_stor_buf[0];
>  	modi = usb_stor_buf[1];
> 
> -	if ((perq & 0x1f) == 0x1f) {
> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {

Why can't you just blacklist 0xd instead ? I mean, this patch would do a bulk
blacklisting of all the obscure devices with peripheral ID above 0x7, but might
still work with this layer (like 0xc ... the RAID controller ; or 0xe ... the
reduced block device).

Won't it make sense to just selectively blacklist the 0xd ?

>  		/* skip unknown devices */
>  		return 0;
>  	}

Best regards,
Marek Vasut
Sören Moch Nov. 7, 2014, 9:28 a.m. UTC | #2
On 11/06/14 21:41, Marek Vasut wrote:
> On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
>> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
>> which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).
>>
>> This especially avoids long timeouts when probing for external usb
>> harddisks which provide "Enclosure Services".
>>
>> Signed-off-by: Soeren Moch <smoch@web.de>
>> --
>> Cc: Marek Vasut <marex@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> ---
>>   common/usb_storage.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/usb_storage.c b/common/usb_storage.c
>> index eb7706c..0ac7b48 100644
>> --- a/common/usb_storage.c
>> +++ b/common/usb_storage.c
>> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev, struct
>> us_data *ss, perq = usb_stor_buf[0];
>>   	modi = usb_stor_buf[1];
>>
>> -	if ((perq & 0x1f) == 0x1f) {
>> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
>
> Why can't you just blacklist 0xd instead ? I mean, this patch would do a bulk
> blacklisting of all the obscure devices with peripheral ID above 0x7, but might
> still work with this layer (like 0xc ... the RAID controller ; or 0xe ... the
> reduced block device).
>
> Won't it make sense to just selectively blacklist the 0xd ?

If you think it makes more sense to blacklist 0xd only, that is fine with me.
I will prepare a new patch for this.

Best regards,
Soeren Moch

>
>>   		/* skip unknown devices */
>>   		return 0;
>>   	}
>
> Best regards,
> Marek Vasut
>
Marek Vasut Nov. 7, 2014, 9:29 a.m. UTC | #3
On Friday, November 07, 2014 at 10:28:18 AM, Soeren Moch wrote:
> On 11/06/14 21:41, Marek Vasut wrote:
> > On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
> >> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all
> >> devices which are unknown to u-boot (e.g., are not HARDDISK, TAPE,
> >> CDROM, OPDISK).
> >> 
> >> This especially avoids long timeouts when probing for external usb
> >> harddisks which provide "Enclosure Services".
> >> 
> >> Signed-off-by: Soeren Moch <smoch@web.de>
> >> --
> >> Cc: Marek Vasut <marex@denx.de>
> >> Cc: Tom Rini <trini@ti.com>
> >> ---
> >> 
> >>   common/usb_storage.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/common/usb_storage.c b/common/usb_storage.c
> >> index eb7706c..0ac7b48 100644
> >> --- a/common/usb_storage.c
> >> +++ b/common/usb_storage.c
> >> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev,
> >> struct us_data *ss, perq = usb_stor_buf[0];
> >> 
> >>   	modi = usb_stor_buf[1];
> >> 
> >> -	if ((perq & 0x1f) == 0x1f) {
> >> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
> > 
> > Why can't you just blacklist 0xd instead ? I mean, this patch would do a
> > bulk blacklisting of all the obscure devices with peripheral ID above
> > 0x7, but might still work with this layer (like 0xc ... the RAID
> > controller ; or 0xe ... the reduced block device).
> > 
> > Won't it make sense to just selectively blacklist the 0xd ?
> 
> If you think it makes more sense to blacklist 0xd only, that is fine with
> me. I will prepare a new patch for this.

Please also make sure to document why this change is in place. (because the
Enclosure Services cause trouble). A simple comment in the code would be nice.

Thank you!

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/common/usb_storage.c b/common/usb_storage.c
index eb7706c..0ac7b48 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1351,7 +1351,7 @@  int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
 	perq = usb_stor_buf[0];
 	modi = usb_stor_buf[1];
 
-	if ((perq & 0x1f) == 0x1f) {
+	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
 		/* skip unknown devices */
 		return 0;
 	}