All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove()
@ 2021-03-27 21:24 Uwe Kleine-König
  2021-03-31 20:37 ` Vladimir Zapolskiy
  2021-04-09 12:45 ` Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2021-03-27 21:24 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones; +Cc: Vladimir Zapolskiy, linux-pwm, kernel

Before pwmchip_remove() returns the PWM is expected to be functional. So
remove the pwmchip before disabling the clock.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-lpc18xx-sct.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index 3f8e54ec28c6..b643ac61a2e7 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -441,13 +441,15 @@ static int lpc18xx_pwm_remove(struct platform_device *pdev)
 	struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev);
 	u32 val;
 
+	pwmchip_remove(&lpc18xx_pwm->chip);
+
 	val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL);
 	lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL,
 			   val | LPC18XX_PWM_CTRL_HALT);
 
 	clk_disable_unprepare(lpc18xx_pwm->pwm_clk);
 
-	return pwmchip_remove(&lpc18xx_pwm->chip);
+	return 0;
 }
 
 static struct platform_driver lpc18xx_pwm_driver = {
-- 
2.30.2


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

* Re: [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove()
  2021-03-27 21:24 [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove() Uwe Kleine-König
@ 2021-03-31 20:37 ` Vladimir Zapolskiy
  2021-04-05 20:16   ` Uwe Kleine-König
  2021-04-09 12:45 ` Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Vladimir Zapolskiy @ 2021-03-31 20:37 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding, Lee Jones; +Cc: linux-pwm, kernel

Hi Uwe,

On 3/27/21 11:24 PM, Uwe Kleine-König wrote:
> Before pwmchip_remove() returns the PWM is expected to be functional. So
> remove the pwmchip before disabling the clock.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/pwm/pwm-lpc18xx-sct.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
> index 3f8e54ec28c6..b643ac61a2e7 100644
> --- a/drivers/pwm/pwm-lpc18xx-sct.c
> +++ b/drivers/pwm/pwm-lpc18xx-sct.c
> @@ -441,13 +441,15 @@ static int lpc18xx_pwm_remove(struct platform_device *pdev)
>   	struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev);
>   	u32 val;
>   
> +	pwmchip_remove(&lpc18xx_pwm->chip);
> +
>   	val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL);
>   	lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL,
>   			   val | LPC18XX_PWM_CTRL_HALT);
>   
>   	clk_disable_unprepare(lpc18xx_pwm->pwm_clk);
>   
> -	return pwmchip_remove(&lpc18xx_pwm->chip);
> +	return 0;
>   }
>   
>   static struct platform_driver lpc18xx_pwm_driver = {
> 

Acked-by: Vladimir Zapolskiy <vz@mleia.com>

A horde of PWM drivers does not satisfy the condition, please check
at least quite popular pwm-rockchip.c, pwm-sti.c, pwm-vt8500.c,
pwm-bcm2835.c etc., again, it would be preferable to see all the
drivers fixed in a single series, thank you.

--
Best wishes,
Vladimir

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

* Re: [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove()
  2021-03-31 20:37 ` Vladimir Zapolskiy
@ 2021-04-05 20:16   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2021-04-05 20:16 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: Thierry Reding, Lee Jones, linux-pwm, kernel

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

Hello Vladimir,

On Wed, Mar 31, 2021 at 11:37:37PM +0300, Vladimir Zapolskiy wrote:
> On 3/27/21 11:24 PM, Uwe Kleine-König wrote:
> > Before pwmchip_remove() returns the PWM is expected to be functional. So
> > remove the pwmchip before disabling the clock.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >   drivers/pwm/pwm-lpc18xx-sct.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
> > index 3f8e54ec28c6..b643ac61a2e7 100644
> > --- a/drivers/pwm/pwm-lpc18xx-sct.c
> > +++ b/drivers/pwm/pwm-lpc18xx-sct.c
> > @@ -441,13 +441,15 @@ static int lpc18xx_pwm_remove(struct platform_device *pdev)
> >   	struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev);
> >   	u32 val;
> > +	pwmchip_remove(&lpc18xx_pwm->chip);
> > +
> >   	val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL);
> >   	lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL,
> >   			   val | LPC18XX_PWM_CTRL_HALT);
> >   	clk_disable_unprepare(lpc18xx_pwm->pwm_clk);
> > -	return pwmchip_remove(&lpc18xx_pwm->chip);
> > +	return 0;
> >   }
> >   static struct platform_driver lpc18xx_pwm_driver = {
> 
> Acked-by: Vladimir Zapolskiy <vz@mleia.com>

Thanks.
 
> A horde of PWM drivers does not satisfy the condition, please check
> at least quite popular pwm-rockchip.c, pwm-sti.c, pwm-vt8500.c,
> pwm-bcm2835.c etc., again, it would be preferable to see all the
> drivers fixed in a single series, thank you.

I'm aware that there are more drivers that need fixing and I will come
to them eventually. But I work on this on an on-and-off basis because
PWM driver fixing isn't the only thing I live for. So I send out a patch
whenever I finished one, I don't see a benefit to delay them just to
send them out in a series. If you want to work at fixing all drivers,
tell me, I have several other things to polish on my list.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove()
  2021-03-27 21:24 [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove() Uwe Kleine-König
  2021-03-31 20:37 ` Vladimir Zapolskiy
@ 2021-04-09 12:45 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2021-04-09 12:45 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Lee Jones, Vladimir Zapolskiy, linux-pwm, kernel

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

On Sat, Mar 27, 2021 at 10:24:28PM +0100, Uwe Kleine-König wrote:
> Before pwmchip_remove() returns the PWM is expected to be functional. So
> remove the pwmchip before disabling the clock.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-lpc18xx-sct.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-04-09 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 21:24 [PATCH] pwm: lpc18xx-sct: Free resources only after pwmchip_remove() Uwe Kleine-König
2021-03-31 20:37 ` Vladimir Zapolskiy
2021-04-05 20:16   ` Uwe Kleine-König
2021-04-09 12:45 ` Thierry Reding

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.