All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: meson: Simplify using devm_pwmchip_add
@ 2021-05-10 17:10 ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-05-10 17:10 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones, Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Martin Blumenstingl, linux-pwm,
	linux-amlogic

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

this obviously depends on https://lore.kernel.org/r/20210407080155.55004-2-u.kleine-koenig@pengutronix.de

Best regards
Uwe

 drivers/pwm/pwm-meson.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 9eb060613cb4..d9de4562e003 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	err = pwmchip_add(&meson->chip);
+	err = devm_pwmchip_add(&meson->chip);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
 		return err;
 	}
 
-	platform_set_drvdata(pdev, meson);
-
 	return 0;
 }
 
-static int meson_pwm_remove(struct platform_device *pdev)
-{
-	struct meson_pwm *meson = platform_get_drvdata(pdev);
-
-	return pwmchip_remove(&meson->chip);
-}
-
 static struct platform_driver meson_pwm_driver = {
 	.driver = {
 		.name = "meson-pwm",
 		.of_match_table = meson_pwm_matches,
 	},
 	.probe = meson_pwm_probe,
-	.remove = meson_pwm_remove,
 };
 module_platform_driver(meson_pwm_driver);
 

base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
-- 
2.30.2


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

* [PATCH] pwm: meson: Simplify using devm_pwmchip_add
@ 2021-05-10 17:10 ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-05-10 17:10 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones, Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Martin Blumenstingl, linux-pwm,
	linux-amlogic

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

this obviously depends on https://lore.kernel.org/r/20210407080155.55004-2-u.kleine-koenig@pengutronix.de

Best regards
Uwe

 drivers/pwm/pwm-meson.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 9eb060613cb4..d9de4562e003 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	err = pwmchip_add(&meson->chip);
+	err = devm_pwmchip_add(&meson->chip);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
 		return err;
 	}
 
-	platform_set_drvdata(pdev, meson);
-
 	return 0;
 }
 
-static int meson_pwm_remove(struct platform_device *pdev)
-{
-	struct meson_pwm *meson = platform_get_drvdata(pdev);
-
-	return pwmchip_remove(&meson->chip);
-}
-
 static struct platform_driver meson_pwm_driver = {
 	.driver = {
 		.name = "meson-pwm",
 		.of_match_table = meson_pwm_matches,
 	},
 	.probe = meson_pwm_probe,
-	.remove = meson_pwm_remove,
 };
 module_platform_driver(meson_pwm_driver);
 

base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
-- 
2.30.2


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] pwm: meson: Simplify using devm_pwmchip_add
  2021-05-10 17:10 ` Uwe Kleine-König
@ 2021-05-10 18:42   ` Romain Perier
  -1 siblings, 0 replies; 8+ messages in thread
From: Romain Perier @ 2021-05-10 18:42 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl, linux-pwm, linux-amlogic

Hi,

The "struct device *" as first argument is missing, nop ?

Regards,
Romain


Le lun. 10 mai 2021 à 19:11, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> a écrit :
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> this obviously depends on https://lore.kernel.org/r/20210407080155.55004-2-u.kleine-koenig@pengutronix.de
>
> Best regards
> Uwe
>
>  drivers/pwm/pwm-meson.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 9eb060613cb4..d9de4562e003 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
>         if (err < 0)
>                 return err;
>
> -       err = pwmchip_add(&meson->chip);
> +       err = devm_pwmchip_add(&meson->chip);
>         if (err < 0) {
>                 dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
>                 return err;
>         }
>
> -       platform_set_drvdata(pdev, meson);
> -
>         return 0;
>  }
>
> -static int meson_pwm_remove(struct platform_device *pdev)
> -{
> -       struct meson_pwm *meson = platform_get_drvdata(pdev);
> -
> -       return pwmchip_remove(&meson->chip);
> -}
> -
>  static struct platform_driver meson_pwm_driver = {
>         .driver = {
>                 .name = "meson-pwm",
>                 .of_match_table = meson_pwm_matches,
>         },
>         .probe = meson_pwm_probe,
> -       .remove = meson_pwm_remove,
>  };
>  module_platform_driver(meson_pwm_driver);
>
>
> base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
> prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
> --
> 2.30.2
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] pwm: meson: Simplify using devm_pwmchip_add
@ 2021-05-10 18:42   ` Romain Perier
  0 siblings, 0 replies; 8+ messages in thread
From: Romain Perier @ 2021-05-10 18:42 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl, linux-pwm, linux-amlogic

Hi,

The "struct device *" as first argument is missing, nop ?

Regards,
Romain


Le lun. 10 mai 2021 à 19:11, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> a écrit :
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> this obviously depends on https://lore.kernel.org/r/20210407080155.55004-2-u.kleine-koenig@pengutronix.de
>
> Best regards
> Uwe
>
>  drivers/pwm/pwm-meson.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 9eb060613cb4..d9de4562e003 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
>         if (err < 0)
>                 return err;
>
> -       err = pwmchip_add(&meson->chip);
> +       err = devm_pwmchip_add(&meson->chip);
>         if (err < 0) {
>                 dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
>                 return err;
>         }
>
> -       platform_set_drvdata(pdev, meson);
> -
>         return 0;
>  }
>
> -static int meson_pwm_remove(struct platform_device *pdev)
> -{
> -       struct meson_pwm *meson = platform_get_drvdata(pdev);
> -
> -       return pwmchip_remove(&meson->chip);
> -}
> -
>  static struct platform_driver meson_pwm_driver = {
>         .driver = {
>                 .name = "meson-pwm",
>                 .of_match_table = meson_pwm_matches,
>         },
>         .probe = meson_pwm_probe,
> -       .remove = meson_pwm_remove,
>  };
>  module_platform_driver(meson_pwm_driver);
>
>
> base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
> prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
> --
> 2.30.2
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v2] pwm: meson: Simplify using devm_pwmchip_add
  2021-05-10 18:42   ` Romain Perier
