All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9] ata: add <linux/pm_runtime.h> where missing
@ 2026-08-10 13:25 Vladimir Oltean
  2026-08-10 13:35 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Oltean @ 2026-08-10 13:25 UTC (permalink / raw)
  To: linux-ide; +Cc: linux-kernel, Damien Le Moal, Niklas Cassel

It appears that libahci.c, ahci.c as well as the ahci_brcm, ahci_ceva
and ahci_qoriq drivers are using runtime PM operations without including
<linux/pm_runtime.h>. This header is somehow being indirectly provided
by <linux/phy/phy.h>, which would like to drop it (none of the functions
it exports need it).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Damien Le Moal <dlemoal@kernel.org>
---
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Niklas Cassel <cassel@kernel.org>

v8->v9:
- none. Extracted out of previous "[PATCH v8 phy-next 00/31] Split
  Generic PHY consumer and provider API":
  https://lore.kernel.org/linux-phy/20260505100523.1922388-1-vladimir.oltean@nxp.com/
  which became unmanageably large and needs to be split per subsystem.
v2->v8:
- none
v1->v2:
- collect tag
---
 drivers/ata/ahci.c       | 1 +
 drivers/ata/ahci_brcm.c  | 1 +
 drivers/ata/ahci_ceva.c  | 1 +
 drivers/ata/ahci_qoriq.c | 1 +
 drivers/ata/libahci.c    | 1 +
 5 files changed, 5 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 58f512f8952a..d1cdbf86da78 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -26,6 +26,7 @@
 #include <linux/device.h>
 #include <linux/dmi.h>
 #include <linux/gfp.h>
+#include <linux/pm_runtime.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
index 29be74fedcf0..48460e515722 100644
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/string.h>
 
diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c
index 2961e53288f4..008869d9499b 100644
--- a/drivers/ata/ahci_ceva.c
+++ b/drivers/ata/ahci_ceva.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include "ahci.h"
 
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 96492159fa7c..fc6b8cd75b32 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -14,6 +14,7 @@
 #include <linux/device.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/libata.h>
 #include "ahci.h"
 
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 6d72eb017b49..bea9a39daced 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -30,6 +30,7 @@
 #include <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
 #include <linux/pci.h>
+#include <linux/pm_runtime.h>
 #include "ahci.h"
 #include "libata.h"
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v9] ata: add <linux/pm_runtime.h> where missing
  2026-08-10 13:25 [PATCH v9] ata: add <linux/pm_runtime.h> where missing Vladimir Oltean
@ 2026-08-10 13:35 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-08-10 13:35 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: dlemoal, cassel, linux-ide

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the sata_rcar driver uses asynchronous pm_runtime_put() immediately before pm_runtime_disable(), which can leave hardware in an incorrect power state.
--

--- Patch [1]: [PATCH v9] ata: add <linux/pm_runtime.h> where missing ---
commit a948ddb3d02a94769e1f9fcb8c82c720adc71ef2
Author: Vladimir Oltean <vladimir.oltean@nxp.com>

ata: add <linux/pm_runtime.h> where missing

This commit adds the <linux/pm_runtime.h> header to several AHCI drivers
that use runtime PM operations. Previously, this header was indirectly
provided by <linux/phy/phy.h>, which is dropping it.

> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 58f512f8952a9..d1cdbf86da78d 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c

[ ... ]

[Severity: High]
This is a pre-existing issue, but while reviewing runtime PM usage in the
ATA subsystem, I noticed a potential problem in sata_rcar.c that might cause
power resource leaks.

In sata_rcar.c, during the error path of sata_rcar_probe():

drivers/ata/sata_rcar.c:sata_rcar_probe() {
    ...
err_pm_put:
	pm_runtime_put(dev);
	pm_runtime_disable(dev);
    ...
}

And similarly during driver teardown in sata_rcar_remove():

drivers/ata/sata_rcar.c:sata_rcar_remove() {
    ...
	pm_runtime_put(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
    ...
}

Does this sequence leave the hardware in an active power state? Calling
pm_runtime_disable() immediately after pm_runtime_put() cancels any pending
asynchronous suspend work. 

Should these paths use pm_runtime_put_sync() instead to ensure the idle
check and suspension complete synchronously before PM is disabled?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260810132502.460566-1-vladimir.oltean@nxp.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-10 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 13:25 [PATCH v9] ata: add <linux/pm_runtime.h> where missing Vladimir Oltean
2026-08-10 13:35 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.