aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-12-25 19:01:43 -0500
committerWim Van Sebroeck <wim@iguana.be>2015-12-29 14:36:03 -0500
commit756d1e9247dff6d416b0c9e073247f5e808bb5fa (patch)
tree2fd46296766a0249bfcd4722ec9e5d14c34cce43
parentb4ffb1909843b28f3b1b60197d517b123b7a9b66 (diff)
watchdog: da9052_wdt: Drop reference counting
Reference counting is now implemented in the watchdog core and no longer required in watchdog drivers. Since it was implememented a no-op, and since the local memory is allocated with devm_kzalloc(), the reference counting code in the driver really did not really work anyway, and this patch effectively fixes a bug which could cause a crash on unloading if the watchdog device was still open. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/da9052_wdt.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
index 67e67977bd29..2fc19a32a320 100644
--- a/drivers/watchdog/da9052_wdt.c
+++ b/drivers/watchdog/da9052_wdt.c
@@ -31,7 +31,6 @@
31struct da9052_wdt_data { 31struct da9052_wdt_data {
32 struct watchdog_device wdt; 32 struct watchdog_device wdt;
33 struct da9052 *da9052; 33 struct da9052 *da9052;
34 struct kref kref;
35 unsigned long jpast; 34 unsigned long jpast;
36}; 35};
37 36
@@ -51,10 +50,6 @@ static const struct {
51}; 50};
52 51
53 52
54static void da9052_wdt_release_resources(struct kref *r)
55{
56}
57
58static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev, 53static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
59 unsigned int timeout) 54 unsigned int timeout)
60{ 55{
@@ -104,20 +99,6 @@ static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
104 return 0; 99 return 0;
105} 100}
106 101
107static void da9052_wdt_ref(struct watchdog_device *wdt_dev)
108{
109 struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
110
111 kref_get(&driver_data->kref);
112}
113
114static void da9052_wdt_unref(struct watchdog_device *wdt_dev)
115{
116 struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
117
118 kref_put(&driver_data->kref, da9052_wdt_release_resources);
119}
120
121static int da9052_wdt_start(struct watchdog_device *wdt_dev) 102static int da9052_wdt_start(struct watchdog_device *wdt_dev)
122{ 103{
123 return da9052_wdt_set_timeout(wdt_dev, wdt_dev->timeout); 104 return da9052_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
@@ -170,8 +151,6 @@ static const struct watchdog_ops da9052_wdt_ops = {
170 .stop = da9052_wdt_stop, 151 .stop = da9052_wdt_stop,
171 .ping = da9052_wdt_ping, 152 .ping = da9052_wdt_ping,
172 .set_timeout = da9052_wdt_set_timeout, 153 .set_timeout = da9052_wdt_set_timeout,
173 .ref = da9052_wdt_ref,
174 .unref = da9052_wdt_unref,
175}; 154};
176 155
177 156
@@ -198,8 +177,6 @@ static int da9052_wdt_probe(struct platform_device *pdev)
198 da9052_wdt->parent = &pdev->dev; 177 da9052_wdt->parent = &pdev->dev;
199 watchdog_set_drvdata(da9052_wdt, driver_data); 178 watchdog_set_drvdata(da9052_wdt, driver_data);
200 179
201 kref_init(&driver_data->kref);
202
203 ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG, 180 ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
204 DA9052_CONTROLD_TWDSCALE, 0); 181 DA9052_CONTROLD_TWDSCALE, 0);
205 if (ret < 0) { 182 if (ret < 0) {
@@ -225,7 +202,6 @@ static int da9052_wdt_remove(struct platform_device *pdev)
225 struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev); 202 struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
226 203
227 watchdog_unregister_device(&driver_data->wdt); 204 watchdog_unregister_device(&driver_data->wdt);
228 kref_put(&driver_data->kref, da9052_wdt_release_resources);
229 205
230 return 0; 206 return 0;
231} 207}