All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/14] AHCI power management cleanup
@ 2025-01-27 12:45 Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 01/14] ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
                   ` (14 more replies)
  0 siblings, 15 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:45 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Several AHCI drivers expose suspend/resume functions in a way that can
be simplified.  Using pre-processor operation can lead to errors, while
relying on automatic kernel configuration is safer.  It also shrinks the
kernel size when CONFIG_PM_SLEEP is not used[1].

This has been compile-tested on x86, arm and arm64.

[1] https://lore.kernel.org/lkml/261f9fac-82de-4f39-bf5c-cdfcee917588@gmail.com/

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
Raphael Gallais-Pou (14):
      ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: ceva: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: da850: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: dm816: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: imx: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: mtk: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: platform: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: qoriq: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: seattle: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: sunxi: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: pata_imx: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: sata_highbank: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      ahci: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

 drivers/ata/ahci_brcm.c      | 6 +++---
 drivers/ata/ahci_ceva.c      | 8 ++++----
 drivers/ata/ahci_da850.c     | 7 ++++---
 drivers/ata/ahci_dm816.c     | 8 ++++----
 drivers/ata/ahci_imx.c       | 6 ++----
 drivers/ata/ahci_mtk.c       | 7 ++++---
 drivers/ata/ahci_platform.c  | 7 ++++---
 drivers/ata/ahci_qoriq.c     | 9 ++++-----
 drivers/ata/ahci_seattle.c   | 7 ++++---
 drivers/ata/ahci_sunxi.c     | 9 ++++-----
 drivers/ata/pata_arasan_cf.c | 6 ++----
 drivers/ata/pata_imx.c       | 6 ++----
 drivers/ata/sata_highbank.c  | 9 ++++-----
 drivers/ata/sata_rcar.c      | 6 +-----
 14 files changed, 46 insertions(+), 55 deletions(-)
---
base-commit: 5ffa57f6eecefababb8cbe327222ef171943b183
change-id: 20250113-pm_ata-dbc07b3b0df3

Best regards,
-- 
Raphael Gallais-Pou <rgallaispou@gmail.com>


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

* [PATCH RFC 01/14] ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
@ 2025-01-27 12:45 ` Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 02/14] ahci: ceva: " Raphael Gallais-Pou
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:45 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_brcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
index 29be74fedcf01934e436481c66cb8d329284d599..3d43ed5db6078b3f07440f21aae6edf73d1da7f2 100644
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
@@ -362,7 +362,7 @@ static int brcm_ahci_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused brcm_ahci_resume(struct device *dev)
+static int brcm_ahci_resume(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
@@ -570,7 +570,7 @@ static void brcm_ahci_shutdown(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to shutdown\n");
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
 
 static struct platform_driver brcm_ahci_driver = {
 	.probe = brcm_ahci_probe,
@@ -579,7 +579,7 @@ static struct platform_driver brcm_ahci_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_of_match,
-		.pm = &ahci_brcm_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_brcm_pm_ops),
 	},
 };
 module_platform_driver(brcm_ahci_driver);

-- 
2.48.0


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

* [PATCH RFC 02/14] ahci: ceva: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 01/14] ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
@ 2025-01-27 12:45 ` Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 03/14] ahci: da850: " Raphael Gallais-Pou
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:45 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_ceva.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c
index 2d6a08c23d6ad5d1d11a7de7fbe2968201d6095a..76e55f1f7db1f8349d696e92d8964af609532186 100644
--- a/drivers/ata/ahci_ceva.c
+++ b/drivers/ata/ahci_ceva.c
@@ -363,12 +363,12 @@ static int ceva_ahci_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int __maybe_unused ceva_ahci_suspend(struct device *dev)
+static int ceva_ahci_suspend(struct device *dev)
 {
 	return ahci_platform_suspend(dev);
 }
 
-static int __maybe_unused ceva_ahci_resume(struct device *dev)
+static int ceva_ahci_resume(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
@@ -398,7 +398,7 @@ static int __maybe_unused ceva_ahci_resume(struct device *dev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_ceva_pm_ops, ceva_ahci_suspend, ceva_ahci_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_ceva_pm_ops, ceva_ahci_suspend, ceva_ahci_resume);
 
 static const struct of_device_id ceva_ahci_of_match[] = {
 	{ .compatible = "ceva,ahci-1v84" },
@@ -412,7 +412,7 @@ static struct platform_driver ceva_ahci_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ceva_ahci_of_match,
-		.pm = &ahci_ceva_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_ceva_pm_ops),
 	},
 };
 module_platform_driver(ceva_ahci_driver);

-- 
2.48.0


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

* [PATCH RFC 03/14] ahci: da850: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 01/14] ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 02/14] ahci: ceva: " Raphael Gallais-Pou
@ 2025-01-27 12:45 ` Raphael Gallais-Pou
  2025-01-27 12:45 ` [PATCH RFC 04/14] ahci: dm816: " Raphael Gallais-Pou
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:45 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_da850.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index ca0924dc5bd26ba424b26bd040bf83720c96b56f..698b0c30de0d65423f932ab3c3d95787b692cb37 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -227,8 +227,9 @@ static int ahci_da850_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops,
+				ahci_platform_suspend,
+				ahci_platform_resume);
 
 static const struct of_device_id ahci_da850_of_match[] = {
 	{ .compatible = "ti,da850-ahci", },
@@ -242,7 +243,7 @@ static struct platform_driver ahci_da850_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_da850_of_match,
-		.pm = &ahci_da850_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_da850_pm_ops),
 	},
 };
 module_platform_driver(ahci_da850_driver);

-- 
2.48.0


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

* [PATCH RFC 04/14] ahci: dm816: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (2 preceding siblings ...)
  2025-01-27 12:45 ` [PATCH RFC 03/14] ahci: da850: " Raphael Gallais-Pou
