Message ID | 20210325082931.81774-1-u.kleine-koenig@pengutronix.de |
---|---|
State | Accepted |
Headers | show |
Series | pwm: bcm2835: Free resources only after pwmchip_remove() | expand |
On 3/25/2021 1:29 AM, 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> Similar to your pwm-bcm-iproc.c change, I would be inclined to add a: Fixes: e5a06dc5ac1f ("pwm: Add BCM2835 PWM driver") Acked-by: Florian Fainelli <f.fainelli@gmail.com> Thanks Uwe!
On Thu, Mar 25, 2021 at 03:37:14PM -0700, Florian Fainelli wrote: > > > On 3/25/2021 1:29 AM, 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> > > Similar to your pwm-bcm-iproc.c change, I would be inclined to add a: > > Fixes: e5a06dc5ac1f ("pwm: Add BCM2835 PWM driver") > > Acked-by: Florian Fainelli <f.fainelli@gmail.com> I think unless this causes an actual problem, which I've never heard of, there's little sense in having this backported all the way back. Thierry
On Thu, Mar 25, 2021 at 09:29:31AM +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-bcm2835.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Applied, thanks. Thierry
diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c index e4b54675b356..fc240d5b8121 100644 --- a/drivers/pwm/pwm-bcm2835.c +++ b/drivers/pwm/pwm-bcm2835.c @@ -179,9 +179,11 @@ static int bcm2835_pwm_remove(struct platform_device *pdev) { struct bcm2835_pwm *pc = platform_get_drvdata(pdev); + pwmchip_remove(&pc->chip); + clk_disable_unprepare(pc->clk); - return pwmchip_remove(&pc->chip); + return 0; } static const struct of_device_id bcm2835_pwm_of_match[] = {
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-bcm2835.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)