summaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2016-03-04 11:32:40 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-03-04 11:32:40 -0800
commit52cdce8adb635746f53306ab2599ca64902bb1dc (patch)
tree0b61680c30eb150796cf01186f15b4845cdee6dd /drivers/scsi/sd.c
parent3cd47869431d7402d0613cf0f7fbb392f2b97565 (diff)
parent7dde4e74744772efdc85d7ed13495c7b6a0d881b (diff)
Merge branch 'rotary-encoder' into next
Bring in updates to roraty encoder driver switching it away from legacy platform data and over to generic device properties and adding support for encoders using more than 2 GPIOs.
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3d22fc3e3c1a..4e08d1cd704d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)
/*
* Use the device's preferred I/O size for reads and writes
- * unless the reported value is unreasonably large (or garbage).
+ * unless the reported value is unreasonably small, large, or
+ * garbage.
*/
- if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
- sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
+ if (sdkp->opt_xfer_blocks &&
+ sdkp->opt_xfer_blocks <= dev_max &&
+ sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
+ sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
rw_max = q->limits.io_opt =
logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
else