Skip to contentSkip to conversation

extcon: axp288: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

PATCH In review Triet Hoang 2 participants 2 messages Aug 20

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon: axp288: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr().

This lets us drop the __maybe_unused annotations from the suspend and resume callbacks, and reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled.

---
 drivers/extcon/extcon-axp288.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +4 -4
index 19856dddade6..f073aa3b52cb 100644
@@ -476,7 +476,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused axp288_extcon_suspend(struct device *dev)
+static int axp288_extcon_suspend(struct device *dev)
 {
 	struct axp288_extcon_info *info = dev_get_drvdata(dev);
 
@@ -486,7 +486,7 @@ static int __maybe_unused axp288_extcon_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused axp288_extcon_resume(struct device *dev)
+static int axp288_extcon_resume(struct device *dev)
 {
 	struct axp288_extcon_info *info = dev_get_drvdata(dev);
 
@@ -501,7 +501,7 @@ static int __maybe_unused axp288_extcon_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
 			 axp288_extcon_resume);
 
 static const struct platform_device_id axp288_extcon_table[] = {
@@ -515,7 +515,7 @@ static struct platform_driver axp288_extcon_driver = {
 	.id_table = axp288_extcon_table,
 	.driver = {
 		.name = "axp288_extcon",
-		.pm = &axp288_extcon_pm_ops,
+		.pm = pm_sleep_ptr(&axp288_extcon_pm_ops),
 	},
 };
 module_platform_driver(axp288_extcon_driver);
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 8 lines · Triet Hoang

Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr().

This lets us drop the __maybe_unused annotations from the suspend and resume callbacks, and reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 44 lines
---
 drivers/extcon/extcon-axp288.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +4 -4
index 19856dddade6..f073aa3b52cb 100644
@@ -476,7 +476,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused axp288_extcon_suspend(struct device *dev)
+static int axp288_extcon_suspend(struct device *dev)
 {
 	struct axp288_extcon_info *info = dev_get_drvdata(dev);
 
@@ -486,7 +486,7 @@ static int __maybe_unused axp288_extcon_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused axp288_extcon_resume(struct device *dev)
+static int axp288_extcon_resume(struct device *dev)
 {
 	struct axp288_extcon_info *info = dev_get_drvdata(dev);
 
@@ -501,7 +501,7 @@ static int __maybe_unused axp288_extcon_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
 			 axp288_extcon_resume);
 
 static const struct platform_device_id axp288_extcon_table[] = {
@@ -515,7 +515,7 @@ static struct platform_driver axp288_extcon_driver = {
 	.id_table = axp288_extcon_table,
 	.driver = {
 		.name = "axp288_extcon",
-		.pm = &axp288_extcon_pm_ops,
+		.pm = pm_sleep_ptr(&axp288_extcon_pm_ops),
 	},
 };
 module_platform_driver(axp288_extcon_driver);