Commit 96af28dc authored by Uwe Kleine-König's avatar Uwe Kleine-König

pwm: ab8500: Introduce a local pwm_chip variable in .probe()

This simplifies converting the driver to pwmchip_alloc() as there is only
a single code line left that makes use of struct ab8500_pwm_chip::chip.

Link: https://lore.kernel.org/r/7fae4833b97728abc8bd400663fdd331c86a761b.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent ddabe909
...@@ -185,6 +185,7 @@ static const struct pwm_ops ab8500_pwm_ops = { ...@@ -185,6 +185,7 @@ static const struct pwm_ops ab8500_pwm_ops = {
static int ab8500_pwm_probe(struct platform_device *pdev) static int ab8500_pwm_probe(struct platform_device *pdev)
{ {
struct pwm_chip *chip;
struct ab8500_pwm_chip *ab8500; struct ab8500_pwm_chip *ab8500;
int err; int err;
...@@ -199,12 +200,13 @@ static int ab8500_pwm_probe(struct platform_device *pdev) ...@@ -199,12 +200,13 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
if (ab8500 == NULL) if (ab8500 == NULL)
return -ENOMEM; return -ENOMEM;
ab8500->chip.dev = &pdev->dev; chip = &ab8500->chip;
ab8500->chip.ops = &ab8500_pwm_ops; chip->dev = &pdev->dev;
ab8500->chip.npwm = 1; chip->ops = &ab8500_pwm_ops;
chip->npwm = 1;
ab8500->hwid = pdev->id - 1; ab8500->hwid = pdev->id - 1;
err = devm_pwmchip_add(&pdev->dev, &ab8500->chip); err = devm_pwmchip_add(&pdev->dev, chip);
if (err < 0) if (err < 0)
return dev_err_probe(&pdev->dev, err, "Failed to add pwm chip\n"); return dev_err_probe(&pdev->dev, err, "Failed to add pwm chip\n");
......
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