hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/watchdog/wm831x_wdt.c
....@@ -13,7 +13,6 @@
1313 #include <linux/platform_device.h>
1414 #include <linux/watchdog.h>
1515 #include <linux/uaccess.h>
16
-#include <linux/gpio.h>
1716
1817 #include <linux/mfd/wm831x/core.h>
1918 #include <linux/mfd/wm831x/pdata.h>
....@@ -29,7 +28,6 @@
2928 struct watchdog_device wdt;
3029 struct wm831x *wm831x;
3130 struct mutex lock;
32
- int update_gpio;
3331 int update_state;
3432 };
3533
....@@ -103,14 +101,6 @@
103101
104102 mutex_lock(&driver_data->lock);
105103
106
- if (driver_data->update_gpio) {
107
- gpio_set_value_cansleep(driver_data->update_gpio,
108
- driver_data->update_state);
109
- driver_data->update_state = !driver_data->update_state;
110
- ret = 0;
111
- goto out;
112
- }
113
-
114104 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
115105
116106 if (!(reg & WM831X_WDOG_RST_SRC)) {
....@@ -180,8 +170,9 @@
180170
181171 static int wm831x_wdt_probe(struct platform_device *pdev)
182172 {
183
- struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
184
- struct wm831x_pdata *chip_pdata = dev_get_platdata(pdev->dev.parent);
173
+ struct device *dev = &pdev->dev;
174
+ struct wm831x *wm831x = dev_get_drvdata(dev->parent);
175
+ struct wm831x_pdata *chip_pdata = dev_get_platdata(dev->parent);
185176 struct wm831x_watchdog_pdata *pdata;
186177 struct wm831x_wdt_drvdata *driver_data;
187178 struct watchdog_device *wm831x_wdt;
....@@ -198,8 +189,7 @@
198189 if (reg & WM831X_WDOG_DEBUG)
199190 dev_warn(wm831x->dev, "Watchdog is paused\n");
200191
201
- driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data),
202
- GFP_KERNEL);
192
+ driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL);
203193 if (!driver_data)
204194 return -ENOMEM;
205195
....@@ -210,7 +200,7 @@
210200
211201 wm831x_wdt->info = &wm831x_wdt_info;
212202 wm831x_wdt->ops = &wm831x_wdt_ops;
213
- wm831x_wdt->parent = &pdev->dev;
203
+ wm831x_wdt->parent = dev;
214204 watchdog_set_nowayout(wm831x_wdt, nowayout);
215205 watchdog_set_drvdata(wm831x_wdt, driver_data);
216206
....@@ -239,24 +229,6 @@
239229 reg |= pdata->secondary << WM831X_WDOG_SECACT_SHIFT;
240230 reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT;
241231
242
- if (pdata->update_gpio) {
243
- ret = devm_gpio_request_one(&pdev->dev,
244
- pdata->update_gpio,
245
- GPIOF_OUT_INIT_LOW,
246
- "Watchdog update");
247
- if (ret < 0) {
248
- dev_err(wm831x->dev,
249
- "Failed to request update GPIO: %d\n",
250
- ret);
251
- return ret;
252
- }
253
-
254
- driver_data->update_gpio = pdata->update_gpio;
255
-
256
- /* Make sure the watchdog takes hardware updates */
257
- reg |= WM831X_WDOG_RST_SRC;
258
- }
259
-
260232 ret = wm831x_reg_unlock(wm831x);
261233 if (ret == 0) {
262234 ret = wm831x_reg_write(wm831x, WM831X_WATCHDOG, reg);
....@@ -268,14 +240,7 @@
268240 }
269241 }
270242
271
- ret = devm_watchdog_register_device(&pdev->dev, &driver_data->wdt);
272
- if (ret != 0) {
273
- dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n",
274
- ret);
275
- return ret;
276
- }
277
-
278
- return 0;
243
+ return devm_watchdog_register_device(dev, &driver_data->wdt);
279244 }
280245
281246 static struct platform_driver wm831x_wdt_driver = {