linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
@ 2023-11-13 13:15 Raag Jadav
  2023-11-13 13:15 ` [PATCH v1 1/3] gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper Raag Jadav
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Raag Jadav @ 2023-11-13 13:15 UTC (permalink / raw)
  To: linus.walleij, brgl, mika.westerberg, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, mallikarjunappa.sangannavar,
	bala.senthil, 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

 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(-)

-- 
2.17.1


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

* [PATCH v1 1/3] gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper
  2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
@ 2023-11-13 13:15 ` Raag Jadav
  2023-11-13 13:15 ` [PATCH v1 2/3] gpio: elkhartlake: reuse pm_ops from Intel Tangier driver Raag Jadav
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Raag Jadav @ 2023-11-13 13:15 UTC (permalink / raw)
  To: linus.walleij, brgl, mika.westerberg, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, mallikarjunappa.sangannavar,
	bala.senthil, Raag Jadav

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

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/gpio/gpio-tangier.c | 3 +++
 drivers/gpio/gpio-tangier.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpio/gpio-tangier.c b/drivers/gpio/gpio-tangier.c
index 7ce3eddaed25..52d0868476e1 100644
--- a/drivers/gpio/gpio-tangier.c
+++ b/drivers/gpio/gpio-tangier.c
@@ -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 <andriy.shevchenko@linux.intel.com>");
 MODULE_AUTHOR("Pandith N <pandith.n@intel.com>");
 MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
diff --git a/drivers/gpio/gpio-tangier.h b/drivers/gpio/gpio-tangier.h
index 16c4f22908fb..333e5f79b908 100644
--- a/drivers/gpio/gpio-tangier.h
+++ b/drivers/gpio/gpio-tangier.h
@@ -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_ */
-- 
2.17.1


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

* [PATCH v1 2/3] gpio: elkhartlake: reuse pm_ops from Intel Tangier driver
  2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
  2023-11-13 13:15 ` [PATCH v1 1/3] gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper Raag Jadav
@ 2023-11-13 13:15 ` Raag Jadav
  2023-11-13 13:16 ` [PATCH v1 3/3] gpio: tangier: unexport suspend/resume handles Raag Jadav
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Raag Jadav @ 2023-11-13 13:15 UTC (permalink / raw)
  To: linus.walleij, brgl, mika.westerberg, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, mallikarjunappa.sangannavar,
	bala.senthil, Raag Jadav

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

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/gpio/gpio-elkhartlake.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/gpio/gpio-elkhartlake.c b/drivers/gpio/gpio-elkhartlake.c
index a9c8b16215be..887c0fe99d39 100644
--- a/drivers/gpio/gpio-elkhartlake.c
+++ b/drivers/gpio/gpio-elkhartlake.c
@@ -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,
-- 
2.17.1


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

* [PATCH v1 3/3] gpio: tangier: unexport suspend/resume handles
  2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
  2023-11-13 13:15 ` [PATCH v1 1/3] gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper Raag Jadav
  2023-11-13 13:15 ` [PATCH v1 2/3] gpio: elkhartlake: reuse pm_ops from Intel Tangier driver Raag Jadav
