1 From 756d1e9247dff6d416b0c9e073247f5e808bb5fa Mon Sep 17 00:00:00 2001
2 From: Guenter Roeck <linux@roeck-us.net>
3 Date: Fri, 25 Dec 2015 16:01:43 -0800
4 Subject: watchdog: da9052_wdt: Drop reference counting
6 Reference counting is now implemented in the watchdog core and no longer
7 required in watchdog drivers.
9 Since it was implememented a no-op, and since the local memory is allocated
10 with devm_kzalloc(), the reference counting code in the driver really did
11 not really work anyway, and this patch effectively fixes a bug which could
12 cause a crash on unloading if the watchdog device was still open.
14 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
15 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
17 drivers/watchdog/da9052_wdt.c | 24 ------------------------
18 1 file changed, 24 deletions(-)
20 --- a/drivers/watchdog/da9052_wdt.c
21 +++ b/drivers/watchdog/da9052_wdt.c
23 struct da9052_wdt_data {
24 struct watchdog_device wdt;
25 struct da9052 *da9052;
30 @@ -51,10 +50,6 @@ static const struct {
34 -static void da9052_wdt_release_resources(struct kref *r)
38 static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
41 @@ -104,20 +99,6 @@ static int da9052_wdt_set_timeout(struct
45 -static void da9052_wdt_ref(struct watchdog_device *wdt_dev)
47 - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
49 - kref_get(&driver_data->kref);
52 -static void da9052_wdt_unref(struct watchdog_device *wdt_dev)
54 - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
56 - kref_put(&driver_data->kref, da9052_wdt_release_resources);
59 static int da9052_wdt_start(struct watchdog_device *wdt_dev)
61 return da9052_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
62 @@ -170,8 +151,6 @@ static const struct watchdog_ops da9052_
63 .stop = da9052_wdt_stop,
64 .ping = da9052_wdt_ping,
65 .set_timeout = da9052_wdt_set_timeout,
66 - .ref = da9052_wdt_ref,
67 - .unref = da9052_wdt_unref,
71 @@ -198,8 +177,6 @@ static int da9052_wdt_probe(struct platf
72 da9052_wdt->parent = &pdev->dev;
73 watchdog_set_drvdata(da9052_wdt, driver_data);
75 - kref_init(&driver_data->kref);
77 ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
78 DA9052_CONTROLD_TWDSCALE, 0);
80 @@ -225,7 +202,6 @@ static int da9052_wdt_remove(struct plat
81 struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
83 watchdog_unregister_device(&driver_data->wdt);
84 - kref_put(&driver_data->kref, da9052_wdt_release_resources);