Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"Three small fixes, one in drivers.

The core changes are to the internal representation of flags in
scsi_devices which removes space wasting bools in favour of single bit
flags and to add a flag to force a runtime resume which is used by ATA
devices"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: sd: Fix system start for ATA devices
scsi: Change SCSI device boolean fields to single bit flags
scsi: ufs: core: Clear cmd if abort succeeds in MCQ mode

+40 -9
+7 -2
drivers/ata/libata-scsi.c
··· 1055 1055 * Ask the sd driver to issue START STOP UNIT on runtime suspend 1056 1056 * and resume and shutdown only. For system level suspend/resume, 1057 1057 * devices power state is handled directly by libata EH. 1058 + * Given that disks are always spun up on system resume, also 1059 + * make sure that the sd driver forces runtime suspended disks 1060 + * to be resumed to correctly reflect the power state of the 1061 + * device. 1058 1062 */ 1059 - sdev->manage_runtime_start_stop = true; 1060 - sdev->manage_shutdown = true; 1063 + sdev->manage_runtime_start_stop = 1; 1064 + sdev->manage_shutdown = 1; 1065 + sdev->force_runtime_start_on_system_start = 1; 1061 1066 } 1062 1067 1063 1068 /*
+3 -3
drivers/firewire/sbp2.c
··· 1519 1519 sdev->use_10_for_rw = 1; 1520 1520 1521 1521 if (sbp2_param_exclusive_login) { 1522 - sdev->manage_system_start_stop = true; 1523 - sdev->manage_runtime_start_stop = true; 1524 - sdev->manage_shutdown = true; 1522 + sdev->manage_system_start_stop = 1; 1523 + sdev->manage_runtime_start_stop = 1; 1524 + sdev->manage_shutdown = 1; 1525 1525 } 1526 1526 1527 1527 if (sdev->type == TYPE_ROM)
+8 -1
drivers/scsi/sd.c
··· 3949 3949 3950 3950 static int sd_resume_system(struct device *dev) 3951 3951 { 3952 - if (pm_runtime_suspended(dev)) 3952 + if (pm_runtime_suspended(dev)) { 3953 + struct scsi_disk *sdkp = dev_get_drvdata(dev); 3954 + struct scsi_device *sdp = sdkp ? sdkp->device : NULL; 3955 + 3956 + if (sdp && sdp->force_runtime_start_on_system_start) 3957 + pm_request_resume(dev); 3958 + 3953 3959 return 0; 3960 + } 3954 3961 3955 3962 return sd_resume(dev, false); 3956 3963 }
+13
drivers/ufs/core/ufshcd.c
··· 6444 6444 struct scsi_device *sdev = cmd->device; 6445 6445 struct Scsi_Host *shost = sdev->host; 6446 6446 struct ufs_hba *hba = shost_priv(shost); 6447 + struct ufshcd_lrb *lrbp = &hba->lrb[tag]; 6448 + struct ufs_hw_queue *hwq; 6449 + unsigned long flags; 6447 6450 6448 6451 *ret = ufshcd_try_to_abort_task(hba, tag); 6449 6452 dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag, 6450 6453 hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1, 6451 6454 *ret ? "failed" : "succeeded"); 6455 + 6456 + /* Release cmd in MCQ mode if abort succeeds */ 6457 + if (is_mcq_enabled(hba) && (*ret == 0)) { 6458 + hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd)); 6459 + spin_lock_irqsave(&hwq->cq_lock, flags); 6460 + if (ufshcd_cmd_inflight(lrbp->cmd)) 6461 + ufshcd_release_scsi_cmd(hba, lrbp); 6462 + spin_unlock_irqrestore(&hwq->cq_lock, flags); 6463 + } 6464 + 6452 6465 return *ret == 0; 6453 6466 } 6454 6467
+9 -3
include/scsi/scsi_device.h
··· 167 167 * power state for system suspend/resume (suspend to RAM and 168 168 * hibernation) operations. 169 169 */ 170 - bool manage_system_start_stop; 170 + unsigned manage_system_start_stop:1; 171 171 172 172 /* 173 173 * If true, let the high-level device driver (sd) manage the device 174 174 * power state for runtime device suspand and resume operations. 175 175 */ 176 - bool manage_runtime_start_stop; 176 + unsigned manage_runtime_start_stop:1; 177 177 178 178 /* 179 179 * If true, let the high-level device driver (sd) manage the device 180 180 * power state for system shutdown (power off) operations. 181 181 */ 182 - bool manage_shutdown; 182 + unsigned manage_shutdown:1; 183 + 184 + /* 185 + * If set and if the device is runtime suspended, ask the high-level 186 + * device driver (sd) to force a runtime resume of the device. 187 + */ 188 + unsigned force_runtime_start_on_system_start:1; 183 189 184 190 unsigned removable:1; 185 191 unsigned changed:1; /* Data invalid due to media change */