Re: [PATCH v6 12/23] scsi: Remove scsi device no_start_on_resume flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/22/23 17:29, Damien Le Moal wrote:
The scsi device flag no_start_on_resume is not set by any scsi low
level driver. Remove it. This reverts the changes introduced by commit
0a8589055936 ("ata,scsi: do not issue START STOP UNIT on resume").

Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@xxxxxxxxxxxxx>
Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
---
  drivers/scsi/sd.c          | 13 ++++---------
  include/scsi/scsi_device.h |  1 -
  2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bff8663be7e0..e372834bf56f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3900,20 +3900,15 @@ static int sd_resume(struct device *dev, bool runtime)
  	if (!sdkp)	/* E.g.: runtime resume at the start of sd_probe() */
  		return 0;
- if (!sd_do_start_stop(sdkp->device, runtime)) {
-		sdkp->suspended = 0;
-		return 0;
-	}
-
-	if (!sdkp->device->no_start_on_resume) {
+	if (sd_do_start_stop(sdkp->device, runtime)) {
  		sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
  		ret = sd_start_stop_device(sdkp, 1);
+		if (!ret)
+			opal_unlock_from_suspend(sdkp->opal_dev);
  	}
- if (!ret) {
-		opal_unlock_from_suspend(sdkp->opal_dev);
+	if (!ret)
  		sdkp->suspended = 0;
-	}
return ret;
  }

I'm fine with removing the no_start_on_resume member but it seems to me
that the above patch makes sd_resume() harder to read. I like the
original approach (early return if sd_do_start_stop() returns false)
better than the new approach (set ret inside an if-statement and clear
sdkp->suspended after the sd_start_stop_device() call if ret == 0).

In case others prefer the new flow: shouldn't that new flow have been
introduced in patch 4/23 of this series instead of in this patch?

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux