diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-30 00:14:45 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-30 00:14:45 +0300 |
commit | a12883f0af7a4ccc74381395fab5912784183efe (patch) | |
tree | 0a7cb3cec4d42260f35ec4fa62d2c5b0ba5e9bdb /drivers | |
parent | 13d569900792fdc3a46dda48d1d2bf46febdc0bc (diff) | |
parent | 6344a5cd3e8acf6e9823046cebd00b16faacdb1a (diff) | |
download | linux-a12883f0af7a4ccc74381395fab5912784183efe.tar.xz |
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley:
"Four fixes: one to try to fix our repeated intermittent crashes in
suspend/resume, one to correct a regression in the optimal I/O size
reporting and a couple for randconfig build failures in the hisi_sas
driver"
* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
SCSI: fix crashes in sd and sr runtime PM
sd: Optimal I/O size is in bytes, not sectors
hisi_sas: Restrict SCSI_HISI_SAS to arm64
hisi_sas: SCSI_HISI_SAS should depend on HAS_DMA
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/hisi_sas/Kconfig | 2 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 9 | ||||
-rw-r--r-- | drivers/scsi/sr.c | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig index 37a0c7156087..b67661836c9f 100644 --- a/drivers/scsi/hisi_sas/Kconfig +++ b/drivers/scsi/hisi_sas/Kconfig @@ -1,5 +1,7 @@ config SCSI_HISI_SAS tristate "HiSilicon SAS" + depends on HAS_DMA + depends on ARM64 || COMPILE_TEST select SCSI_SAS_LIBSAS select BLK_DEV_INTEGRITY help diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 4e08d1cd704d..bb669d32ccd0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2893,7 +2893,7 @@ static int sd_revalidate_disk(struct gendisk *disk) 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); + sdkp->opt_xfer_blocks * sdp->sector_size; else rw_max = BLK_DEF_MAX_SECTORS; @@ -3268,8 +3268,8 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) struct scsi_disk *sdkp = dev_get_drvdata(dev); int ret = 0; - if (!sdkp) - return 0; /* this can happen */ + if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ + return 0; if (sdkp->WCE && sdkp->media_present) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); @@ -3308,6 +3308,9 @@ static int sd_resume(struct device *dev) { struct scsi_disk *sdkp = dev_get_drvdata(dev); + if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ + return 0; + if (!sdkp->device->manage_start_stop) return 0; diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 8bd54a64efd6..64c867405ad4 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev) { struct scsi_cd *cd = dev_get_drvdata(dev); + if (!cd) /* E.g.: runtime suspend following sr_remove() */ + return 0; + if (cd->media_present) return -EBUSY; else @@ -985,6 +988,7 @@ static int sr_remove(struct device *dev) scsi_autopm_get_device(cd->device); del_gendisk(cd->disk); + dev_set_drvdata(dev, NULL); mutex_lock(&sr_ref_mutex); kref_put(&cd->kref, sr_kref_release); |