diff options
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r-- | drivers/usb/storage/usb.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 1c0b89f2a138..f1c96261a501 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -72,6 +72,10 @@ | |||
72 | #include "sierra_ms.h" | 72 | #include "sierra_ms.h" |
73 | #include "option_ms.h" | 73 | #include "option_ms.h" |
74 | 74 | ||
75 | #if IS_ENABLED(CONFIG_USB_UAS) | ||
76 | #include "uas-detect.h" | ||
77 | #endif | ||
78 | |||
75 | /* Some informational data */ | 79 | /* Some informational data */ |
76 | MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); | 80 | MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); |
77 | MODULE_DESCRIPTION("USB Mass Storage driver for Linux"); | 81 | MODULE_DESCRIPTION("USB Mass Storage driver for Linux"); |
@@ -459,14 +463,14 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) | |||
459 | #define TOLOWER(x) ((x) | 0x20) | 463 | #define TOLOWER(x) ((x) | 0x20) |
460 | 464 | ||
461 | /* Adjust device flags based on the "quirks=" module parameter */ | 465 | /* Adjust device flags based on the "quirks=" module parameter */ |
462 | static void adjust_quirks(struct us_data *us) | 466 | void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) |
463 | { | 467 | { |
464 | char *p; | 468 | char *p; |
465 | u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor); | 469 | u16 vid = le16_to_cpu(udev->descriptor.idVendor); |
466 | u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct); | 470 | u16 pid = le16_to_cpu(udev->descriptor.idProduct); |
467 | unsigned f = 0; | 471 | unsigned f = 0; |
468 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE | | 472 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE | |
469 | US_FL_FIX_CAPACITY | | 473 | US_FL_FIX_CAPACITY | US_FL_IGNORE_UAS | |
470 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | | 474 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | |
471 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | | 475 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | |
472 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | | 476 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | |
@@ -537,14 +541,18 @@ static void adjust_quirks(struct us_data *us) | |||
537 | case 's': | 541 | case 's': |
538 | f |= US_FL_SINGLE_LUN; | 542 | f |= US_FL_SINGLE_LUN; |
539 | break; | 543 | break; |
544 | case 'u': | ||
545 | f |= US_FL_IGNORE_UAS; | ||
546 | break; | ||
540 | case 'w': | 547 | case 'w': |
541 | f |= US_FL_NO_WP_DETECT; | 548 | f |= US_FL_NO_WP_DETECT; |
542 | break; | 549 | break; |
543 | /* Ignore unrecognized flag characters */ | 550 | /* Ignore unrecognized flag characters */ |
544 | } | 551 | } |
545 | } | 552 | } |
546 | us->fflags = (us->fflags & ~mask) | f; | 553 | *fflags = (*fflags & ~mask) | f; |
547 | } | 554 | } |
555 | EXPORT_SYMBOL_GPL(usb_stor_adjust_quirks); | ||
548 | 556 | ||
549 | /* Get the unusual_devs entries and the string descriptors */ | 557 | /* Get the unusual_devs entries and the string descriptors */ |
550 | static int get_device_info(struct us_data *us, const struct usb_device_id *id, | 558 | static int get_device_info(struct us_data *us, const struct usb_device_id *id, |
@@ -564,7 +572,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id, | |||
564 | idesc->bInterfaceProtocol : | 572 | idesc->bInterfaceProtocol : |
565 | unusual_dev->useTransport; | 573 | unusual_dev->useTransport; |
566 | us->fflags = id->driver_info; | 574 | us->fflags = id->driver_info; |
567 | adjust_quirks(us); | 575 | usb_stor_adjust_quirks(us->pusb_dev, &us->fflags); |
568 | 576 | ||
569 | if (us->fflags & US_FL_IGNORE_DEVICE) { | 577 | if (us->fflags & US_FL_IGNORE_DEVICE) { |
570 | dev_info(pdev, "device ignored\n"); | 578 | dev_info(pdev, "device ignored\n"); |
@@ -1035,6 +1043,12 @@ static int storage_probe(struct usb_interface *intf, | |||
1035 | int result; | 1043 | int result; |
1036 | int size; | 1044 | int size; |
1037 | 1045 | ||
1046 | /* If uas is enabled and this device can do uas then ignore it. */ | ||
1047 | #if IS_ENABLED(CONFIG_USB_UAS) | ||
1048 | if (uas_use_uas_driver(intf, id)) | ||
1049 | return -ENXIO; | ||
1050 | #endif | ||
1051 | |||
1038 | /* | 1052 | /* |
1039 | * If the device isn't standard (is handled by a subdriver | 1053 | * If the device isn't standard (is handled by a subdriver |
1040 | * module) then don't accept it. | 1054 | * module) then don't accept it. |