011-3-fix-bld-errs-watchdog-da9055_wdt-Drop-reference-counting.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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
  5. Reference counting is now implemented in the watchdog core and no longer
  6. required in watchdog drivers.
  7. Since it was implememented a no-op, and since the local memory is allocated
  8. with devm_kzalloc(), the reference counting code in the driver really did
  9. not really work anyway, and this patch effectively fixes a bug which could
  10. cause a crash on unloading if the watchdog device was still open.
  11. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  12. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  13. ---
  14. drivers/watchdog/da9055_wdt.c | 24 ------------------------
  15. 1 file changed, 24 deletions(-)
  16. --- a/drivers/watchdog/da9055_wdt.c
  17. +++ b/drivers/watchdog/da9055_wdt.c
  18. @@ -35,7 +35,6 @@ MODULE_PARM_DESC(nowayout,
  19. struct da9055_wdt_data {
  20. struct watchdog_device wdt;
  21. struct da9055 *da9055;
  22. - struct kref kref;
  23. };
  24. static const struct {
  25. @@ -99,24 +98,6 @@ static int da9055_wdt_ping(struct watchd
  26. DA9055_WATCHDOG_MASK, 1);
  27. }
  28. -static void da9055_wdt_release_resources(struct kref *r)
  29. -{
  30. -}
  31. -
  32. -static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
  33. -{
  34. - struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
  35. -
  36. - kref_get(&driver_data->kref);
  37. -}
  38. -
  39. -static void da9055_wdt_unref(struct watchdog_device *wdt_dev)
  40. -{
  41. - struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
  42. -
  43. - kref_put(&driver_data->kref, da9055_wdt_release_resources);
  44. -}
  45. -
  46. static int da9055_wdt_start(struct watchdog_device *wdt_dev)
  47. {
  48. return da9055_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
  49. @@ -138,8 +119,6 @@ static const struct watchdog_ops da9055_
  50. .stop = da9055_wdt_stop,
  51. .ping = da9055_wdt_ping,
  52. .set_timeout = da9055_wdt_set_timeout,
  53. - .ref = da9055_wdt_ref,
  54. - .unref = da9055_wdt_unref,
  55. };
  56. static int da9055_wdt_probe(struct platform_device *pdev)
  57. @@ -165,8 +144,6 @@ static int da9055_wdt_probe(struct platf
  58. watchdog_set_nowayout(da9055_wdt, nowayout);
  59. watchdog_set_drvdata(da9055_wdt, driver_data);
  60. - kref_init(&driver_data->kref);
  61. -
  62. ret = da9055_wdt_stop(da9055_wdt);
  63. if (ret < 0) {
  64. dev_err(&pdev->dev, "Failed to stop watchdog, %d\n", ret);
  65. @@ -189,7 +166,6 @@ static int da9055_wdt_remove(struct plat
  66. struct da9055_wdt_data *driver_data = platform_get_drvdata(pdev);
  67. watchdog_unregister_device(&driver_data->wdt);
  68. - kref_put(&driver_data->kref, da9055_wdt_release_resources);
  69. return 0;
  70. }