1 From 43f676ace2e0591718ff493d290bc49b35ec2ffc Mon Sep 17 00:00:00 2001
2 From: Guenter Roeck <linux@roeck-us.net>
3 Date: Fri, 25 Dec 2015 16:01:44 -0800
4 Subject: watchdog: da9055_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/da9055_wdt.c | 24 ------------------------
18 1 file changed, 24 deletions(-)
20 --- a/drivers/watchdog/da9055_wdt.c
21 +++ b/drivers/watchdog/da9055_wdt.c
22 @@ -35,7 +35,6 @@ MODULE_PARM_DESC(nowayout,
23 struct da9055_wdt_data {
24 struct watchdog_device wdt;
25 struct da9055 *da9055;
30 @@ -99,24 +98,6 @@ static int da9055_wdt_ping(struct watchd
31 DA9055_WATCHDOG_MASK, 1);
34 -static void da9055_wdt_release_resources(struct kref *r)
38 -static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
40 - struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
42 - kref_get(&driver_data->kref);
45 -static void da9055_wdt_unref(struct watchdog_device *wdt_dev)
47 - struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
49 - kref_put(&driver_data->kref, da9055_wdt_release_resources);
52 static int da9055_wdt_start(struct watchdog_device *wdt_dev)
54 return da9055_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
55 @@ -138,8 +119,6 @@ static const struct watchdog_ops da9055_
56 .stop = da9055_wdt_stop,
57 .ping = da9055_wdt_ping,
58 .set_timeout = da9055_wdt_set_timeout,
59 - .ref = da9055_wdt_ref,
60 - .unref = da9055_wdt_unref,
63 static int da9055_wdt_probe(struct platform_device *pdev)
64 @@ -165,8 +144,6 @@ static int da9055_wdt_probe(struct platf
65 watchdog_set_nowayout(da9055_wdt, nowayout);
66 watchdog_set_drvdata(da9055_wdt, driver_data);
68 - kref_init(&driver_data->kref);
70 ret = da9055_wdt_stop(da9055_wdt);
72 dev_err(&pdev->dev, "Failed to stop watchdog, %d\n", ret);
73 @@ -189,7 +166,6 @@ static int da9055_wdt_remove(struct plat
74 struct da9055_wdt_data *driver_data = platform_get_drvdata(pdev);
76 watchdog_unregister_device(&driver_data->wdt);
77 - kref_put(&driver_data->kref, da9055_wdt_release_resources);