diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-04-21 05:20:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-04-28 06:48:57 -0400 |
commit | ee136af4a064c2f61e2025873584d2c7ec93f4ae (patch) | |
tree | 5021e9e7d52d817f39695546f81509e929cf6ced /drivers/usb | |
parent | a5011d44f0e1117a6db14b19b57c51f8be5673a0 (diff) |
uas: Add US_FL_MAX_SECTORS_240 flag
The usb-storage driver sets max_sectors = 240 in its scsi-host template,
for uas we do not want to do that for all devices, but testing has shown
that some devices need it.
This commit adds a US_FL_MAX_SECTORS_240 flag for such devices, and
implements support for it in uas.c, while at it it also adds support
for US_FL_MAX_SECTORS_64 to uas.c.
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.c | 10 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index c6109c111aab..6d3122afeed3 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -759,7 +759,10 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
759 | 759 | ||
760 | static int uas_slave_alloc(struct scsi_device *sdev) | 760 | static int uas_slave_alloc(struct scsi_device *sdev) |
761 | { | 761 | { |
762 | sdev->hostdata = (void *)sdev->host->hostdata; | 762 | struct uas_dev_info *devinfo = |
763 | (struct uas_dev_info *)sdev->host->hostdata; | ||
764 | |||
765 | sdev->hostdata = devinfo; | ||
763 | 766 | ||
764 | /* USB has unusual DMA-alignment requirements: Although the | 767 | /* USB has unusual DMA-alignment requirements: Although the |
765 | * starting address of each scatter-gather element doesn't matter, | 768 | * starting address of each scatter-gather element doesn't matter, |
@@ -778,6 +781,11 @@ static int uas_slave_alloc(struct scsi_device *sdev) | |||
778 | */ | 781 | */ |
779 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); | 782 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
780 | 783 | ||
784 | if (devinfo->flags & US_FL_MAX_SECTORS_64) | ||
785 | blk_queue_max_hw_sectors(sdev->request_queue, 64); | ||
786 | else if (devinfo->flags & US_FL_MAX_SECTORS_240) | ||
787 | blk_queue_max_hw_sectors(sdev->request_queue, 240); | ||
788 | |||
781 | return 0; | 789 | return 0; |
782 | } | 790 | } |
783 | 791 | ||
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index db6f6b5ec745..6c10c888f35f 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -479,7 +479,8 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
479 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | | 479 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | |
480 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | | 480 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
481 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | | 481 | US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | |
482 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES); | 482 | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | |
483 | US_FL_MAX_SECTORS_240); | ||
483 | 484 | ||
484 | p = quirks; | 485 | p = quirks; |
485 | while (*p) { | 486 | while (*p) { |
@@ -520,6 +521,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) | |||
520 | case 'f': | 521 | case 'f': |
521 | f |= US_FL_NO_REPORT_OPCODES; | 522 | f |= US_FL_NO_REPORT_OPCODES; |
522 | break; | 523 | break; |
524 | case 'g': | ||
525 | f |= US_FL_MAX_SECTORS_240; | ||
526 | break; | ||
523 | case 'h': | 527 | case 'h': |
524 | f |= US_FL_CAPACITY_HEURISTICS; | 528 | f |= US_FL_CAPACITY_HEURISTICS; |
525 | break; | 529 | break; |