Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pwm: ab8500: 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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
14ac9e17 cf83f7b7

+1 -17
+1 -17
drivers/pwm/pwm-ab8500.c
··· 111 111 ab8500->chip.npwm = 1; 112 112 ab8500->hwid = pdev->id - 1; 113 113 114 - err = pwmchip_add(&ab8500->chip); 114 + err = devm_pwmchip_add(&pdev->dev, &ab8500->chip); 115 115 if (err < 0) 116 116 return dev_err_probe(&pdev->dev, err, "Failed to add pwm chip\n"); 117 117 118 118 dev_dbg(&pdev->dev, "pwm probe successful\n"); 119 - platform_set_drvdata(pdev, ab8500); 120 - 121 - return 0; 122 - } 123 - 124 - static int ab8500_pwm_remove(struct platform_device *pdev) 125 - { 126 - struct ab8500_pwm_chip *ab8500 = platform_get_drvdata(pdev); 127 - int err; 128 - 129 - err = pwmchip_remove(&ab8500->chip); 130 - if (err < 0) 131 - return err; 132 - 133 - dev_dbg(&pdev->dev, "pwm driver removed\n"); 134 119 135 120 return 0; 136 121 } ··· 125 140 .name = "ab8500-pwm", 126 141 }, 127 142 .probe = ab8500_pwm_probe, 128 - .remove = ab8500_pwm_remove, 129 143 }; 130 144 module_platform_driver(ab8500_pwm_driver); 131 145