diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-01-10 13:43:40 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-08 20:36:41 -0500 |
commit | af74d2dae8f85a0e90a30594beb507f5d954fa3f (patch) | |
tree | abefa30519f9e8737eae14001337bfabdf19a44e /drivers/usb/storage | |
parent | 09b6b51b0b6c1b9bb61815baf205e4d74c89ff04 (diff) |
usb-storage: reorganize target-specific code
Now that usb-storage has a target_alloc() routine, this patch (as1508)
moves some existing target-specific code out of the slave_alloc()
routine to where it really belongs.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index dc68cc9fef5d..a324a5d21e99 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -78,8 +78,6 @@ static const char* host_info(struct Scsi_Host *host) | |||
78 | 78 | ||
79 | static int slave_alloc (struct scsi_device *sdev) | 79 | static int slave_alloc (struct scsi_device *sdev) |
80 | { | 80 | { |
81 | struct us_data *us = host_to_us(sdev->host); | ||
82 | |||
83 | /* | 81 | /* |
84 | * Set the INQUIRY transfer length to 36. We don't use any of | 82 | * Set the INQUIRY transfer length to 36. We don't use any of |
85 | * the extra data and many devices choke if asked for more or | 83 | * the extra data and many devices choke if asked for more or |
@@ -104,18 +102,6 @@ static int slave_alloc (struct scsi_device *sdev) | |||
104 | */ | 102 | */ |
105 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); | 103 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
106 | 104 | ||
107 | /* | ||
108 | * The UFI spec treates the Peripheral Qualifier bits in an | ||
109 | * INQUIRY result as reserved and requires devices to set them | ||
110 | * to 0. However the SCSI spec requires these bits to be set | ||
111 | * to 3 to indicate when a LUN is not present. | ||
112 | * | ||
113 | * Let the scanning code know if this target merely sets | ||
114 | * Peripheral Device Type to 0x1f to indicate no LUN. | ||
115 | */ | ||
116 | if (us->subclass == USB_SC_UFI) | ||
117 | sdev->sdev_target->pdt_1f_for_no_lun = 1; | ||
118 | |||
119 | return 0; | 105 | return 0; |
120 | } | 106 | } |
121 | 107 | ||
@@ -278,6 +264,8 @@ static int slave_configure(struct scsi_device *sdev) | |||
278 | 264 | ||
279 | static int target_alloc(struct scsi_target *starget) | 265 | static int target_alloc(struct scsi_target *starget) |
280 | { | 266 | { |
267 | struct us_data *us = host_to_us(dev_to_shost(starget->dev.parent)); | ||
268 | |||
281 | /* | 269 | /* |
282 | * Some USB drives don't support REPORT LUNS, even though they | 270 | * Some USB drives don't support REPORT LUNS, even though they |
283 | * report a SCSI revision level above 2. Tell the SCSI layer | 271 | * report a SCSI revision level above 2. Tell the SCSI layer |
@@ -285,6 +273,19 @@ static int target_alloc(struct scsi_target *starget) | |||
285 | * scan instead. | 273 | * scan instead. |
286 | */ | 274 | */ |
287 | starget->no_report_luns = 1; | 275 | starget->no_report_luns = 1; |
276 | |||
277 | /* | ||
278 | * The UFI spec treats the Peripheral Qualifier bits in an | ||
279 | * INQUIRY result as reserved and requires devices to set them | ||
280 | * to 0. However the SCSI spec requires these bits to be set | ||
281 | * to 3 to indicate when a LUN is not present. | ||
282 | * | ||
283 | * Let the scanning code know if this target merely sets | ||
284 | * Peripheral Device Type to 0x1f to indicate no LUN. | ||
285 | */ | ||
286 | if (us->subclass == USB_SC_UFI) | ||
287 | starget->pdt_1f_for_no_lun = 1; | ||
288 | |||
288 | return 0; | 289 | return 0; |
289 | } | 290 | } |
290 | 291 | ||