Skip to content

Commit

Permalink
pwm: clps711x: Simplify using devm_pwmchip_add()
Browse files Browse the repository at this point in the history
With devm_pwmchip_add() we can drop pwmchip_remove() from the device
remove callback. The latter can then go away, too and as this is the
only user of platform_get_drvdata(), the respective call to
platform_set_drvdata() can go, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Uwe Kleine-König authored and Thierry Reding committed Jun 28, 2021
1 parent f41227e commit 9c6a02e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/pwm/pwm-clps711x.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,7 @@ static int clps711x_pwm_probe(struct platform_device *pdev)

spin_lock_init(&priv->lock);

platform_set_drvdata(pdev, priv);

return pwmchip_add(&priv->chip);
}

static int clps711x_pwm_remove(struct platform_device *pdev)
{
struct clps711x_chip *priv = platform_get_drvdata(pdev);

return pwmchip_remove(&priv->chip);
return devm_pwmchip_add(&pdev->dev, &priv->chip);
}

static const struct of_device_id __maybe_unused clps711x_pwm_dt_ids[] = {
Expand All @@ -158,7 +149,6 @@ static struct platform_driver clps711x_pwm_driver = {
.of_match_table = of_match_ptr(clps711x_pwm_dt_ids),
},
.probe = clps711x_pwm_probe,
.remove = clps711x_pwm_remove,
};
module_platform_driver(clps711x_pwm_driver);

Expand Down

0 comments on commit 9c6a02e

Please sign in to comment.