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

pwm: mediatek: 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
e0150252 da68a9f4

+1 -11
+1 -11
drivers/pwm/pwm-mediatek.c
··· 253 253 } 254 254 } 255 255 256 - platform_set_drvdata(pdev, pc); 257 - 258 256 pc->chip.dev = &pdev->dev; 259 257 pc->chip.ops = &pwm_mediatek_ops; 260 258 pc->chip.npwm = pc->soc->num_pwms; 261 259 262 - ret = pwmchip_add(&pc->chip); 260 + ret = devm_pwmchip_add(&pdev->dev, &pc->chip); 263 261 if (ret < 0) { 264 262 dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); 265 263 return ret; 266 264 } 267 265 268 266 return 0; 269 - } 270 - 271 - static int pwm_mediatek_remove(struct platform_device *pdev) 272 - { 273 - struct pwm_mediatek_chip *pc = platform_get_drvdata(pdev); 274 - 275 - return pwmchip_remove(&pc->chip); 276 267 } 277 268 278 269 static const struct pwm_mediatek_of_data mt2712_pwm_data = { ··· 326 335 .of_match_table = pwm_mediatek_of_match, 327 336 }, 328 337 .probe = pwm_mediatek_probe, 329 - .remove = pwm_mediatek_remove, 330 338 }; 331 339 module_platform_driver(pwm_mediatek_driver); 332 340