011-2-fix-bld-errs-watchdog-da9052_wdt-Drop-reference-counting.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. 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/da9052_wdt.c | 24 ------------------------
  15. 1 file changed, 24 deletions(-)
  16. --- a/drivers/watchdog/da9052_wdt.c
  17. +++ b/drivers/watchdog/da9052_wdt.c
  18. @@ -31,7 +31,6 @@
  19. struct da9052_wdt_data {
  20. struct watchdog_device wdt;
  21. struct da9052 *da9052;
  22. - struct kref kref;
  23. unsigned long jpast;
  24. };
  25. @@ -51,10 +50,6 @@ static const struct {
  26. };
  27. -static void da9052_wdt_release_resources(struct kref *r)
  28. -{
  29. -}
  30. -
  31. static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
  32. unsigned int timeout)
  33. {
  34. @@ -104,20 +99,6 @@ static int da9052_wdt_set_timeout(struct
  35. return 0;
  36. }
  37. -static void da9052_wdt_ref(struct watchdog_device *wdt_dev)
  38. -{
  39. - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
  40. -
  41. - kref_get(&driver_data->kref);
  42. -}
  43. -
  44. -static void da9052_wdt_unref(struct watchdog_device *wdt_dev)
  45. -{
  46. - struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
  47. -
  48. - kref_put(&driver_data->kref, da9052_wdt_release_resources);
  49. -}
  50. -
  51. static int da9052_wdt_start(struct watchdog_device *wdt_dev)
  52. {
  53. return da9052_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
  54. @@ -170,8 +151,6 @@ static const struct watchdog_ops da9052_
  55. .stop = da9052_wdt_stop,
  56. .ping = da9052_wdt_ping,
  57. .set_timeout = da9052_wdt_set_timeout,
  58. - .ref = da9052_wdt_ref,
  59. - .unref = da9052_wdt_unref,
  60. };
  61. @@ -198,8 +177,6 @@ static int da9052_wdt_probe(struct platf
  62. da9052_wdt->parent = &pdev->dev;
  63. watchdog_set_drvdata(da9052_wdt, driver_data);
  64. - kref_init(&driver_data->kref);
  65. -
  66. ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
  67. DA9052_CONTROLD_TWDSCALE, 0);
  68. if (ret < 0) {
  69. @@ -225,7 +202,6 @@ static int da9052_wdt_remove(struct plat
  70. struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
  71. watchdog_unregister_device(&driver_data->wdt);
  72. - kref_put(&driver_data->kref, da9052_wdt_release_resources);
  73. return 0;
  74. }