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

rtc: ab8500: Use resource managed API to simplify code

Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250205-rtc-cleanup-v1-5-66165678e089@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Peng Fan and committed by
Alexandre Belloni
ca36c930 e8a0b6e6

+2 -9
+2 -9
drivers/rtc/rtc-ab8500.c
··· 361 361 return -ENODEV; 362 362 } 363 363 364 - device_init_wakeup(&pdev->dev, true); 364 + devm_device_init_wakeup(&pdev->dev); 365 365 366 366 rtc = devm_rtc_allocate_device(&pdev->dev); 367 367 if (IS_ERR(rtc)) ··· 375 375 if (err < 0) 376 376 return err; 377 377 378 - dev_pm_set_wake_irq(&pdev->dev, irq); 378 + devm_pm_set_wake_irq(&pdev->dev, irq); 379 379 platform_set_drvdata(pdev, rtc); 380 380 381 381 set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features); ··· 392 392 return devm_rtc_register_device(rtc); 393 393 } 394 394 395 - static void ab8500_rtc_remove(struct platform_device *pdev) 396 - { 397 - dev_pm_clear_wake_irq(&pdev->dev); 398 - device_init_wakeup(&pdev->dev, false); 399 - } 400 - 401 395 static struct platform_driver ab8500_rtc_driver = { 402 396 .driver = { 403 397 .name = "ab8500-rtc", 404 398 }, 405 399 .probe = ab8500_rtc_probe, 406 - .remove = ab8500_rtc_remove, 407 400 .id_table = ab85xx_rtc_ids, 408 401 }; 409 402