diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 15:15:38 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 15:15:38 -0500 |
| commit | 6606b342febfd470b4a33acb73e360eeaca1d9bb (patch) | |
| tree | 2414cc2ca582aa34be6e6ed5c830658fbf21db41 /include/linux | |
| parent | a016af2e70bfca23f2f5de7d8708157b86ea374d (diff) | |
| parent | ac36856fe4321454b6789c019c96c3ec854094ed (diff) | |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
"This adds following items:
- watchdog restart handler support
- watchdog reboot notifier support
- watchdog sysfs attributes
- support for the following new devices: AMD Mullins platform, AMD
Carrizo platform, meson8b SoC, CSRatlas7, TS-4800, Alphascale
asm9260-wdt, Zodiac, Sigma Designs SMP86xx/SMP87xx
- Changes in refcounting for the watchdog core
- watchdog core improvements
- and small fixes"
* git://www.linux-watchdog.org/linux-watchdog: (60 commits)
watchdog: asm9260: remove __init and __exit annotations
watchdog: Drop pointer to watchdog device from struct watchdog_device
watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes
watchdog: Add support for creating driver specific sysfs attributes
watchdog: kill unref/ref ops
watchdog: stmp3xxx: Remove unused variables
watchdog: add MT7621 watchdog support
hwmon: (sch56xx) Drop watchdog driver data reference count callbacks
watchdog: da9055_wdt: Drop reference counting
watchdog: da9052_wdt: Drop reference counting
watchdog: Separate and maintain variables based on variable lifetime
watchdog: diag288: Stop re-using watchdog core internal flags
watchdog: Create watchdog device in watchdog_dev.c
watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device
watchdog: mena21: Do not use device pointer from struct watchdog_device
watchdog: gpio: Do not use device pointer from struct watchdog_device
watchdog: tangox: Print info message using pointer to platform device
watchdog: bcm2835_wdt: Drop log message if watchdog is stopped
devicetree: watchdog: add binding for Sigma Designs SMP8642 watchdog
watchdog: add support for Sigma Designs SMP86xx/SMP87xx
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bcm47xx_wdt.h | 3 | ||||
| -rw-r--r-- | include/linux/watchdog.h | 38 |
2 files changed, 23 insertions, 18 deletions
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h index 5582c211f594..8d9d07ec22a5 100644 --- a/include/linux/bcm47xx_wdt.h +++ b/include/linux/bcm47xx_wdt.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #ifndef LINUX_BCM47XX_WDT_H_ | 1 | #ifndef LINUX_BCM47XX_WDT_H_ |
| 2 | #define LINUX_BCM47XX_WDT_H_ | 2 | #define LINUX_BCM47XX_WDT_H_ |
| 3 | 3 | ||
| 4 | #include <linux/notifier.h> | ||
| 5 | #include <linux/timer.h> | 4 | #include <linux/timer.h> |
| 6 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 7 | #include <linux/watchdog.h> | 6 | #include <linux/watchdog.h> |
| @@ -15,8 +14,6 @@ struct bcm47xx_wdt { | |||
| 15 | void *driver_data; | 14 | void *driver_data; |
| 16 | 15 | ||
| 17 | struct watchdog_device wdd; | 16 | struct watchdog_device wdd; |
| 18 | struct notifier_block notifier; | ||
| 19 | struct notifier_block restart_handler; | ||
| 20 | 17 | ||
| 21 | struct timer_list soft_timer; | 18 | struct timer_list soft_timer; |
| 22 | atomic_t soft_ticks; | 19 | atomic_t soft_ticks; |
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 027b1f43f12d..b585fa2507ee 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
| @@ -12,10 +12,12 @@ | |||
| 12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
| 13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 14 | #include <linux/cdev.h> | 14 | #include <linux/cdev.h> |
| 15 | #include <linux/notifier.h> | ||
| 15 | #include <uapi/linux/watchdog.h> | 16 | #include <uapi/linux/watchdog.h> |
| 16 | 17 | ||
| 17 | struct watchdog_ops; | 18 | struct watchdog_ops; |
| 18 | struct watchdog_device; | 19 | struct watchdog_device; |
| 20 | struct watchdog_core_data; | ||
| 19 | 21 | ||
| 20 | /** struct watchdog_ops - The watchdog-devices operations | 22 | /** struct watchdog_ops - The watchdog-devices operations |
| 21 | * | 23 | * |
| @@ -26,8 +28,7 @@ struct watchdog_device; | |||
| 26 | * @status: The routine that shows the status of the watchdog device. | 28 | * @status: The routine that shows the status of the watchdog device. |
| 27 | * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds). | 29 | * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds). |
| 28 | * @get_timeleft:The routine that gets the time left before a reset (in seconds). | 30 | * @get_timeleft:The routine that gets the time left before a reset (in seconds). |
| 29 | * @ref: The ref operation for dyn. allocated watchdog_device structs | 31 | * @restart: The routine for restarting the machine. |
| 30 | * @unref: The unref operation for dyn. allocated watchdog_device structs | ||
| 31 | * @ioctl: The routines that handles extra ioctl calls. | 32 | * @ioctl: The routines that handles extra ioctl calls. |
| 32 | * | 33 | * |
| 33 | * The watchdog_ops structure contains a list of low-level operations | 34 | * The watchdog_ops structure contains a list of low-level operations |
| @@ -45,25 +46,26 @@ struct watchdog_ops { | |||
| 45 | unsigned int (*status)(struct watchdog_device *); | 46 | unsigned int (*status)(struct watchdog_device *); |
| 46 | int (*set_timeout)(struct watchdog_device *, unsigned int); | 47 | int (*set_timeout)(struct watchdog_device *, unsigned int); |
| 47 | unsigned int (*get_timeleft)(struct watchdog_device *); | 48 | unsigned int (*get_timeleft)(struct watchdog_device *); |
| 48 | void (*ref)(struct watchdog_device *); | 49 | int (*restart)(struct watchdog_device *); |
| 49 | void (*unref)(struct watchdog_device *); | ||
| 50 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); | 50 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | /** struct watchdog_device - The structure that defines a watchdog device | 53 | /** struct watchdog_device - The structure that defines a watchdog device |
| 54 | * | 54 | * |
| 55 | * @id: The watchdog's ID. (Allocated by watchdog_register_device) | 55 | * @id: The watchdog's ID. (Allocated by watchdog_register_device) |
| 56 | * @cdev: The watchdog's Character device. | ||
| 57 | * @dev: The device for our watchdog | ||
| 58 | * @parent: The parent bus device | 56 | * @parent: The parent bus device |
| 57 | * @groups: List of sysfs attribute groups to create when creating the | ||
| 58 | * watchdog device. | ||
| 59 | * @info: Pointer to a watchdog_info structure. | 59 | * @info: Pointer to a watchdog_info structure. |
| 60 | * @ops: Pointer to the list of watchdog operations. | 60 | * @ops: Pointer to the list of watchdog operations. |
| 61 | * @bootstatus: Status of the watchdog device at boot. | 61 | * @bootstatus: Status of the watchdog device at boot. |
| 62 | * @timeout: The watchdog devices timeout value (in seconds). | 62 | * @timeout: The watchdog devices timeout value (in seconds). |
| 63 | * @min_timeout:The watchdog devices minimum timeout value (in seconds). | 63 | * @min_timeout:The watchdog devices minimum timeout value (in seconds). |
| 64 | * @max_timeout:The watchdog devices maximum timeout value (in seconds). | 64 | * @max_timeout:The watchdog devices maximum timeout value (in seconds). |
| 65 | * @driver-data:Pointer to the drivers private data. | 65 | * @reboot_nb: The notifier block to stop watchdog on reboot. |
| 66 | * @lock: Lock for watchdog core internal use only. | 66 | * @restart_nb: The notifier block to register a restart function. |
| 67 | * @driver_data:Pointer to the drivers private data. | ||
| 68 | * @wd_data: Pointer to watchdog core internal data. | ||
| 67 | * @status: Field that contains the devices internal status bits. | 69 | * @status: Field that contains the devices internal status bits. |
| 68 | * @deferred: entry in wtd_deferred_reg_list which is used to | 70 | * @deferred: entry in wtd_deferred_reg_list which is used to |
| 69 | * register early initialized watchdogs. | 71 | * register early initialized watchdogs. |
| @@ -79,24 +81,23 @@ struct watchdog_ops { | |||
| 79 | */ | 81 | */ |
| 80 | struct watchdog_device { | 82 | struct watchdog_device { |
| 81 | int id; | 83 | int id; |
| 82 | struct cdev cdev; | ||
| 83 | struct device *dev; | ||
| 84 | struct device *parent; | 84 | struct device *parent; |
| 85 | const struct attribute_group **groups; | ||
| 85 | const struct watchdog_info *info; | 86 | const struct watchdog_info *info; |
| 86 | const struct watchdog_ops *ops; | 87 | const struct watchdog_ops *ops; |
| 87 | unsigned int bootstatus; | 88 | unsigned int bootstatus; |
| 88 | unsigned int timeout; | 89 | unsigned int timeout; |
| 89 | unsigned int min_timeout; | 90 | unsigned int min_timeout; |
| 90 | unsigned int max_timeout; | 91 | unsigned int max_timeout; |
| 92 | struct notifier_block reboot_nb; | ||
| 93 | struct notifier_block restart_nb; | ||
| 91 | void *driver_data; | 94 | void *driver_data; |
| 92 | struct mutex lock; | 95 | struct watchdog_core_data *wd_data; |
| 93 | unsigned long status; | 96 | unsigned long status; |
| 94 | /* Bit numbers for status flags */ | 97 | /* Bit numbers for status flags */ |
| 95 | #define WDOG_ACTIVE 0 /* Is the watchdog running/active */ | 98 | #define WDOG_ACTIVE 0 /* Is the watchdog running/active */ |
| 96 | #define WDOG_DEV_OPEN 1 /* Opened via /dev/watchdog ? */ | 99 | #define WDOG_NO_WAY_OUT 1 /* Is 'nowayout' feature set ? */ |
| 97 | #define WDOG_ALLOW_RELEASE 2 /* Did we receive the magic char ? */ | 100 | #define WDOG_STOP_ON_REBOOT 2 /* Should be stopped on reboot */ |
| 98 | #define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ | ||
| 99 | #define WDOG_UNREGISTERED 4 /* Has the device been unregistered */ | ||
| 100 | struct list_head deferred; | 101 | struct list_head deferred; |
| 101 | }; | 102 | }; |
| 102 | 103 | ||
| @@ -116,6 +117,12 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway | |||
| 116 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); | 117 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); |
| 117 | } | 118 | } |
| 118 | 119 | ||
| 120 | /* Use the following function to stop the watchdog on reboot */ | ||
| 121 | static inline void watchdog_stop_on_reboot(struct watchdog_device *wdd) | ||
| 122 | { | ||
| 123 | set_bit(WDOG_STOP_ON_REBOOT, &wdd->status); | ||
| 124 | } | ||
| 125 | |||
| 119 | /* Use the following function to check if a timeout value is invalid */ | 126 | /* Use the following function to check if a timeout value is invalid */ |
| 120 | static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) | 127 | static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) |
| 121 | { | 128 | { |
| @@ -142,6 +149,7 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd) | |||
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | /* drivers/watchdog/watchdog_core.c */ | 151 | /* drivers/watchdog/watchdog_core.c */ |
| 152 | void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); | ||
| 145 | extern int watchdog_init_timeout(struct watchdog_device *wdd, | 153 | extern int watchdog_init_timeout(struct watchdog_device *wdd, |
| 146 | unsigned int timeout_parm, struct device *dev); | 154 | unsigned int timeout_parm, struct device *dev); |
| 147 | extern int watchdog_register_device(struct watchdog_device *); | 155 | extern int watchdog_register_device(struct watchdog_device *); |
