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

Raphael Gallais-Pou posted 14 patches 3 days, 6 hours ago
[PATCH RFC 13/14] ahci: sata_highbank: 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/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