From 3a94af2488bfe7dfe70fd9277d4548f971b06ec8 Mon Sep 17 00:00:00 2001 From: Damien Le Moal Date: Thu, 31 Aug 2023 15:23:37 +0900 Subject: [PATCH] ata: libata-core: Do not poweroff runtime suspended ports 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 Reviewed-by: Hannes Reinecke Tested-by: Chia-Lin Kao (AceLan) Tested-by: Geert Uytterhoeven Reviewed-by: Martin K. Petersen --- drivers/ata/libata-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c249016a59985..c9db2da582b70 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -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; } -- 2.39.2