aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-04-21 05:20:30 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-28 06:48:56 -0400
commita5011d44f0e1117a6db14b19b57c51f8be5673a0 (patch)
treea97c92848993a966d7e05a82af0174eeda1ba42c /drivers/usb
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
uas: Allow uas_use_uas_driver to return usb-storage flags
uas_use_uas_driver may set some US_FL_foo flags during detection, currently these are stored in a local variable and then throw away, but these may be of interest to the caller, so add an extra parameter to (optionally) return the detected flags, and use this in the uas driver. Cc: stable@vger.kernel.org # 3.16 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/storage/uas-detect.h6
-rw-r--r--drivers/usb/storage/uas.c6
-rw-r--r--drivers/usb/storage/usb.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h
index 9893d696fc97..63ae1619fdb8 100644
--- a/drivers/usb/storage/uas-detect.h
+++ b/drivers/usb/storage/uas-detect.h
@@ -51,7 +51,8 @@ static int uas_find_endpoints(struct usb_host_interface *alt,
51} 51}
52 52
53static int uas_use_uas_driver(struct usb_interface *intf, 53static int uas_use_uas_driver(struct usb_interface *intf,
54 const struct usb_device_id *id) 54 const struct usb_device_id *id,
55 unsigned long *flags_ret)
55{ 56{
56 struct usb_host_endpoint *eps[4] = { }; 57 struct usb_host_endpoint *eps[4] = { };
57 struct usb_device *udev = interface_to_usbdev(intf); 58 struct usb_device *udev = interface_to_usbdev(intf);
@@ -132,5 +133,8 @@ static int uas_use_uas_driver(struct usb_interface *intf,
132 return 0; 133 return 0;
133 } 134 }
134 135
136 if (flags_ret)
137 *flags_ret = flags;
138
135 return 1; 139 return 1;
136} 140}
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 6cdabdc119a7..c6109c111aab 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -887,8 +887,9 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
887 struct Scsi_Host *shost = NULL; 887 struct Scsi_Host *shost = NULL;
888 struct uas_dev_info *devinfo; 888 struct uas_dev_info *devinfo;
889 struct usb_device *udev = interface_to_usbdev(intf); 889 struct usb_device *udev = interface_to_usbdev(intf);
890 unsigned long dev_flags;
890 891
891 if (!uas_use_uas_driver(intf, id)) 892 if (!uas_use_uas_driver(intf, id, &dev_flags))
892 return -ENODEV; 893 return -ENODEV;
893 894
894 if (uas_switch_interface(udev, intf)) 895 if (uas_switch_interface(udev, intf))
@@ -910,8 +911,7 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
910 devinfo->udev = udev; 911 devinfo->udev = udev;
911 devinfo->resetting = 0; 912 devinfo->resetting = 0;
912 devinfo->shutdown = 0; 913 devinfo->shutdown = 0;
913 devinfo->flags = id->driver_info; 914 devinfo->flags = dev_flags;
914 usb_stor_adjust_quirks(udev, &devinfo->flags);
915 init_usb_anchor(&devinfo->cmd_urbs); 915 init_usb_anchor(&devinfo->cmd_urbs);
916 init_usb_anchor(&devinfo->sense_urbs); 916 init_usb_anchor(&devinfo->sense_urbs);
917 init_usb_anchor(&devinfo->data_urbs); 917 init_usb_anchor(&devinfo->data_urbs);
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 5600c33fcadb..db6f6b5ec745 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -1080,7 +1080,7 @@ static int storage_probe(struct usb_interface *intf,
1080 1080
1081 /* If uas is enabled and this device can do uas then ignore it. */ 1081 /* If uas is enabled and this device can do uas then ignore it. */
1082#if IS_ENABLED(CONFIG_USB_UAS) 1082#if IS_ENABLED(CONFIG_USB_UAS)
1083 if (uas_use_uas_driver(intf, id)) 1083 if (uas_use_uas_driver(intf, id, NULL))
1084 return -ENXIO; 1084 return -ENXIO;
1085#endif 1085#endif
1086 1086