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

pwm: twl-led: 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
c9bb1c9e a64a5853

+1 -16
+1 -16
drivers/pwm/pwm-twl-led.c
··· 276 276 static int twl_pwmled_probe(struct platform_device *pdev) 277 277 { 278 278 struct twl_pwmled_chip *twl; 279 - int ret; 280 279 281 280 twl = devm_kzalloc(&pdev->dev, sizeof(*twl), GFP_KERNEL); 282 281 if (!twl) ··· 293 294 294 295 mutex_init(&twl->mutex); 295 296 296 - ret = pwmchip_add(&twl->chip); 297 - if (ret < 0) 298 - return ret; 299 - 300 - platform_set_drvdata(pdev, twl); 301 - 302 - return 0; 303 - } 304 - 305 - static int twl_pwmled_remove(struct platform_device *pdev) 306 - { 307 - struct twl_pwmled_chip *twl = platform_get_drvdata(pdev); 308 - 309 - return pwmchip_remove(&twl->chip); 297 + return devm_pwmchip_add(&pdev->dev, &twl->chip); 310 298 } 311 299 312 300 #ifdef CONFIG_OF ··· 311 325 .of_match_table = of_match_ptr(twl_pwmled_of_match), 312 326 }, 313 327 .probe = twl_pwmled_probe, 314 - .remove = twl_pwmled_remove, 315 328 }; 316 329 module_platform_driver(twl_pwmled_driver); 317 330