@ 2021-05-10 19:09     ` Uwe Kleine-König
  -1 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-05-10 19:09 UTC (permalink / raw)
  To: Romain Perier, Thierry Reding, Lee Jones, Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Martin Blumenstingl, linux-pwm,
	linux-amlogic, kernel

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---

Hi Romain,

On Mon, May 10, 2021 at 08:42:07PM +0200, Romain Perier wrote:
> The "struct device *" as first argument is missing, nop ?

Damn, you're right. Here comes v2 after enabling the meson driver in my
test .config :-\

Best regards
Uwe


 drivers/pwm/pwm-meson.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 9eb060613cb4..fc5a0acb7eb9 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	err = pwmchip_add(&meson->chip);
+	err = devm_pwmchip_add(&pdev->dev, &meson->chip);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
 		return err;
 	}
 
-	platform_set_drvdata(pdev, meson);
-
 	return 0;
 }
 
-static int meson_pwm_remove(struct platform_device *pdev)
-{
-	struct meson_pwm *meson = platform_get_drvdata(pdev);
-
-	return pwmchip_remove(&meson->chip);
-}
-
 static struct platform_driver meson_pwm_driver = {
 	.driver = {
 		.name = "meson-pwm",
 		.of_match_table = meson_pwm_matches,
 	},
 	.probe = meson_pwm_probe,
-	.remove = meson_pwm_remove,
 };
 module_platform_driver(meson_pwm_driver);
 

base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
-- 
2.30.2


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

* [PATCH v2] pwm: meson: Simplify using devm_pwmchip_add
@ 2021-05-10 19:09     ` Uwe Kleine-König
  0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2021-05-10 19:09 UTC (permalink / raw)
  To: Romain Perier, Thierry Reding, Lee Jones, Kevin Hilman
  Cc: Neil Armstrong, Jerome Brunet, Martin Blumenstingl, linux-pwm,
	linux-amlogic, kernel

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---

Hi Romain,

On Mon, May 10, 2021 at 08:42:07PM +0200, Romain Perier wrote:
> The "struct device *" as first argument is missing, nop ?

Damn, you're right. Here comes v2 after enabling the meson driver in my
test .config :-\

Best regards
Uwe


 drivers/pwm/pwm-meson.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 9eb060613cb4..fc5a0acb7eb9 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -560,31 +560,21 @@ static int meson_pwm_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	err = pwmchip_add(&meson->chip);
+	err = devm_pwmchip_add(&pdev->dev, &meson->chip);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register PWM chip: %d\n", err);
 		return err;
 	}
 
-	platform_set_drvdata(pdev, meson);
-
 	return 0;
 }
 
-static int meson_pwm_remove(struct platform_device *pdev)
-{
-	struct meson_pwm *meson = platform_get_drvdata(pdev);
-
-	return pwmchip_remove(&meson->chip);
-}
-
 static struct platform_driver meson_pwm_driver = {
 	.driver = {
 		.name = "meson-pwm",
 		.of_match_table = meson_pwm_matches,
 	},
 	.probe = meson_pwm_probe,
-	.remove = meson_pwm_remove,
 };
 module_platform_driver(meson_pwm_driver);
 

base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5
prerequisite-patch-id: fa39cd0c852d109ed957dc44dca5bdcf5dff0685
-- 
2.30.2


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v2] pwm: meson: Simplify using devm_pwmchip_add
  2021-05-10 19:09     ` Uwe Kleine-König
@ 2021-05-16 17:00       ` Martin Blumenstingl
  -1 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2021-05-16 17:00 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Romain Perier, Thierry Reding, Lee Jones, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, linux-pwm, linux-amlogic, kernel

Hi Uwe,

On Mon, May 10, 2021 at 9:09 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

[...]
>  drivers/pwm/pwm-meson.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
I'd say your patch achieves it's goal by re-using more code instead of
duplicating it across drivers
Thanks for working on this!


Best regards,
Martin

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

* Re: [PATCH v2] pwm: meson: Simplify using devm_pwmchip_add
@ 2021-05-16 17:00       ` Martin Blumenstingl
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2021-05-16 17:00 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Romain Perier, Thierry Reding, Lee Jones, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, linux-pwm, linux-amlogic, kernel

Hi Uwe,

On Mon, May 10, 2021 at 9:09 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

[...]
>  drivers/pwm/pwm-meson.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
I'd say your patch achieves it's goal by re-using more code instead of
duplicating it across drivers
Thanks for working on this!


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2021-05-16 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 17:10 [PATCH] pwm: meson: Simplify using devm_pwmchip_add Uwe Kleine-König
2021-05-10 17:10 ` Uwe Kleine-König
2021-05-10 18:42 ` Romain Perier
2021-05-10 18:42   ` Romain Perier
2021-05-10 19:09   ` [PATCH v2] " Uwe Kleine-König
2021-05-10 19:09     ` Uwe Kleine-König
2021-05-16 17:00     ` Martin Blumenstingl
2021-05-16 17:00       ` Martin Blumenstingl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.