501bd13636a79c4a2df4a5b24f3b176e9f6144f6
[openwrt/staging/zorun.git] /
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
5
6 Reference counting is now implemented in the watchdog core and no longer
7 required in watchdog drivers.
8
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.
13
14 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
15 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
16 ---
17 drivers/watchdog/da9052_wdt.c | 24 ------------------------
18 1 file changed, 24 deletions(-)
19
20 --- a/drivers/watchdog/da9052_wdt.c
21 +++ b/drivers/watchdog/da9052_wdt.c
22 @@ -31,7 +31,6 @@
23 struct da9052_wdt_data {
24 struct watchdog_device wdt;
25 struct da9052 *da9052;
26 - struct kref kref;
27 unsigned long jpast;
28 };
29
30 @@ -51,10 +50,6 @@ static const struct {
31 };
32
33
34 -static void da9052_wdt_release_resources(struct kref *r)
35 -{
36 -}
37 -
38 static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
39 unsigned int timeout)
40 {
41 @@ -104,20 +99,6 @@ static int da9052_wdt_set_timeout(struct
42 return 0;
43 }
44
45 -static void da9052_wdt_ref(struct watchdog_device *wdt_dev)
46 -{
47 - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
48 -
49 - kref_get(&driver_data->kref);
50 -}
51 -
52 -static void da9052_wdt_unref(struct watchdog_device *wdt_dev)
53 -{
54 - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
55 -
56 - kref_put(&driver_data->kref, da9052_wdt_release_resources);
57 -}
58 -
59 static int da9052_wdt_start(struct watchdog_device *wdt_dev)
60 {
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,
68 };
69
70
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);
74
75 - kref_init(&driver_data->kref);
76 -
77 ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
78 DA9052_CONTROLD_TWDSCALE, 0);
79 if (ret < 0) {
80 @@ -225,7 +202,6 @@ static int da9052_wdt_remove(struct plat
81 struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
82
83 watchdog_unregister_device(&driver_data->wdt);
84 - kref_put(&driver_data->kref, da9052_wdt_release_resources);
85
86 return 0;
87 }