@ 2025-01-27 12:45 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 05/14] ahci: imx: " Raphael Gallais-Pou
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:45 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_dm816.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci_dm816.c b/drivers/ata/ahci_dm816.c
index b08547b877a1f77ba220e925de321ed034147d7b..cb30a55945b8bdb1efefab192575864220215d08 100644
--- a/drivers/ata/ahci_dm816.c
+++ b/drivers/ata/ahci_dm816.c
@@ -170,9 +170,9 @@ static int ahci_dm816_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_dm816_pm_ops,
-			 ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_dm816_pm_ops,
+				ahci_platform_suspend,
+				ahci_platform_resume);
 
 static const struct of_device_id ahci_dm816_of_match[] = {
 	{ .compatible = "ti,dm816-ahci", },
@@ -186,7 +186,7 @@ static struct platform_driver ahci_dm816_driver = {
 	.driver = {
 		.name = AHCI_DM816_DRV_NAME,
 		.of_match_table = ahci_dm816_of_match,
-		.pm = &ahci_dm816_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_dm816_pm_ops),
 	},
 };
 module_platform_driver(ahci_dm816_driver);

-- 
2.48.0


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

* [PATCH RFC 05/14] ahci: imx: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (3 preceding siblings ...)
  2025-01-27 12:45 ` [PATCH RFC 04/14] ahci: dm816: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 15:13   ` Frank Li
  2025-01-27 12:46 ` [PATCH RFC 06/14] ahci: mtk: " Raphael Gallais-Pou
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_imx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index f01f08048f97aa230877e413ba6e416d79779c1b..ec75a16c630a79ce10ea98b16c44c9a3908f869f 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -993,7 +993,6 @@ static void ahci_imx_host_stop(struct ata_host *host)
 	clk_disable_unprepare(imxpriv->sata_clk);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int imx_ahci_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -1021,9 +1020,8 @@ static int imx_ahci_resume(struct device *dev)
 
 	return ahci_platform_resume_host(dev);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
 
 static struct platform_driver imx_ahci_driver = {
 	.probe = imx_ahci_probe,
@@ -1031,7 +1029,7 @@ static struct platform_driver imx_ahci_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = imx_ahci_of_match,
-		.pm = &ahci_imx_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_imx_pm_ops),
 	},
 };
 module_platform_driver(imx_ahci_driver);

-- 
2.48.0


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

* [PATCH RFC 06/14] ahci: mtk: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (4 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 05/14] ahci: imx: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 07/14] ahci: platform: " Raphael Gallais-Pou
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_mtk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c
index 7295b9066ae213a72a8c180a66ecfac8c2f46ff9..4afcf5e90e3b660f17b2eb0b1e3df446bef470da 100644
--- a/drivers/ata/ahci_mtk.c
+++ b/drivers/ata/ahci_mtk.c
@@ -163,8 +163,9 @@ static int mtk_ahci_probe(struct platform_device *pdev)
 	return err;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_pm_ops,
+				ahci_platform_suspend,
+				ahci_platform_resume);
 
 static const struct of_device_id ahci_of_match[] = {
 	{ .compatible = "mediatek,mtk-ahci", },
@@ -178,7 +179,7 @@ static struct platform_driver mtk_ahci_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_of_match,
-		.pm = &ahci_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_pm_ops),
 	},
 };
 module_platform_driver(mtk_ahci_driver);

-- 
2.48.0


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

* [PATCH RFC 07/14] ahci: platform: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (5 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 06/14] ahci: mtk: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 08/14] ahci: qoriq: " Raphael Gallais-Pou
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_platform.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index c18054333f7c968cc4e131545fc3127f03ac27e4..cd5d89c1902fab6c936aa04eefb461c968726185 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -74,8 +74,9 @@ static int ahci_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_pm_ops,
+				ahci_platform_suspend,
+				ahci_platform_resume);
 
 static const struct of_device_id ahci_of_match[] = {
 	{ .compatible = "generic-ahci", },
@@ -102,7 +103,7 @@ static struct platform_driver ahci_driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_of_match,
 		.acpi_match_table = ahci_acpi_match,
-		.pm = &ahci_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_pm_ops),
 	},
 };
 module_platform_driver(ahci_driver);

-- 
2.48.0


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

* [PATCH RFC 08/14] ahci: qoriq: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (6 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 07/14] ahci: platform: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 09/14] ahci: seattle: " Raphael Gallais-Pou
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_qoriq.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 30e39885b64edf9cbb1eeca853659582f5296361..5f64bb8cd2e9c8d34403f76e5789fa435dce94ca 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -319,7 +319,6 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
 	return rc;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ahci_qoriq_resume(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -350,10 +349,10 @@ static int ahci_qoriq_resume(struct device *dev)
 
 	return rc;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ahci_qoriq_pm_ops, ahci_platform_suspend,
-			 ahci_qoriq_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_qoriq_pm_ops,
+				ahci_platform_suspend,
+				ahci_qoriq_resume);
 
 static struct platform_driver ahci_qoriq_driver = {
 	.probe = ahci_qoriq_probe,
@@ -362,7 +361,7 @@ static struct platform_driver ahci_qoriq_driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_qoriq_of_match,
 		.acpi_match_table = ahci_qoriq_acpi_match,
-		.pm = &ahci_qoriq_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_qoriq_pm_ops),
 	},
 };
 module_platform_driver(ahci_qoriq_driver);

-- 
2.48.0


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

* [PATCH RFC 09/14] ahci: seattle: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (7 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 08/14] ahci: qoriq: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 10/14] ahci: sunxi: " Raphael Gallais-Pou
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_seattle.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
index 3f16c167840222e0de935f7fe44b3d83b95bc16c..4b67f3aa5787de433c8bcc1bb4965a887709aa9c 100644
--- a/drivers/ata/ahci_seattle.c
+++ b/drivers/ata/ahci_seattle.c
@@ -174,8 +174,9 @@ static int ahci_seattle_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
-			 ahci_platform_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_pm_ops,
+				ahci_platform_suspend,
+				ahci_platform_resume);
 
 static const struct acpi_device_id ahci_acpi_match[] = {
 	{ "AMDI0600", 0 },
@@ -189,7 +190,7 @@ static struct platform_driver ahci_seattle_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.acpi_match_table = ahci_acpi_match,
-		.pm = &ahci_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_pm_ops),
 	},
 };
 module_platform_driver(ahci_seattle_driver);

-- 
2.48.0


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

* [PATCH RFC 10/14] ahci: sunxi: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (8 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 09/14] ahci: seattle: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-29 18:43   ` Jernej Škrabec
  2025-01-27 12:46 ` [PATCH RFC 11/14] ahci: pata_arasan_cf: " Raphael Gallais-Pou
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/ahci_sunxi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c
index 5d4584570ae013a4e44ca69557cc2c5aa61d32b1..2e86d4c97b822b6a52513dbe55e21851a58385d9 100644
--- a/drivers/ata/ahci_sunxi.c
+++ b/drivers/ata/ahci_sunxi.c
@@ -253,7 +253,6 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
 	return rc;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ahci_sunxi_resume(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -278,10 +277,10 @@ static int ahci_sunxi_resume(struct device *dev)
 	ahci_platform_disable_resources(hpriv);
 	return rc;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ahci_sunxi_pm_ops, ahci_platform_suspend,
-			 ahci_sunxi_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_sunxi_pm_ops,
+				ahci_platform_suspend,
+				ahci_sunxi_resume);
 
 static const struct of_device_id ahci_sunxi_of_match[] = {
 	{ .compatible = "allwinner,sun4i-a10-ahci", },
@@ -296,7 +295,7 @@ static struct platform_driver ahci_sunxi_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_sunxi_of_match,
-		.pm = &ahci_sunxi_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_sunxi_pm_ops),
 	},
 };
 module_platform_driver(ahci_sunxi_driver);

-- 
2.48.0


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

* [PATCH RFC 11/14] ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (9 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 10/14] ahci: sunxi: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 22:19   ` kernel test robot
  2025-01-27 23:20   ` kernel test robot
  2025-01-27 12:46 ` [PATCH RFC 12/14] ahci: pata_imx: " Raphael Gallais-Pou
                   ` (3 subsequent siblings)
  14 siblings, 2 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/pata_arasan_cf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 514d549286b56eabe07dfc2b3a961ef0f7c983f2..3ec03147a8fbe30e9f82c184d7a9c32cabcfdb92 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -926,7 +926,6 @@ static void arasan_cf_remove(struct platform_device *pdev)
 	cf_exit(acdev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int arasan_cf_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -950,9 +949,8 @@ static int arasan_cf_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume);
 
 #ifdef CONFIG_OF
 static const struct of_device_id arasan_cf_id_table[] = {
@@ -967,7 +965,7 @@ static struct platform_driver arasan_cf_driver = {
 	.remove		= arasan_cf_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
-		.pm	= &arasan_cf_pm_ops,
+		.pm	= pm_sleep_ptr(&arasan_cf_pm_ops),
 		.of_match_table = of_match_ptr(arasan_cf_id_table),
 	},
 };

-- 
2.48.0


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

* [PATCH RFC 12/14] ahci: pata_imx: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (10 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 11/14] ahci: pata_arasan_cf: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 12:46 ` [PATCH RFC 13/14] ahci: sata_highbank: " Raphael Gallais-Pou
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/pata_imx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index b37682b0578f48ea9d51a103d19e40fe91c4729f..533de2782c37fb21bba4e4b8361c48c0f2878175 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -201,7 +201,6 @@ static void pata_imx_remove(struct platform_device *pdev)
 	__raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int pata_imx_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -234,9 +233,8 @@ static int pata_imx_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(pata_imx_pm_ops, pata_imx_suspend, pata_imx_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pata_imx_pm_ops, pata_imx_suspend, pata_imx_resume);
 
 static const struct of_device_id imx_pata_dt_ids[] = {
 	{
@@ -253,7 +251,7 @@ static struct platform_driver pata_imx_driver = {
 	.driver = {
 		.name		= DRV_NAME,
 		.of_match_table	= imx_pata_dt_ids,
-		.pm		= &pata_imx_pm_ops,
+		.pm		= pm_sleep_ptr(&pata_imx_pm_ops),
 	},
 };
 

-- 
2.48.0


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

* [PATCH RFC 13/14] ahci: sata_highbank: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (11 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 12/14] ahci: pata_imx: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 15:30   ` kernel test robot
  2025-01-27 12:46 ` [PATCH RFC 14/14] ahci: sata_rcar: " Raphael Gallais-Pou
  2025-01-27 16:30 ` [RFC PATCH 00/14] AHCI power management cleanup Geert Uytterhoeven
  14 siblings, 1 reply; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/sata_highbank.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index c8c817c51230a74df721016eb80238c188d96d01..c387e50485b974fa2f2defc0bd1ea8cd43dc14bb 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -565,7 +565,6 @@ static int ahci_highbank_probe(struct platform_device *pdev)
 	return rc;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ahci_highbank_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -609,17 +608,17 @@ static int ahci_highbank_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops,
-		  ahci_highbank_suspend, ahci_highbank_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops,
+				ahci_highbank_suspend,
+				ahci_highbank_resume);
 
 static struct platform_driver ahci_highbank_driver = {
 	.remove = ata_platform_remove_one,
 	.driver = {
 		.name = "highbank-ahci",
 		.of_match_table = ahci_of_match,
-		.pm = &ahci_highbank_pm_ops,
+		.pm = pm_sleep_ptr(&ahci_highbank_pm_ops),
 	},
 	.probe = ahci_highbank_probe,
 };

-- 
2.48.0


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

* [PATCH RFC 14/14] ahci: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (12 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 13/14] ahci: sata_highbank: " Raphael Gallais-Pou
@ 2025-01-27 12:46 ` Raphael Gallais-Pou
  2025-01-27 13:45   ` Geert Uytterhoeven
  2025-01-27 16:30 ` [RFC PATCH 00/14] AHCI power management cleanup Geert Uytterhoeven
  14 siblings, 1 reply; 23+ messages in thread
From: Raphael Gallais-Pou @ 2025-01-27 12:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/ata/sata_rcar.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 22820a02d7408033d698a98373e1e8e7ef47f908..4c5f5938c12efc7c8594df4092915011e83f910d 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sata_rcar_suspend(struct device *dev)
 {
 	struct ata_host *host = dev_get_drvdata(dev);
@@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 	.poweroff	= sata_rcar_suspend,
 	.restore	= sata_rcar_restore,
 };
-#endif
 
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
@@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = {
 	.driver = {
 		.name		= DRV_NAME,
 		.of_match_table	= sata_rcar_match,
-#ifdef CONFIG_PM_SLEEP
-		.pm		= &sata_rcar_pm_ops,
-#endif
+		.pm		= pm_sleep_ptr(&sata_rcar_pm_ops),
 	},
 };
 

-- 
2.48.0


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

* Re: [PATCH RFC 14/14] ahci: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 14/14] ahci: sata_rcar: " Raphael Gallais-Pou
@ 2025-01-27 13:45   ` Geert Uytterhoeven
  2025-01-30  2:30     ` Damien Le Moal
  0 siblings, 1 reply; 23+ messages in thread
From: Geert Uytterhoeven @ 2025-01-27 13:45 UTC (permalink / raw)
  To: Raphael Gallais-Pou
  Cc: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven, linux-ide, linux-kernel, imx,
	linux-arm-kernel, linux-mediatek, linux-sunxi, linux-renesas-soc

Hi Raphael,

On Mon, 27 Jan 2025 at 13:46, Raphael Gallais-Pou <rgallaispou@gmail.com> wrote:
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based kernel configuration guards.
>
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>

Thanks for your patch!

The subsystem prefix is "ata", not "ahci" (not all ATA-drivers are
AHCI-drivers).

> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev)
>         pm_runtime_disable(&pdev->dev);
>  }
>
> -#ifdef CONFIG_PM_SLEEP
>  static int sata_rcar_suspend(struct device *dev)
>  {
>         struct ata_host *host = dev_get_drvdata(dev);
> @@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>         .poweroff       = sata_rcar_suspend,
>         .restore        = sata_rcar_restore,
>  };
> -#endif

