linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: storage: skip only when uas driver is loaded
@ 2019-07-01  8:48 JC Kuo
  2019-07-01  8:52 ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: JC Kuo @ 2019-07-01  8:48 UTC (permalink / raw)
  To: linux-usb, stern, usb-storage, oneukum; +Cc: JC Kuo

When usb-storage driver detects a UAS capable device, it ignores the
device if CONFIG_USB_UAS is enabled. usb-storage driver assumes uas
driver certainly will be loaded. However, it's possible that uas
driver will not be loaded, for example, uas kernel module is not
installed properly or it is in modprobe blacklist.

In case of uas driver not being loaded, the UAS capable device will
not fallback to work at Bulk-only-transfer mode. The device just
disappears without any notification to user/userspace.

This commit changes usb-storage driver to skip UAS capable device
only when uas driver is already loaded to make sure the device will
at least work with Bulk protocol.

Signed-off-by: JC Kuo <jckuo@nvidia.com>
---
 drivers/usb/core/driver.c | 1 +
 drivers/usb/storage/usb.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index ebcadaad89d1..265c5dd490d2 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1923,3 +1923,4 @@ struct bus_type usb_bus_type = {
 	.uevent =	usb_uevent,
 	.need_parent_lock =	true,
 };
+EXPORT_SYMBOL_GPL(usb_bus_type);
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 9a79cd9762f3..d8f64e808783 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -1097,9 +1097,10 @@ static int storage_probe(struct usb_interface *intf,
 	int result;
 	int size;
 
-	/* If uas is enabled and this device can do uas then ignore it. */
+	/* If uas driver is loaded and this device can do uas then ignore it. */
 #if IS_ENABLED(CONFIG_USB_UAS)
-	if (uas_use_uas_driver(intf, id, NULL))
+	if (driver_find("uas", &usb_bus_type) &&
+		uas_use_uas_driver(intf, id, NULL))
 		return -ENXIO;
 #endif
 
-- 
2.17.1


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

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

end of thread, other threads:[~2019-07-02 15:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-01  8:48 [PATCH] usb: storage: skip only when uas driver is loaded JC Kuo
2019-07-01  8:52 ` Greg KH
2019-07-02  2:36   ` JC Kuo
2019-07-02  4:42     ` Greg KH
2019-07-02  5:29       ` JC Kuo
2019-07-02  6:56         ` JC Kuo
2019-07-02  7:34           ` Greg KH
2019-07-02  7:57             ` JC Kuo
2019-07-02  8:14               ` Greg KH
2019-07-02  9:11           ` Oliver Neukum
2019-07-02 14:05             ` JC Kuo
2019-07-02 15:29               ` Oliver Neukum
2019-07-02  6:53     ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).