aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2014-01-30 10:43:22 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-04 15:59:15 -0500
commit823d12c95c666fa7ab7dad208d735f6bc6afabdc (patch)
treeb9b294c6078343abbbd960914820738821c770ba
parent2240c365108adbc4100a55654a5707e8e877a401 (diff)
usb-storage: enable multi-LUN scanning when needed
People sometimes create their own custom-configured kernels and forget to enable CONFIG_SCSI_MULTI_LUN. This causes problems when they plug in a USB storage device (such as a card reader) with more than one LUN. Fortunately, we can tell fairly easily when a storage device claims to have more than one LUN. When that happens, this patch asks the SCSI layer to probe all the LUNs automatically, regardless of the config setting. The patch also updates the Kconfig help text for usb-storage, explaining that CONFIG_SCSI_MULTI_LUN may be necessary. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reported-by: Thomas Raschbacher <lordvan@lordvan.com> CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net> CC: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/storage/Kconfig4
-rw-r--r--drivers/usb/storage/scsiglue.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 8470e1b114f2..1dd0604d1911 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -18,7 +18,9 @@ config USB_STORAGE
18 18
19 This option depends on 'SCSI' support being enabled, but you 19 This option depends on 'SCSI' support being enabled, but you
20 probably also need 'SCSI device support: SCSI disk support' 20 probably also need 'SCSI device support: SCSI disk support'
21 (BLK_DEV_SD) for most USB storage devices. 21 (BLK_DEV_SD) for most USB storage devices. Some devices also
22 will require 'Probe all LUNs on each SCSI device'
23 (SCSI_MULTI_LUN).
22 24
23 To compile this driver as a module, choose M here: the 25 To compile this driver as a module, choose M here: the
24 module will be called usb-storage. 26 module will be called usb-storage.
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 18509e6c21ab..9d38ddc8da49 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -78,6 +78,8 @@ static const char* host_info(struct Scsi_Host *host)
78 78
79static int slave_alloc (struct scsi_device *sdev) 79static int slave_alloc (struct scsi_device *sdev)
80{ 80{
81 struct us_data *us = host_to_us(sdev->host);
82
81 /* 83 /*
82 * Set the INQUIRY transfer length to 36. We don't use any of 84 * Set the INQUIRY transfer length to 36. We don't use any of
83 * the extra data and many devices choke if asked for more or 85 * the extra data and many devices choke if asked for more or
@@ -102,6 +104,10 @@ static int slave_alloc (struct scsi_device *sdev)
102 */ 104 */
103 blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); 105 blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1));
104 106
107 /* Tell the SCSI layer if we know there is more than one LUN */
108 if (us->protocol == USB_PR_BULK && us->max_lun > 0)
109 sdev->sdev_bflags |= BLIST_FORCELUN;
110
105 return 0; 111 return 0;
106} 112}
107 113