Skip to contentSkip to conversation

Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver

PATCH In review Raag Jadav 3 participants 9 messages Nov 13, 2023 – Nov 14, 2023

Subsystems (3)
lore
Share & tools
lore

Raag Jadav

author
#0 lore raw

cover Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Raag Jadav (3):
gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper
gpio: elkhartlake: reuse pm_ops from Intel Tangier driver
gpio: tangier: unexport suspend/resume handles

 drivers/gpio/gpio-elkhartlake.c | 14 +-------------
 drivers/gpio/gpio-tangier.c     |  9 +++++----
 drivers/gpio/gpio-tangier.h     |  4 ++--
 3 files changed, 8 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/3 gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper

Use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper to export pm_ops to GPIO_TANGIER namespace, so that they can be reused.

---
 drivers/gpio/gpio-tangier.c | 3 +++
 drivers/gpio/gpio-tangier.h | 3 +++
 2 files changed, 6 insertions(+)
drivers/gpio/gpio-tangier.c +3 -0
index 7ce3eddaed25..52d0868476e1 100644
@@ -19,6 +19,7 @@
 #include <linux/math.h>
 #include <linux/module.h>
 #include <linux/pinctrl/pinconf-generic.h>
+#include <linux/pm.h>
 #include <linux/spinlock.h>
 #include <linux/string_helpers.h>
 #include <linux/types.h>
@@ -531,6 +532,8 @@ int tng_gpio_resume(struct device *dev)
 }
 EXPORT_SYMBOL_NS_GPL(tng_gpio_resume, GPIO_TANGIER);
 
+EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(tng_gpio_pm_ops, tng_gpio_suspend, tng_gpio_resume, GPIO_TANGIER);
+
 MODULE_AUTHOR("Andy Shevchenko <[email protected]>");
 MODULE_AUTHOR("Pandith N <[email protected]>");
 MODULE_AUTHOR("Raag Jadav <[email protected]>");
drivers/gpio/gpio-tangier.h +3 -0
index 16c4f22908fb..333e5f79b908 100644
@@ -13,6 +13,7 @@
 #define _GPIO_TANGIER_H_
 
 #include <linux/gpio/driver.h>
+#include <linux/pm.h>
 #include <linux/spinlock_types.h>
 #include <linux/types.h>
 
@@ -114,4 +115,6 @@ int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio);
 int tng_gpio_suspend(struct device *dev);
 int tng_gpio_resume(struct device *dev);
 
+extern const struct dev_pm_ops tng_gpio_pm_ops;
+
 #endif /* _GPIO_TANGIER_H_ */
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/3 gpio: elkhartlake: reuse pm_ops from Intel Tangier driver

In reply to Raag Jadav

Reuse tng_gpio_pm_ops from Intel Tangier driver instead of calling them through a local copy.

---
 drivers/gpio/gpio-elkhartlake.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/gpio/gpio-elkhartlake.c +1 -13
index a9c8b16215be..887c0fe99d39 100644
@@ -55,18 +55,6 @@ static int ehl_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ehl_gpio_suspend(struct device *dev)
-{
-	return tng_gpio_suspend(dev);
-}
-
-static int ehl_gpio_resume(struct device *dev)
-{
-	return tng_gpio_resume(dev);
-}
-
-static DEFINE_SIMPLE_DEV_PM_OPS(ehl_gpio_pm_ops, ehl_gpio_suspend, ehl_gpio_resume);
-
 static const struct platform_device_id ehl_gpio_ids[] = {
 	{ "gpio-elkhartlake" },
 	{ }
@@ -76,7 +64,7 @@ MODULE_DEVICE_TABLE(platform, ehl_gpio_ids);
 static struct platform_driver ehl_gpio_driver = {
 	.driver	= {
 		.name	= "gpio-elkhartlake",
-		.pm	= pm_sleep_ptr(&ehl_gpio_pm_ops),
+		.pm	= pm_sleep_ptr(&tng_gpio_pm_ops),
 	},
 	.probe		= ehl_gpio_probe,
 	.id_table	= ehl_gpio_ids,
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/3 gpio: tangier: unexport suspend/resume handles

In reply to Raag Jadav

Unexport suspend/resume handles for the lack of external users and while at it, make them static, so that they can be discarded by the compiler if not used (CONFIG_PM_SLEEP=n).

---
 drivers/gpio/gpio-tangier.c | 6 ++----
 drivers/gpio/gpio-tangier.h | 3 ---
 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/gpio/gpio-tangier.c +2 -4
index 52d0868476e1..158fa9054e9c 100644
@@ -478,7 +478,7 @@ int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio)
 }
 EXPORT_SYMBOL_NS_GPL(devm_tng_gpio_probe, GPIO_TANGIER);
 
