011-1-fix-bld-errs-hwmon-sch56xx-Drop-watchdog-driver-data-reference-count-callbacks.patch 2.8 KB

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