diff mbox series

pwm: atmel: Free resources only after pwmchip_remove()

Message ID 20210324195635.75037-1-u.kleine-koenig@pengutronix.de
State Accepted
Headers show
Series pwm: atmel: Free resources only after pwmchip_remove() | expand

Commit Message

Uwe Kleine-König March 24, 2021, 7:56 p.m. UTC
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-atmel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Claudiu Beznea April 2, 2021, 10:55 a.m. UTC | #1
Hi Uwe,

On 24.03.2021 21:56, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 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>> ---

Does this need a fixes tag?

Other than this:
Ack-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Thank you,
Claudiu

>  drivers/pwm/pwm-atmel.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index a4d0be6b265b..d49da708337f 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -450,10 +450,12 @@ static int atmel_pwm_remove(struct platform_device *pdev)
>  {
>         struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
> 
> +       pwmchip_remove(&atmel_pwm->chip);
> +
>         clk_unprepare(atmel_pwm->clk);
>         mutex_destroy(&atmel_pwm->isr_lock);
> 
> -       return pwmchip_remove(&atmel_pwm->chip);
> +       return 0;
>  }
> 
>  static struct platform_driver atmel_pwm_driver = {
> --
> 2.30.2
>
Uwe Kleine-König April 2, 2021, 8:27 p.m. UTC | #2
On Fri, Apr 02, 2021 at 10:55:14AM +0000, Claudiu.Beznea@microchip.com wrote:
> Hi Uwe,
> 
> On 24.03.2021 21:56, Uwe Kleine-König wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > 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>> ---
> 
> Does this need a fixes tag?

Hmm, that would be:

Fixes: 32b16d46e415 ("pwm: atmel-pwm: Add Atmel PWM controller driver")

which is the commit that introduced the driver in 2013.

> Other than this:
> Ack-by: Claudiu Beznea <claudiu.beznea@microchip.com>

You might want to make this "Acked-by:" so that patchwork automatically
picks this up.

Best regards
Uwe
Claudiu Beznea April 5, 2021, 7:46 a.m. UTC | #3
On 02.04.2021 23:27, Uwe Kleine-König wrote:
>> Other than this:
>> Ack-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> You might want to make this "Acked-by:" so that patchwork automatically
> picks this up.

Yep, typo...

Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Thierry Reding April 9, 2021, 12:28 p.m. UTC | #4
On Wed, Mar 24, 2021 at 08:56:35PM +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-atmel.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Thierry
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index a4d0be6b265b..d49da708337f 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -450,10 +450,12 @@  static int atmel_pwm_remove(struct platform_device *pdev)
 {
 	struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
 
+	pwmchip_remove(&atmel_pwm->chip);
+
 	clk_unprepare(atmel_pwm->clk);
 	mutex_destroy(&atmel_pwm->isr_lock);
 
-	return pwmchip_remove(&atmel_pwm->chip);
+	return 0;
 }
 
 static struct platform_driver atmel_pwm_driver = {