Skip to content

Commit 9767db3

Browse files
author
Uwe Kleine-König
committed
pwm: vt8500: 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 vt8500_chip::chip. Link: https://lore.kernel.org/r/7d903b608609d46cf1ee1e06530f516f42af1ebb.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 58803ad commit 9767db3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/pwm/pwm-vt8500.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ MODULE_DEVICE_TABLE(of, vt8500_pwm_dt_ids);
232232

233233
static int vt8500_pwm_probe(struct platform_device *pdev)
234234
{
235+
struct pwm_chip *chip;
235236
struct vt8500_chip *vt8500;
236237
struct device_node *np = pdev->dev.of_node;
237238
int ret;
@@ -243,9 +244,10 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
243244
if (vt8500 == NULL)
244245
return -ENOMEM;
245246

246-
vt8500->chip.dev = &pdev->dev;
247-
vt8500->chip.ops = &vt8500_pwm_ops;
248-
vt8500->chip.npwm = VT8500_NR_PWMS;
247+
chip = &vt8500->chip;
248+
chip->dev = &pdev->dev;
249+
chip->ops = &vt8500_pwm_ops;
250+
chip->npwm = VT8500_NR_PWMS;
249251

250252
vt8500->clk = devm_clk_get_prepared(&pdev->dev, NULL);
251253
if (IS_ERR(vt8500->clk))
@@ -255,7 +257,7 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
255257
if (IS_ERR(vt8500->base))
256258
return PTR_ERR(vt8500->base);
257259

258-
ret = devm_pwmchip_add(&pdev->dev, &vt8500->chip);
260+
ret = devm_pwmchip_add(&pdev->dev, chip);
259261
if (ret < 0)
260262
return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n");
261263

0 commit comments

Comments
 (0)