If CONFIG_PM_SLEEP is disabled (e.g. m68k allyesconfig):

    drivers/ata/sata_rcar.c: In function ‘sata_rcar_suspend’:
    drivers/ata/sata_rcar.c:936:9: error: implicit declaration of
function ‘ata_host_suspend’; did you mean ‘sata_rcar_suspend’?
[-Werror=implicit-function-declaration]
      936 |         ata_host_suspend(host, PMSG_SUSPEND);
          |         ^~~~~~~~~~~~~~~~
          |         sata_rcar_suspend
    drivers/ata/sata_rcar.c: In function ‘sata_rcar_resume’:
    drivers/ata/sata_rcar.c:973:9: error: implicit declaration of
function ‘ata_host_resume’; did you mean ‘sata_rcar_resume’?
[-Werror=implicit-function-declaration]
      973 |         ata_host_resume(host);
          |         ^~~~~~~~~~~~~~~
          |         sata_rcar_resume

>
>  static struct platform_driver sata_rcar_driver = {
>         .probe          = sata_rcar_probe,
> @@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = {
>         .driver = {
>                 .name           = DRV_NAME,
>                 .of_match_table = sata_rcar_match,
> -#ifdef CONFIG_PM_SLEEP
> -               .pm             = &sata_rcar_pm_ops,
> -#endif
> +               .pm             = pm_sleep_ptr(&sata_rcar_pm_ops),
>         },
>  };

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH RFC 05/14] ahci: imx: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 05/14] ahci: imx: " Raphael Gallais-Pou
@ 2025-01-27 15:13   ` Frank Li
  0 siblings, 0 replies; 23+ messages in thread
From: Frank Li @ 2025-01-27 15:13 UTC (permalink / raw)
  To: Raphael Gallais-Pou
  Cc: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven, linux-ide, linux-kernel, imx,
	linux-arm-kernel, linux-mediatek, linux-sunxi, linux-renesas-soc

On Mon, Jan 27, 2025 at 01:46:00PM +0100, Raphael Gallais-Pou wrote:
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based kernel configuration guards.
>
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/ata/ahci_imx.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
> index f01f08048f97aa230877e413ba6e416d79779c1b..ec75a16c630a79ce10ea98b16c44c9a3908f869f 100644
> --- a/drivers/ata/ahci_imx.c
> +++ b/drivers/ata/ahci_imx.c
> @@ -993,7 +993,6 @@ static void ahci_imx_host_stop(struct ata_host *host)
>  	clk_disable_unprepare(imxpriv->sata_clk);
>  }
>
> -#ifdef CONFIG_PM_SLEEP
>  static int imx_ahci_suspend(struct device *dev)
>  {
>  	struct ata_host *host = dev_get_drvdata(dev);
> @@ -1021,9 +1020,8 @@ static int imx_ahci_resume(struct device *dev)
>
>  	return ahci_platform_resume_host(dev);
>  }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
>
>  static struct platform_driver imx_ahci_driver = {
>  	.probe = imx_ahci_probe,
> @@ -1031,7 +1029,7 @@ static struct platform_driver imx_ahci_driver = {
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = imx_ahci_of_match,
> -		.pm = &ahci_imx_pm_ops,
> +		.pm = pm_sleep_ptr(&ahci_imx_pm_ops),
>  	},
>  };
>  module_platform_driver(imx_ahci_driver);
>
> --
> 2.48.0
>

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

* Re: [PATCH RFC 13/14] ahci: sata_highbank: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 13/14] ahci: sata_highbank: " Raphael Gallais-Pou
@ 2025-01-27 15:30   ` kernel test robot
  0 siblings, 0 replies; 23+ messages in thread
