c78202b3257d28093902ce373e20a42b26dc44ab
[openwrt/staging/stintel.git] /
1 From 3b8d058cfe6a3b14abee324f4c4b33e64bf61aeb Mon Sep 17 00:00:00 2001
2 From: Guenter Roeck <linux@roeck-us.net>
3 Date: Fri, 25 Dec 2015 16:01:45 -0800
4 Subject: hwmon: (sch56xx) Drop watchdog driver data reference count callbacks
5
6 Reference counting is now implemented in the watchdog core and no longer
7 required in watchdog drivers.
8
9 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
10 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
11 ---
12 drivers/hwmon/sch56xx-common.c | 31 +------------------------------
13 1 file changed, 1 insertion(+), 30 deletions(-)
14
15 --- a/drivers/hwmon/sch56xx-common.c
16 +++ b/drivers/hwmon/sch56xx-common.c
17 @@ -30,7 +30,6 @@
18 #include <linux/watchdog.h>
19 #include <linux/miscdevice.h>
20 #include <linux/uaccess.h>
21 -#include <linux/kref.h>
22 #include <linux/slab.h>
23 #include "sch56xx-common.h"
24
25 @@ -67,7 +66,6 @@ MODULE_PARM_DESC(nowayout, "Watchdog can
26 struct sch56xx_watchdog_data {
27 u16 addr;
28 struct mutex *io_lock;
29 - struct kref kref;
30 struct watchdog_info wdinfo;
31 struct watchdog_device wddev;
32 u8 watchdog_preset;
33 @@ -258,15 +256,6 @@ EXPORT_SYMBOL(sch56xx_read_virtual_reg12
34 * Watchdog routines
35 */
36
37 -/* Release our data struct when we're unregistered *and*
38 - all references to our watchdog device are released */
39 -static void watchdog_release_resources(struct kref *r)
40 -{
41 - struct sch56xx_watchdog_data *data =
42 - container_of(r, struct sch56xx_watchdog_data, kref);
43 - kfree(data);
44 -}
45 -
46 static int watchdog_set_timeout(struct watchdog_device *wddev,
47 unsigned int timeout)
48 {
49 @@ -395,28 +384,12 @@ static int watchdog_stop(struct watchdog
50 return 0;
51 }
52
53 -static void watchdog_ref(struct watchdog_device *wddev)
54 -{
55 - struct sch56xx_watchdog_data *data = watchdog_get_drvdata(wddev);
56 -
57 - kref_get(&data->kref);
58 -}
59 -
60 -static void watchdog_unref(struct watchdog_device *wddev)
61 -{
62 - struct sch56xx_watchdog_data *data = watchdog_get_drvdata(wddev);
63 -
64 - kref_put(&data->kref, watchdog_release_resources);
65 -}
66 -
67 static const struct watchdog_ops watchdog_ops = {
68 .owner = THIS_MODULE,
69 .start = watchdog_start,
70 .stop = watchdog_stop,
71 .ping = watchdog_trigger,
72 .set_timeout = watchdog_set_timeout,
73 - .ref = watchdog_ref,
74 - .unref = watchdog_unref,
75 };
76
77 struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent,
78 @@ -448,7 +421,6 @@ struct sch56xx_watchdog_data *sch56xx_wa
79
80 data->addr = addr;
81 data->io_lock = io_lock;
82 - kref_init(&data->kref);
83
84 strlcpy(data->wdinfo.identity, "sch56xx watchdog",
85 sizeof(data->wdinfo.identity));
86 @@ -494,8 +466,7 @@ EXPORT_SYMBOL(sch56xx_watchdog_register)
87 void sch56xx_watchdog_unregister(struct sch56xx_watchdog_data *data)
88 {
89 watchdog_unregister_device(&data->wddev);
90 - kref_put(&data->kref, watchdog_release_resources);
91 - /* Don't touch data after this it may have been free-ed! */
92 + kfree(data);
93 }
94 EXPORT_SYMBOL(sch56xx_watchdog_unregister);
95