Skip to contentSkip to conversation

ata: libata-core: Do not try to set sleeping devices to standby

PATCH In review Damien Le Moal 1 participant 2 messages Jan 11, 2024 libata

lore
Share & tools
lore

Damien Le Moal

author maintainer
#0 lore raw

PATCH 1/1 ata: libata-core: Do not try to set sleeping devices to standby

In ata ata_dev_power_set_standby(), check that the target device is not sleeping. If it is, there is no need to do anything.

Fixes aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop")
---
 drivers/ata/libata-core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
index 09ed67772fae..d9f80f4f70f5 100644
@@ -2017,6 +2017,10 @@ void ata_dev_power_set_standby(struct ata_device *dev)
 	struct ata_taskfile tf;
 	unsigned int err_mask;
 
+	/* If the device is already sleeping, do nothing. */
+	if (dev->flags & ATA_DFLAG_SLEEPING)
+		return;
+
 	/*
 	 * Some odd clown BIOSes issue spindown on power off (ACPI S4 or S5)
 	 * causing some drives to spin up and down again. For these, do nothing
Signature · 1 line
2.43.0
author maintainer
#1 lore raw
Quoted 5 lines · Damien Le Moal

In ata ata_dev_power_set_standby(), check that the target device is not sleeping. If it is, there is no need to do anything.

Fixes aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop")

Forgot to add Cc: stable. Resending.

Quoted 19 lines
---
 drivers/ata/libata-core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
index 09ed67772fae..d9f80f4f70f5 100644
@@ -2017,6 +2017,10 @@ void ata_dev_power_set_standby(struct ata_device *dev)
 	struct ata_taskfile tf;
 	unsigned int err_mask;
 
+	/* If the device is already sleeping, do nothing. */
+	if (dev->flags & ATA_DFLAG_SLEEPING)
+		return;
+
 	/*
 	 * Some odd clown BIOSes issue spindown on power off (ACPI S4 or S5)
 	 * causing some drives to spin up and down again. For these, do nothing
Signature · 2 lines
Damien Le Moal
Western Digital Research