hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/watchdog/stmp3xxx_rtc_wdt.c
....@@ -89,31 +89,29 @@
8989
9090 static int stmp3xxx_wdt_probe(struct platform_device *pdev)
9191 {
92
+ struct device *dev = &pdev->dev;
9293 int ret;
9394
94
- watchdog_set_drvdata(&stmp3xxx_wdd, &pdev->dev);
95
+ watchdog_set_drvdata(&stmp3xxx_wdd, dev);
9596
9697 stmp3xxx_wdd.timeout = clamp_t(unsigned, heartbeat, 1, STMP3XXX_MAX_TIMEOUT);
97
- stmp3xxx_wdd.parent = &pdev->dev;
98
+ stmp3xxx_wdd.parent = dev;
9899
99
- ret = watchdog_register_device(&stmp3xxx_wdd);
100
- if (ret < 0) {
101
- dev_err(&pdev->dev, "cannot register watchdog device\n");
100
+ ret = devm_watchdog_register_device(dev, &stmp3xxx_wdd);
101
+ if (ret < 0)
102102 return ret;
103
- }
104103
105104 if (register_reboot_notifier(&wdt_notifier))
106
- dev_warn(&pdev->dev, "cannot register reboot notifier\n");
105
+ dev_warn(dev, "cannot register reboot notifier\n");
107106
108
- dev_info(&pdev->dev, "initialized watchdog with heartbeat %ds\n",
109
- stmp3xxx_wdd.timeout);
107
+ dev_info(dev, "initialized watchdog with heartbeat %ds\n",
108
+ stmp3xxx_wdd.timeout);
110109 return 0;
111110 }
112111
113112 static int stmp3xxx_wdt_remove(struct platform_device *pdev)
114113 {
115114 unregister_reboot_notifier(&wdt_notifier);
116
- watchdog_unregister_device(&stmp3xxx_wdd);
117115 return 0;
118116 }
119117