Skip to content

Commit ff4bcd5

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: renesas-tpu: Make use of devm functions
This simplifies an error path in .probe() and allows to drop the .remove() function. Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 6eb3af7 commit ff4bcd5

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

drivers/pwm/pwm-renesas-tpu.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -408,24 +408,13 @@ static int tpu_probe(struct platform_device *pdev)
408408
tpu->chip.ops = &tpu_pwm_ops;
409409
tpu->chip.npwm = TPU_CHANNEL_MAX;
410410

411-
pm_runtime_enable(&pdev->dev);
411+
ret = devm_pm_runtime_enable(&pdev->dev);
412+
if (ret < 0)
413+
return dev_err_probe(&pdev->dev, ret, "Failed to enable runtime PM\n");
412414

413-
ret = pwmchip_add(&tpu->chip);
414-
if (ret < 0) {
415-
pm_runtime_disable(&pdev->dev);
415+
ret = devm_pwmchip_add(&pdev->dev, &tpu->chip);
416+
if (ret < 0)
416417
return dev_err_probe(&pdev->dev, ret, "Failed to register PWM chip\n");
417-
}
418-
419-
return 0;
420-
}
421-
422-
static int tpu_remove(struct platform_device *pdev)
423-
{
424-
struct tpu_device *tpu = platform_get_drvdata(pdev);
425-
426-
pwmchip_remove(&tpu->chip);
427-
428-
pm_runtime_disable(&pdev->dev);
429418

430419
return 0;
431420
}
@@ -444,7 +433,6 @@ MODULE_DEVICE_TABLE(of, tpu_of_table);
444433

445434
static struct platform_driver tpu_driver = {
446435
.probe = tpu_probe,
447-
.remove = tpu_remove,
448436
.driver = {
449437
.name = "renesas-tpu-pwm",
450438
.of_match_table = of_match_ptr(tpu_of_table),

0 commit comments

Comments
 (0)