Skip to content

Commit

Permalink
pwm: lpc32xx: Properly disable the clock on device removal
Browse files Browse the repository at this point in the history
A single clock is used for all PWMs meaning the clock's reference count
might be between 0 and N when .remove() is called. Instead of a single
clk_disable() call pwm_disable() on each PWM, to ensure that
clk_disable() is called for each PWM that is still enabled.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Acked-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Acked-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
  • Loading branch information
Alban Bedel authored and Thierry Reding committed Dec 6, 2012
1 parent a9a18e0 commit 54b2a99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/pwm/pwm-lpc32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
static int __devexit lpc32xx_pwm_remove(struct platform_device *pdev)
{
struct lpc32xx_pwm_chip *lpc32xx = platform_get_drvdata(pdev);
unsigned int i;

for (i = 0; i < lpc32xx->chip.npwm; i++)
pwm_disable(&lpc32xx->chip.pwms[i]);

clk_disable(lpc32xx->clk);
return pwmchip_remove(&lpc32xx->chip);
}

Expand Down

0 comments on commit 54b2a99

Please sign in to comment.