.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Xen Watchdog Driver |
---|
3 | 4 | * |
---|
4 | 5 | * (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. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #define DRV_NAME "xen_wdt" |
---|
.. | .. |
---|
122 | 118 | |
---|
123 | 119 | static int xen_wdt_probe(struct platform_device *pdev) |
---|
124 | 120 | { |
---|
| 121 | + struct device *dev = &pdev->dev; |
---|
125 | 122 | struct sched_watchdog wd = { .id = ~0 }; |
---|
126 | 123 | int ret = HYPERVISOR_sched_op(SCHEDOP_watchdog, &wd); |
---|
127 | 124 | |
---|
128 | 125 | if (ret == -ENOSYS) { |
---|
129 | | - dev_err(&pdev->dev, "watchdog not supported by hypervisor\n"); |
---|
| 126 | + dev_err(dev, "watchdog not supported by hypervisor\n"); |
---|
130 | 127 | return -ENODEV; |
---|
131 | 128 | } |
---|
132 | 129 | |
---|
133 | 130 | if (ret != -EINVAL) { |
---|
134 | | - dev_err(&pdev->dev, "unexpected hypervisor error (%d)\n", ret); |
---|
| 131 | + dev_err(dev, "unexpected hypervisor error (%d)\n", ret); |
---|
135 | 132 | return -ENODEV; |
---|
136 | 133 | } |
---|
137 | 134 | |
---|
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); |
---|
141 | 136 | watchdog_set_nowayout(&xen_wdt_dev, nowayout); |
---|
142 | 137 | watchdog_stop_on_reboot(&xen_wdt_dev); |
---|
143 | 138 | watchdog_stop_on_unregister(&xen_wdt_dev); |
---|
144 | 139 | |
---|
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) |
---|
149 | 142 | return ret; |
---|
150 | | - } |
---|
151 | 143 | |
---|
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); |
---|
154 | 146 | |
---|
155 | 147 | return 0; |
---|
156 | 148 | } |
---|