hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/watchdog/xen_wdt.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Xen Watchdog Driver
34 *
45 * (c) Copyright 2010 Novell, Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
106 */
117
128 #define DRV_NAME "xen_wdt"
....@@ -122,35 +118,31 @@
122118
123119 static int xen_wdt_probe(struct platform_device *pdev)
124120 {
121
+ struct device *dev = &pdev->dev;
125122 struct sched_watchdog wd = { .id = ~0 };
126123 int ret = HYPERVISOR_sched_op(SCHEDOP_watchdog, &wd);
127124
128125 if (ret == -ENOSYS) {
129
- dev_err(&pdev->dev, "watchdog not supported by hypervisor\n");
126
+ dev_err(dev, "watchdog not supported by hypervisor\n");
130127 return -ENODEV;
131128 }
132129
133130 if (ret != -EINVAL) {
134
- dev_err(&pdev->dev, "unexpected hypervisor error (%d)\n", ret);
131
+ dev_err(dev, "unexpected hypervisor error (%d)\n", ret);
135132 return -ENODEV;
136133 }
137134
138
- if (watchdog_init_timeout(&xen_wdt_dev, timeout, NULL))
139
- dev_info(&pdev->dev, "timeout value invalid, using %d\n",
140
- xen_wdt_dev.timeout);
135
+ watchdog_init_timeout(&xen_wdt_dev, timeout, NULL);
141136 watchdog_set_nowayout(&xen_wdt_dev, nowayout);
142137 watchdog_stop_on_reboot(&xen_wdt_dev);
143138 watchdog_stop_on_unregister(&xen_wdt_dev);
144139
145
- ret = devm_watchdog_register_device(&pdev->dev, &xen_wdt_dev);
146
- if (ret) {
147
- dev_err(&pdev->dev, "cannot register watchdog device (%d)\n",
148
- ret);
140
+ ret = devm_watchdog_register_device(dev, &xen_wdt_dev);
141
+ if (ret)
149142 return ret;
150
- }
151143
152
- dev_info(&pdev->dev, "initialized (timeout=%ds, nowayout=%d)\n",
153
- xen_wdt_dev.timeout, nowayout);
144
+ dev_info(dev, "initialized (timeout=%ds, nowayout=%d)\n",
145
+ xen_wdt_dev.timeout, nowayout);
154146
155147 return 0;
156148 }