From: kernel test robot @ 2025-01-27 15:30 UTC (permalink / raw)
  To: Raphael Gallais-Pou; +Cc: oe-kbuild-all

Hi Raphael,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on 5ffa57f6eecefababb8cbe327222ef171943b183]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/ahci-brcm-Switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20250127-205128
base:   5ffa57f6eecefababb8cbe327222ef171943b183
patch link:    https://lore.kernel.org/r/20250127-pm_ata-v1-13-f8f50c821a2a%40gmail.com
patch subject: [PATCH RFC 13/14] ahci: sata_highbank: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
config: csky-randconfig-002-20250127 (https://download.01.org/0day-ci/archive/20250127/202501272311.wwRTRF7F-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250127/202501272311.wwRTRF7F-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501272311.wwRTRF7F-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/ata/sata_highbank.c: In function 'ahci_highbank_suspend':
>> drivers/ata/sata_highbank.c:590:9: error: implicit declaration of function 'ata_host_suspend'; did you mean 'ata_sas_port_suspend'? [-Wimplicit-function-declaration]
     590 |         ata_host_suspend(host, PMSG_SUSPEND);
         |         ^~~~~~~~~~~~~~~~
         |         ata_sas_port_suspend
   drivers/ata/sata_highbank.c: In function 'ahci_highbank_resume':
>> drivers/ata/sata_highbank.c:607:9: error: implicit declaration of function 'ata_host_resume'; did you mean 'ahci_port_resume'? [-Wimplicit-function-declaration]
     607 |         ata_host_resume(host);
         |         ^~~~~~~~~~~~~~~
         |         ahci_port_resume


vim +590 drivers/ata/sata_highbank.c

8996b89d6bc98ae Mark Langsdorf  2012-09-06  567  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  568  static int ahci_highbank_suspend(struct device *dev)
8996b89d6bc98ae Mark Langsdorf  2012-09-06  569  {
8996b89d6bc98ae Mark Langsdorf  2012-09-06  570  	struct ata_host *host = dev_get_drvdata(dev);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  571  	struct ahci_host_priv *hpriv = host->private_data;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  572  	void __iomem *mmio = hpriv->mmio;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  573  	u32 ctl;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  574  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  575  	if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
8996b89d6bc98ae Mark Langsdorf  2012-09-06  576  		dev_err(dev, "firmware update required for suspend/resume\n");
8996b89d6bc98ae Mark Langsdorf  2012-09-06  577  		return -EIO;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  578  	}
8996b89d6bc98ae Mark Langsdorf  2012-09-06  579  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  580  	/*
8996b89d6bc98ae Mark Langsdorf  2012-09-06  581  	 * AHCI spec rev1.1 section 8.3.3:
8996b89d6bc98ae Mark Langsdorf  2012-09-06  582  	 * Software must disable interrupts prior to requesting a
8996b89d6bc98ae Mark Langsdorf  2012-09-06  583  	 * transition of the HBA to D3 state.
8996b89d6bc98ae Mark Langsdorf  2012-09-06  584  	 */
8996b89d6bc98ae Mark Langsdorf  2012-09-06  585  	ctl = readl(mmio + HOST_CTL);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  586  	ctl &= ~HOST_IRQ_EN;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  587  	writel(ctl, mmio + HOST_CTL);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  588  	readl(mmio + HOST_CTL); /* flush */
8996b89d6bc98ae Mark Langsdorf  2012-09-06  589  
ec87cf3782f7b05 Sergey Shtylyov 2022-02-02 @590  	ata_host_suspend(host, PMSG_SUSPEND);
ec87cf3782f7b05 Sergey Shtylyov 2022-02-02  591  	return 0;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  592  }
8996b89d6bc98ae Mark Langsdorf  2012-09-06  593  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  594  static int ahci_highbank_resume(struct device *dev)
8996b89d6bc98ae Mark Langsdorf  2012-09-06  595  {
8996b89d6bc98ae Mark Langsdorf  2012-09-06  596  	struct ata_host *host = dev_get_drvdata(dev);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  597  	int rc;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  598  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  599  	if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
8996b89d6bc98ae Mark Langsdorf  2012-09-06  600  		rc = ahci_reset_controller(host);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  601  		if (rc)
8996b89d6bc98ae Mark Langsdorf  2012-09-06  602  			return rc;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  603  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  604  		ahci_init_controller(host);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  605  	}
8996b89d6bc98ae Mark Langsdorf  2012-09-06  606  
8996b89d6bc98ae Mark Langsdorf  2012-09-06 @607  	ata_host_resume(host);
8996b89d6bc98ae Mark Langsdorf  2012-09-06  608  
8996b89d6bc98ae Mark Langsdorf  2012-09-06  609  	return 0;
8996b89d6bc98ae Mark Langsdorf  2012-09-06  610  }
8996b89d6bc98ae Mark Langsdorf  2012-09-06  611  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [RFC PATCH 00/14] AHCI power management cleanup
  2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
                   ` (13 preceding siblings ...)
  2025-01-27 12:46 ` [PATCH RFC 14/14] ahci: sata_rcar: " Raphael Gallais-Pou
