Commit da68a9f4 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: lpc32xx: Simplify using devm_pwmchip_add()

This allows to drop the platform_driver's remove function. This is the
only user of driver data so this can go away, too.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 071beb7c
...@@ -122,24 +122,15 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) ...@@ -122,24 +122,15 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
val &= ~PWM_PIN_LEVEL; val &= ~PWM_PIN_LEVEL;
writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2));
ret = pwmchip_add(&lpc32xx->chip); ret = devm_pwmchip_add(&pdev->dev, &lpc32xx->chip);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret); dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret);
return ret; return ret;
} }
platform_set_drvdata(pdev, lpc32xx);
return 0; return 0;
} }
static int lpc32xx_pwm_remove(struct platform_device *pdev)
{
struct lpc32xx_pwm_chip *lpc32xx = platform_get_drvdata(pdev);
return pwmchip_remove(&lpc32xx->chip);
}
static const struct of_device_id lpc32xx_pwm_dt_ids[] = { static const struct of_device_id lpc32xx_pwm_dt_ids[] = {
{ .compatible = "nxp,lpc3220-pwm", }, { .compatible = "nxp,lpc3220-pwm", },
{ /* sentinel */ } { /* sentinel */ }
...@@ -152,7 +143,6 @@ static struct platform_driver lpc32xx_pwm_driver = { ...@@ -152,7 +143,6 @@ static struct platform_driver lpc32xx_pwm_driver = {
.of_match_table = lpc32xx_pwm_dt_ids, .of_match_table = lpc32xx_pwm_dt_ids,
}, },
.probe = lpc32xx_pwm_probe, .probe = lpc32xx_pwm_probe,
.remove = lpc32xx_pwm_remove,
}; };
module_platform_driver(lpc32xx_pwm_driver); module_platform_driver(lpc32xx_pwm_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment