ata: libata-core: Do not poweroff runtime suspended ports
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 31 Aug 2023 06:23:37 +0000 (15:23 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Tue, 3 Oct 2023 00:39:49 +0000 (09:39 +0900)
When powering off, there is no need to suspend a port that has already
been runtime suspended. Skip the EH PM request in ata_port_pm_poweroff()
in this case.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ata/libata-core.c

index c249016..c9db2da 100644 (file)
@@ -5215,7 +5215,8 @@ static int ata_port_pm_freeze(struct device *dev)
 
 static int ata_port_pm_poweroff(struct device *dev)
 {
-       ata_port_suspend(to_ata_port(dev), PMSG_HIBERNATE, false);
+       if (!pm_runtime_suspended(dev))
+               ata_port_suspend(to_ata_port(dev), PMSG_HIBERNATE, false);
        return 0;
 }