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

rtc: stm32: 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: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250205-rtc-cleanup-v1-1-66165678e089@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Peng Fan and committed by
Alexandre Belloni
04572d18 72ce39bc

+2 -8
+2 -8
drivers/rtc/rtc-stm32.c
··· 1143 1143 goto err; 1144 1144 } 1145 1145 1146 - ret = device_init_wakeup(&pdev->dev, true); 1146 + ret = devm_device_init_wakeup(&pdev->dev); 1147 1147 if (ret) 1148 1148 goto err; 1149 1149 1150 - ret = dev_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm); 1150 + ret = devm_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm); 1151 1151 if (ret) 1152 1152 goto err; 1153 1153 ··· 1208 1208 if (rtc->data->need_dbp) 1209 1209 regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); 1210 1210 1211 - dev_pm_clear_wake_irq(&pdev->dev); 1212 - device_init_wakeup(&pdev->dev, false); 1213 - 1214 1211 return ret; 1215 1212 } 1216 1213 ··· 1234 1237 /* Enable backup domain write protection if needed */ 1235 1238 if (rtc->data->need_dbp) 1236 1239 regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); 1237 - 1238 - dev_pm_clear_wake_irq(&pdev->dev); 1239 - device_init_wakeup(&pdev->dev, false); 1240 1240 } 1241 1241 1242 1242 static int stm32_rtc_suspend(struct device *dev)