[PATCH RFC 08/14] ahci: qoriq: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()

Raphael Gallais-Pou posted 14 patches 3 days, 6 hours ago
[PATCH RFC 08/14] ahci: qoriq: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Posted by Raphael Gallais-Pou 3 days, 6 hours ago
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