@ 2025-01-27 16:30 ` Geert Uytterhoeven
  14 siblings, 0 replies; 23+ messages in thread
From: Geert Uytterhoeven @ 2025-01-27 16:30 UTC (permalink / raw)
  To: Raphael Gallais-Pou
  Cc: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Viresh Kumar,
	Geert Uytterhoeven, linux-ide, linux-kernel, imx,
	linux-arm-kernel, linux-mediatek, linux-sunxi, linux-renesas-soc

Hi Raphael,

On Mon, 27 Jan 2025 at 13:46, Raphael Gallais-Pou <rgallaispou@gmail.com> wrote:
> Several AHCI drivers expose suspend/resume functions in a way that can
> be simplified.  Using pre-processor operation can lead to errors, while
> relying on automatic kernel configuration is safer.  It also shrinks the
> kernel size when CONFIG_PM_SLEEP is not used[1].

m68k/allyesconfig:

drivers/ata/sata_highbank.c: In function ‘ahci_highbank_suspend’:
drivers/ata/sata_highbank.c:590:9: error: implicit declaration of
function ‘ata_host_suspend’; did you mean ‘ata_sas_port_suspend’?
[-Werror=implicit-function-declaration]
drivers/ata/sata_highbank.c: In function ‘ahci_highbank_resume’:
drivers/ata/sata_highbank.c:607:9: error: implicit declaration of
function ‘ata_host_resume’; did you mean ‘ahci_port_resume’?
[-Werror=implicit-function-declaration]
drivers/ata/pata_arasan_cf.c: In function ‘arasan_cf_suspend’:
drivers/ata/pata_arasan_cf.c:938:9: error: implicit declaration of
function ‘ata_host_suspend’; did you mean ‘ata_sas_port_suspend’?
[-Werror=implicit-function-declaration]
drivers/ata/pata_arasan_cf.c: In function ‘arasan_cf_resume’:
drivers/ata/pata_arasan_cf.c:948:9: error: implicit declaration of
function ‘ata_host_resume’; did you mean ‘sata_link_resume’?
[-Werror=implicit-function-declaration]
drivers/ata/sata_rcar.c: In function ‘sata_rcar_suspend’:
drivers/ata/sata_rcar.c:936:9: error: implicit declaration of function
‘ata_host_suspend’; did you mean ‘sata_rcar_suspend’?
[-Werror=implicit-function-declaration]
drivers/ata/sata_rcar.c: In function ‘sata_rcar_resume’:
drivers/ata/sata_rcar.c:973:9: error: implicit declaration of function
‘ata_host_resume’; did you mean ‘sata_rcar_resume’?
[-Werror=implicit-function-declaration]
drivers/ata/pata_imx.c: In function ‘pata_imx_suspend’:
drivers/ata/pata_imx.c:209:9: error: implicit declaration of function
‘ata_host_suspend’; did you mean ‘pata_imx_suspend’?
[-Werror=implicit-function-declaration]
drivers/ata/pata_imx.c: In function ‘pata_imx_resume’:
drivers/ata/pata_imx.c:232:9: error: implicit declaration of function
‘ata_host_resume’; did you mean ‘pata_imx_resume’?
[-Werror=implicit-function-declaration]

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH RFC 11/14] ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 11/14] ahci: pata_arasan_cf: " Raphael Gallais-Pou
@ 2025-01-27 22:19   ` kernel test robot
  2025-01-27 23:20   ` kernel test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kernel test robot @ 2025-01-27 22:19 UTC (permalink / raw)
  To: Raphael Gallais-Pou; +Cc: llvm, oe-kbuild-all

Hi Raphael,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on 5ffa57f6eecefababb8cbe327222ef171943b183]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/ahci-brcm-Switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20250127-205128
base:   5ffa57f6eecefababb8cbe327222ef171943b183
patch link:    https://lore.kernel.org/r/20250127-pm_ata-v1-11-f8f50c821a2a%40gmail.com
patch subject: [PATCH RFC 11/14] ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250128/202501280531.FN5QLnfR-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250128/202501280531.FN5QLnfR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501280531.FN5QLnfR-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/ata/pata_arasan_cf.c:28:
   In file included from include/linux/dmaengine.h:8:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/ata/pata_arasan_cf.c:938:2: error: call to undeclared function 'ata_host_suspend'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     938 |         ata_host_suspend(host, PMSG_SUSPEND);
         |         ^
>> drivers/ata/pata_arasan_cf.c:948:2: error: call to undeclared function 'ata_host_resume'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     948 |         ata_host_resume(host);
         |         ^
   3 warnings and 2 errors generated.


vim +/ata_host_suspend +938 drivers/ata/pata_arasan_cf.c

a480167b23ef9b3 Viresh Kumar    2011-02-22  928  
a480167b23ef9b3 Viresh Kumar    2011-02-22  929  static int arasan_cf_suspend(struct device *dev)
a480167b23ef9b3 Viresh Kumar    2011-02-22  930  {
90f0adf0936d464 Sergei Shtylyov 2011-10-12  931  	struct ata_host *host = dev_get_drvdata(dev);
a480167b23ef9b3 Viresh Kumar    2011-02-22  932  	struct arasan_cf_dev *acdev = host->ports[0]->private_data;
a480167b23ef9b3 Viresh Kumar    2011-02-22  933  
40679b3ce9d993e Viresh Kumar    2012-02-23  934  	if (acdev->dma_chan)
72b2caff4aac451 Vinod Koul      2014-10-11  935  		dmaengine_terminate_all(acdev->dma_chan);
40679b3ce9d993e Viresh Kumar    2012-02-23  936  
a480167b23ef9b3 Viresh Kumar    2011-02-22  937  	cf_exit(acdev);
ec87cf3782f7b05 Sergey Shtylyov 2022-02-02 @938  	ata_host_suspend(host, PMSG_SUSPEND);
ec87cf3782f7b05 Sergey Shtylyov 2022-02-02  939  	return 0;
a480167b23ef9b3 Viresh Kumar    2011-02-22  940  }
a480167b23ef9b3 Viresh Kumar    2011-02-22  941  
a480167b23ef9b3 Viresh Kumar    2011-02-22  942  static int arasan_cf_resume(struct device *dev)
a480167b23ef9b3 Viresh Kumar    2011-02-22  943  {
90f0adf0936d464 Sergei Shtylyov 2011-10-12  944  	struct ata_host *host = dev_get_drvdata(dev);
a480167b23ef9b3 Viresh Kumar    2011-02-22  945  	struct arasan_cf_dev *acdev = host->ports[0]->private_data;
a480167b23ef9b3 Viresh Kumar    2011-02-22  946  
a480167b23ef9b3 Viresh Kumar    2011-02-22  947  	cf_init(acdev);
a480167b23ef9b3 Viresh Kumar    2011-02-22 @948  	ata_host_resume(host);
a480167b23ef9b3 Viresh Kumar    2011-02-22  949  
a480167b23ef9b3 Viresh Kumar    2011-02-22  950  	return 0;
a480167b23ef9b3 Viresh Kumar    2011-02-22  951  }
a480167b23ef9b3 Viresh Kumar    2011-02-22  952  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH RFC 11/14] ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 11/14] ahci: pata_arasan_cf: " Raphael Gallais-Pou
  2025-01-27 22:19   ` kernel test robot