-int tng_gpio_suspend(struct device *dev)
+static int tng_gpio_suspend(struct device *dev)
 {
 	struct tng_gpio *priv = dev_get_drvdata(dev);
 	struct tng_gpio_context *ctx = priv->ctx;
@@ -503,9 +503,8 @@ int tng_gpio_suspend(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_NS_GPL(tng_gpio_suspend, GPIO_TANGIER);
 
-int tng_gpio_resume(struct device *dev)
+static int tng_gpio_resume(struct device *dev)
 {
 	struct tng_gpio *priv = dev_get_drvdata(dev);
 	struct tng_gpio_context *ctx = priv->ctx;
@@ -530,7 +529,6 @@ int tng_gpio_resume(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_NS_GPL(tng_gpio_resume, GPIO_TANGIER);
 
 EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(tng_gpio_pm_ops, tng_gpio_suspend, tng_gpio_resume, GPIO_TANGIER);
 
drivers/gpio/gpio-tangier.h +0 -3
index 333e5f79b908..ca7ab6cf6fa5 100644
@@ -112,9 +112,6 @@ struct tng_gpio {
 
 int devm_tng_gpio_probe(struct device *dev, struct tng_gpio *gpio);
 
-int tng_gpio_suspend(struct device *dev);
-int tng_gpio_resume(struct device *dev);
-
 extern const struct dev_pm_ops tng_gpio_pm_ops;
 
 #endif /* _GPIO_TANGIER_H_ */
Signature · 1 line
2.17.1
#4 lore raw
In reply to Raag Jadav
Quoted 2 lines · Raag Jadav

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Yet you missed --base...

Pushed to my review and testing queue, thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#5 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Raag Jadav

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Yet you missed --base...

My understanding is that we use --base only for the patches with explicit in-tree dependency, which this series doesn't have any AFAIK.

Will start using it for every patch if it makes everyone happy :)

Raag

#6 lore raw
Quoted 11 lines · Raag Jadav
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Raag Jadav

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Yet you missed --base...

My understanding is that we use --base only for the patches with explicit in-tree dependency, which this series doesn't have any AFAIK.

Will start using it for every patch if it makes everyone happy :)

For single patches it's not so critical, only for the series as I'm using b4 to treat them as PRs, so cover letter goes to the merge commit and b4 tries to guess the base (often wrongly).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#7 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Raag Jadav
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Raag Jadav

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Yet you missed --base...

Quoted 8 lines
Quoted 4 lines

My understanding is that we use --base only for the patches with explicit in-tree dependency, which this series doesn't have any AFAIK.

Will start using it for every patch if it makes everyone happy :)

For single patches it's not so critical, only for the series as I'm using b4 to treat them as PRs, so cover letter goes to the merge commit and b4 tries to guess the base (often wrongly).

Understood, will take care from now on.

Raag

Acked-by on the v1 series
#8 lore raw
In reply to Raag Jadav
Quoted 8 lines · Raag Jadav

This series exports pm_ops structure from Intel Tangier GPIO driver using EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper and reuses it into its users.

Raag Jadav (3):
gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper
gpio: elkhartlake: reuse pm_ops from Intel Tangier driver
gpio: tangier: unexport suspend/resume handles

Quoted 4 lines
 drivers/gpio/gpio-elkhartlake.c | 14 +-------------
 drivers/gpio/gpio-tangier.c     |  9 +++++----
 drivers/gpio/gpio-tangier.h     |  4 ++--
 3 files changed, 8 insertions(+), 19 deletions(-)