@ 2023-11-13 13:16 ` Raag Jadav
  2023-11-13 15:58 ` [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Andy Shevchenko
  2023-11-14 11:59 ` Mika Westerberg
  4 siblings, 0 replies; 9+ messages in thread
From: Raag Jadav @ 2023-11-13 13:16 UTC (permalink / raw)
  To: linus.walleij, brgl, mika.westerberg, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, mallikarjunappa.sangannavar,
	bala.senthil, 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).

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/gpio/gpio-tangier.c | 6 ++----
 drivers/gpio/gpio-tangier.h | 3 ---
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-tangier.c b/drivers/gpio/gpio-tangier.c
index 52d0868476e1..158fa9054e9c 100644
--- a/drivers/gpio/gpio-tangier.c
+++ b/drivers/gpio/gpio-tangier.c
@@ -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);
 
diff --git a/drivers/gpio/gpio-tangier.h b/drivers/gpio/gpio-tangier.h
index 333e5f79b908..ca7ab6cf6fa5 100644
--- a/drivers/gpio/gpio-tangier.h
+++ b/drivers/gpio/gpio-tangier.h
@@ -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_ */
-- 
2.17.1


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

* Re: [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
  2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
                   ` (2 preceding siblings ...)
  2023-11-13 13:16 ` [PATCH v1 3/3] gpio: tangier: unexport suspend/resume handles Raag Jadav
@ 2023-11-13 15:58 ` Andy Shevchenko
  2023-11-14  4:38   ` Raag Jadav
  2023-11-14 11:59 ` Mika Westerberg
  4 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2023-11-13 15:58 UTC (permalink / raw)
  To: Raag Jadav
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel,
	mallikarjunappa.sangannavar, bala.senthil

On Mon, Nov 13, 2023 at 06:45:57PM +0530, Raag Jadav wrote:
> 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!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
  2023-11-13 15:58 ` [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Andy Shevchenko
@ 2023-11-14  4:38   ` Raag Jadav
  2023-11-14 11:49     ` Andy Shevchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Raag Jadav @ 2023-11-14  4:38 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel,
	mallikarjunappa.sangannavar, bala.senthil

On Mon, Nov 13, 2023 at 05:58:34PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 13, 2023 at 06:45:57PM +0530, Raag Jadav wrote:
> > 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

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

* Re: [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
  2023-11-14  4:38   ` Raag Jadav
@ 2023-11-14 11:49     ` Andy Shevchenko
  2023-11-14 13:21       ` Raag Jadav
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2023-11-14 11:49 UTC (permalink / raw)
  To: Raag Jadav
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel,
	mallikarjunappa.sangannavar, bala.senthil

On Tue, Nov 14, 2023 at 06:38:44AM +0200, Raag Jadav wrote:
> On Mon, Nov 13, 2023 at 05:58:34PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 13, 2023 at 06:45:57PM +0530, Raag Jadav wrote:
> > > 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).

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
  2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
                   ` (3 preceding siblings ...)
  2023-11-13 15:58 ` [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Andy Shevchenko
@ 2023-11-14 11:59 ` Mika Westerberg
  4 siblings, 0 replies; 9+ messages in thread
From: Mika Westerberg @ 2023-11-14 11:59 UTC (permalink / raw)
  To: Raag Jadav
  Cc: linus.walleij, brgl, andriy.shevchenko, linux-gpio, linux-kernel,
	mallikarjunappa.sangannavar, bala.senthil

On Mon, Nov 13, 2023 at 06:45:57PM +0530, Raag Jadav wrote:
> 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(-)

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver
  2023-11-14 11:49     ` Andy Shevchenko
@ 2023-11-14 13:21       ` Raag Jadav
  0 siblings, 0 replies; 9+ messages in thread
From: Raag Jadav @ 2023-11-14 13:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel,
	mallikarjunappa.sangannavar, bala.senthil

On Tue, Nov 14, 2023 at 01:49:08PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 14, 2023 at 06:38:44AM +0200, Raag Jadav wrote:
> > On Mon, Nov 13, 2023 at 05:58:34PM +0200, Andy Shevchenko wrote:
> > > On Mon, Nov 13, 2023 at 06:45:57PM +0530, Raag Jadav wrote:
> > > > 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).

Understood, will take care from now on.

Raag

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

end of thread, other threads:[~2023-11-14 13:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 13:15 [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Raag Jadav
2023-11-13 13:15 ` [PATCH v1 1/3] gpio: tangier: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() helper Raag Jadav
2023-11-13 13:15 ` [PATCH v1 2/3] gpio: elkhartlake: reuse pm_ops from Intel Tangier driver Raag Jadav
2023-11-13 13:16 ` [PATCH v1 3/3] gpio: tangier: unexport suspend/resume handles Raag Jadav
2023-11-13 15:58 ` [PATCH v1 0/3] Use the standard _PM_OPS() export macro in Intel Tangier GPIO driver Andy Shevchenko
2023-11-14  4:38   ` Raag Jadav
2023-11-14 11:49     ` Andy Shevchenko
2023-11-14 13:21       ` Raag Jadav
2023-11-14 11:59 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).