@ 2025-01-27 23:20   ` kernel test robot
  1 sibling, 0 replies; 23+ messages in thread
From: kernel test robot @ 2025-01-27 23:20 UTC (permalink / raw)
  To: Raphael Gallais-Pou; +Cc: oe-kbuild-all

Hi Raphael,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build errors:

[auto build test ERROR on 5ffa57f6eecefababb8cbe327222ef171943b183]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/ahci-brcm-Switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20250127-205128
base:   5ffa57f6eecefababb8cbe327222ef171943b183
patch link:    https://lore.kernel.org/r/20250127-pm_ata-v1-11-f8f50c821a2a%40gmail.com
patch subject: [PATCH RFC 11/14] ahci: pata_arasan_cf: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20250128/202501280705.bud0LV6C-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250128/202501280705.bud0LV6C-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501280705.bud0LV6C-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/ata/pata_arasan_cf.c: In function 'arasan_cf_suspend':
>> drivers/ata/pata_arasan_cf.c:938:9: error: implicit declaration of function 'ata_host_suspend'; did you mean 'ata_sas_port_suspend'? [-Wimplicit-function-declaration]
     938 |         ata_host_suspend(host, PMSG_SUSPEND);
         |         ^~~~~~~~~~~~~~~~
         |         ata_sas_port_suspend
   drivers/ata/pata_arasan_cf.c: In function 'arasan_cf_resume':
>> drivers/ata/pata_arasan_cf.c:948:9: error: implicit declaration of function 'ata_host_resume'; did you mean 'sata_link_resume'? [-Wimplicit-function-declaration]
     948 |         ata_host_resume(host);
         |         ^~~~~~~~~~~~~~~
         |         sata_link_resume


vim +938 drivers/ata/pata_arasan_cf.c

a480167b23ef9b Viresh Kumar    2011-02-22  928  
a480167b23ef9b Viresh Kumar    2011-02-22  929  static int arasan_cf_suspend(struct device *dev)
a480167b23ef9b Viresh Kumar    2011-02-22  930  {
90f0adf0936d46 Sergei Shtylyov 2011-10-12  931  	struct ata_host *host = dev_get_drvdata(dev);
a480167b23ef9b Viresh Kumar    2011-02-22  932  	struct arasan_cf_dev *acdev = host->ports[0]->private_data;
a480167b23ef9b Viresh Kumar    2011-02-22  933  
40679b3ce9d993 Viresh Kumar    2012-02-23  934  	if (acdev->dma_chan)
72b2caff4aac45 Vinod Koul      2014-10-11  935  		dmaengine_terminate_all(acdev->dma_chan);
40679b3ce9d993 Viresh Kumar    2012-02-23  936  
a480167b23ef9b Viresh Kumar    2011-02-22  937  	cf_exit(acdev);
ec87cf3782f7b0 Sergey Shtylyov 2022-02-02 @938  	ata_host_suspend(host, PMSG_SUSPEND);
ec87cf3782f7b0 Sergey Shtylyov 2022-02-02  939  	return 0;
a480167b23ef9b Viresh Kumar    2011-02-22  940  }
a480167b23ef9b Viresh Kumar    2011-02-22  941  
a480167b23ef9b Viresh Kumar    2011-02-22  942  static int arasan_cf_resume(struct device *dev)
a480167b23ef9b Viresh Kumar    2011-02-22  943  {
90f0adf0936d46 Sergei Shtylyov 2011-10-12  944  	struct ata_host *host = dev_get_drvdata(dev);
a480167b23ef9b Viresh Kumar    2011-02-22  945  	struct arasan_cf_dev *acdev = host->ports[0]->private_data;
a480167b23ef9b Viresh Kumar    2011-02-22  946  
a480167b23ef9b Viresh Kumar    2011-02-22  947  	cf_init(acdev);
a480167b23ef9b Viresh Kumar    2011-02-22 @948  	ata_host_resume(host);
a480167b23ef9b Viresh Kumar    2011-02-22  949  
a480167b23ef9b Viresh Kumar    2011-02-22  950  	return 0;
a480167b23ef9b Viresh Kumar    2011-02-22  951  }
a480167b23ef9b Viresh Kumar    2011-02-22  952  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH RFC 10/14] ahci: sunxi: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 12:46 ` [PATCH RFC 10/14] ahci: sunxi: " Raphael Gallais-Pou
@ 2025-01-29 18:43   ` Jernej Škrabec
  0 siblings, 0 replies; 23+ messages in thread
From: Jernej Škrabec @ 2025-01-29 18:43 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans de Goede, Patrice Chotard,
	Chen-Yu Tsai, Samuel Holland, Viresh Kumar, Geert Uytterhoeven,
	Raphael Gallais-Pou
  Cc: linux-ide, linux-kernel, imx, linux-arm-kernel, linux-mediatek,
	linux-sunxi, linux-renesas-soc

Dne ponedeljek, 27. januar 2025 ob 13:46:05 Srednjeevropski standardni čas je Raphael Gallais-Pou napisal(a):
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based kernel configuration guards.
> 
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



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

* Re: [PATCH RFC 14/14] ahci: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2025-01-27 13:45   ` Geert Uytterhoeven
@ 2025-01-30  2:30     ` Damien Le Moal
  0 siblings, 0 replies; 23+ messages in thread
From: Damien Le Moal @ 2025-01-30  2:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Raphael Gallais-Pou
  Cc: Niklas Cassel, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans de Goede, Patrice Chotard, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Viresh Kumar, Geert Uytterhoeven, linux-ide,
	linux-kernel, imx, linux-arm-kernel, linux-mediatek, linux-sunxi,
	linux-renesas-soc

On 1/27/25 22:45, Geert Uytterhoeven wrote:
> Hi Raphael,
> 
> On Mon, 27 Jan 2025 at 13:46, Raphael Gallais-Pou <rgallaispou@gmail.com> wrote:
>> Letting the compiler remove these functions when the kernel is built
>> without CONFIG_PM_SLEEP support is simpler and less error prone than the
>> use of #ifdef based kernel configuration guards.
>>
>> Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
> 
> Thanks for your patch!
> 
> The subsystem prefix is "ata", not "ahci" (not all ATA-drivers are
> AHCI-drivers).

Yep. The convention is:

ata: driver_name: xxx

So it would be:

ata: sata_rcar: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

for this patch. And the same comment applies to all your other patches in the
series.

> 
>> --- a/drivers/ata/sata_rcar.c
>> +++ b/drivers/ata/sata_rcar.c
>> @@ -927,7 +927,6 @@ static void sata_rcar_remove(struct platform_device *pdev)
>>         pm_runtime_disable(&pdev->dev);
>>  }
>>
>> -#ifdef CONFIG_PM_SLEEP
>>  static int sata_rcar_suspend(struct device *dev)
>>  {
>>         struct ata_host *host = dev_get_drvdata(dev);
>> @@ -1005,7 +1004,6 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>>         .poweroff       = sata_rcar_suspend,
>>         .restore        = sata_rcar_restore,
>>  };
>> -#endif
> 
> If CONFIG_PM_SLEEP is disabled (e.g. m68k allyesconfig):
> 
>     drivers/ata/sata_rcar.c: In function ‘sata_rcar_suspend’:
>     drivers/ata/sata_rcar.c:936:9: error: implicit declaration of
> function ‘ata_host_suspend’; did you mean ‘sata_rcar_suspend’?
> [-Werror=implicit-function-declaration]
>       936 |         ata_host_suspend(host, PMSG_SUSPEND);
>           |         ^~~~~~~~~~~~~~~~
>           |         sata_rcar_suspend
>     drivers/ata/sata_rcar.c: In function ‘sata_rcar_resume’:
>     drivers/ata/sata_rcar.c:973:9: error: implicit declaration of
> function ‘ata_host_resume’; did you mean ‘sata_rcar_resume’?
> [-Werror=implicit-function-declaration]
>       973 |         ata_host_resume(host);
>           |         ^~~~~~~~~~~~~~~
>           |         sata_rcar_resume
> 
>>
>>  static struct platform_driver sata_rcar_driver = {
>>         .probe          = sata_rcar_probe,
>> @@ -1013,9 +1011,7 @@ static struct platform_driver sata_rcar_driver = {
>>         .driver = {
>>                 .name           = DRV_NAME,
>>                 .of_match_table = sata_rcar_match,
>> -#ifdef CONFIG_PM_SLEEP
>> -               .pm             = &sata_rcar_pm_ops,
>> -#endif
>> +               .pm             = pm_sleep_ptr(&sata_rcar_pm_ops),
>>         },
>>  };
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 


-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2025-01-30  2:30 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 12:45 [RFC PATCH 00/14] AHCI power management cleanup Raphael Gallais-Pou
2025-01-27 12:45 ` [PATCH RFC 01/14] ahci: brcm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
2025-01-27 12:45 ` [PATCH RFC 02/14] ahci: ceva: " Raphael Gallais-Pou
2025-01-27 12:45 ` [PATCH RFC 03/14] ahci: da850: " Raphael Gallais-Pou
2025-01-27 12:45 ` [PATCH RFC 04/14] ahci: dm816: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 05/14] ahci: imx: " Raphael Gallais-Pou
2025-01-27 15:13   ` Frank Li
2025-01-27 12:46 ` [PATCH RFC 06/14] ahci: mtk: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 07/14] ahci: platform: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 08/14] ahci: qoriq: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 09/14] ahci: seattle: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 10/14] ahci: sunxi: " Raphael Gallais-Pou
2025-01-29 18:43   ` Jernej Škrabec
2025-01-27 12:46 ` [PATCH RFC 11/14] ahci: pata_arasan_cf: " Raphael Gallais-Pou
2025-01-27 22:19   ` kernel test robot
2025-01-27 23:20   ` kernel test robot
2025-01-27 12:46 ` [PATCH RFC 12/14] ahci: pata_imx: " Raphael Gallais-Pou
2025-01-27 12:46 ` [PATCH RFC 13/14] ahci: sata_highbank: " Raphael Gallais-Pou
2025-01-27 15:30   ` kernel test robot
2025-01-27 12:46 ` [PATCH RFC 14/14] ahci: sata_rcar: " Raphael Gallais-Pou
2025-01-27 13:45   ` Geert Uytterhoeven
2025-01-30  2:30     ` Damien Le Moal
2025-01-27 16:30 ` [RFC PATCH 00/14] AHCI power management cleanup Geert Uytterhoeven

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.