Commit a12883f0 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 13d56990 6344a5cd
config SCSI_HISI_SAS config SCSI_HISI_SAS
tristate "HiSilicon SAS" tristate "HiSilicon SAS"
depends on HAS_DMA
depends on ARM64 || COMPILE_TEST
select SCSI_SAS_LIBSAS select SCSI_SAS_LIBSAS
select BLK_DEV_INTEGRITY select BLK_DEV_INTEGRITY
help help
......
...@@ -2893,7 +2893,7 @@ static int sd_revalidate_disk(struct gendisk *disk) ...@@ -2893,7 +2893,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS && sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE) sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
rw_max = q->limits.io_opt = rw_max = q->limits.io_opt =
logical_to_sectors(sdp, sdkp->opt_xfer_blocks); sdkp->opt_xfer_blocks * sdp->sector_size;
else else
rw_max = BLK_DEF_MAX_SECTORS; rw_max = BLK_DEF_MAX_SECTORS;
...@@ -3268,8 +3268,8 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) ...@@ -3268,8 +3268,8 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
struct scsi_disk *sdkp = dev_get_drvdata(dev); struct scsi_disk *sdkp = dev_get_drvdata(dev);
int ret = 0; int ret = 0;
if (!sdkp) if (!sdkp) /* E.g.: runtime suspend following sd_remove() */
return 0; /* this can happen */ return 0;
if (sdkp->WCE && sdkp->media_present) { if (sdkp->WCE && sdkp->media_present) {
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
...@@ -3308,6 +3308,9 @@ static int sd_resume(struct device *dev) ...@@ -3308,6 +3308,9 @@ static int sd_resume(struct device *dev)
{ {
struct scsi_disk *sdkp = dev_get_drvdata(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) if (!sdkp->device->manage_start_stop)
return 0; return 0;
......
...@@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev) ...@@ -144,6 +144,9 @@ static int sr_runtime_suspend(struct device *dev)
{ {
struct scsi_cd *cd = dev_get_drvdata(dev); struct scsi_cd *cd = dev_get_drvdata(dev);
if (!cd) /* E.g.: runtime suspend following sr_remove() */
return 0;
if (cd->media_present) if (cd->media_present)
return -EBUSY; return -EBUSY;
else else
...@@ -985,6 +988,7 @@ static int sr_remove(struct device *dev) ...@@ -985,6 +988,7 @@ static int sr_remove(struct device *dev)
scsi_autopm_get_device(cd->device); scsi_autopm_get_device(cd->device);
del_gendisk(cd->disk); del_gendisk(cd->disk);
dev_set_drvdata(dev, NULL);
mutex_lock(&sr_ref_mutex); mutex_lock(&sr_ref_mutex);
kref_put(&cd->kref, sr_kref_release); kref_put(&cd->kref, sr_kref_release);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment