mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 22:08:33 -04:00
Merge git://www.linux-watchdog.org/linux-watchdog
Pull second set of watchdog updates from Wim Van Sebroeck:
"This changeset contains following changes:
* Add support for multiple watchdog devices. We use dynamically
allocated device id's for this.
* Add locking into the generic watchdog infrastructure.
* Add support for dynamically allocated watchdog_device structs so
that we can deal with devices that get unbound.
* convert following drivers to the generic watchdog framework:
sch5627, sch5636 and sp805_wdt.
* Add DA9052/53 PMIC watchdog support
* Fix printk format warnings for iTCO_wdt.c"
* git://www.linux-watchdog.org/linux-watchdog:
watchdog: iTCO_wdt.c: fix printk format warnings
watchdog: sp805_wdt: Add clk_{un}prepare support
watchdog: sp805_wdt: convert to watchdog core
hwmon/sch56xx: Depend on watchdog for watchdog core functions
watchdog: sch56xx-common: set correct bits in register()
Watchdog: DA9052/53 PMIC watchdog support
watchdog: sch56xx-common: Add proper ref-counting of watchdog data
watchdog: sch56xx: Remove unnecessary checks for register changes
watchdog: sch56xx: Use watchdog core
watchdog: Add support for dynamically allocated watchdog_device structs
watchdog: Add Locking support
watchdog: watchdog_dev: Rewrite wrapper code
watchdog: use dev_ functions
watchdog: create all the proper device files
watchdog: Add a flag to indicate the watchdog doesn't reboot things
watchdog: Add multiple device support
watchdog: watchdog_core.h: make functions extern
watchdog: correct the name of the watchdog_core inlude file
watchdog: Add watchdog_active() routine
watchdog: watchdog_dev: include private header to pickup global symbol prototypes
This commit is contained in:
@@ -45,6 +45,8 @@ struct watchdog_info {
|
||||
#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
|
||||
#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
|
||||
#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
|
||||
#define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or
|
||||
other external alarm not a reboot */
|
||||
#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
|
||||
|
||||
#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
|
||||
@@ -54,6 +56,8 @@ struct watchdog_info {
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/cdev.h>
|
||||
|
||||
struct watchdog_ops;
|
||||
struct watchdog_device;
|
||||
@@ -67,6 +71,8 @@ struct watchdog_device;
|
||||
* @status: The routine that shows the status of the watchdog device.
|
||||
* @set_timeout:The routine for setting the watchdog devices timeout value.
|
||||
* @get_timeleft:The routine that get's the time that's left before a reset.
|
||||
* @ref: The ref operation for dyn. allocated watchdog_device structs
|
||||
* @unref: The unref operation for dyn. allocated watchdog_device structs
|
||||
* @ioctl: The routines that handles extra ioctl calls.
|
||||
*
|
||||
* The watchdog_ops structure contains a list of low-level operations
|
||||
@@ -84,11 +90,17 @@ struct watchdog_ops {
|
||||
unsigned int (*status)(struct watchdog_device *);
|
||||
int (*set_timeout)(struct watchdog_device *, unsigned int);
|
||||
unsigned int (*get_timeleft)(struct watchdog_device *);
|
||||
void (*ref)(struct watchdog_device *);
|
||||
void (*unref)(struct watchdog_device *);
|
||||
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
|
||||
};
|
||||
|
||||
/** struct watchdog_device - The structure that defines a watchdog device
|
||||
*
|
||||
* @id: The watchdog's ID. (Allocated by watchdog_register_device)
|
||||
* @cdev: The watchdog's Character device.
|
||||
* @dev: The device for our watchdog
|
||||
* @parent: The parent bus device
|
||||
* @info: Pointer to a watchdog_info structure.
|
||||
* @ops: Pointer to the list of watchdog operations.
|
||||
* @bootstatus: Status of the watchdog device at boot.
|
||||
@@ -96,6 +108,7 @@ struct watchdog_ops {
|
||||
* @min_timeout:The watchdog devices minimum timeout value.
|
||||
* @max_timeout:The watchdog devices maximum timeout value.
|
||||
* @driver-data:Pointer to the drivers private data.
|
||||
* @lock: Lock for watchdog core internal use only.
|
||||
* @status: Field that contains the devices internal status bits.
|
||||
*
|
||||
* The watchdog_device structure contains all information about a
|
||||
@@ -103,8 +116,15 @@ struct watchdog_ops {
|
||||
*
|
||||
* The driver-data field may not be accessed directly. It must be accessed
|
||||
* via the watchdog_set_drvdata and watchdog_get_drvdata helpers.
|
||||
*
|
||||
* The lock field is for watchdog core internal use only and should not be
|
||||
* touched.
|
||||
*/
|
||||
struct watchdog_device {
|
||||
int id;
|
||||
struct cdev cdev;
|
||||
struct device *dev;
|
||||
struct device *parent;
|
||||
const struct watchdog_info *info;
|
||||
const struct watchdog_ops *ops;
|
||||
unsigned int bootstatus;
|
||||
@@ -112,12 +132,14 @@ struct watchdog_device {
|
||||
unsigned int min_timeout;
|
||||
unsigned int max_timeout;
|
||||
void *driver_data;
|
||||
struct mutex lock;
|
||||
unsigned long status;
|
||||
/* Bit numbers for status flags */
|
||||
#define WDOG_ACTIVE 0 /* Is the watchdog running/active */
|
||||
#define WDOG_DEV_OPEN 1 /* Opened via /dev/watchdog ? */
|
||||
#define WDOG_ALLOW_RELEASE 2 /* Did we receive the magic char ? */
|
||||
#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
|
||||
#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_WATCHDOG_NOWAYOUT
|
||||
@@ -128,6 +150,12 @@ struct watchdog_device {
|
||||
#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
|
||||
#endif
|
||||
|
||||
/* Use the following function to check wether or not the watchdog is active */
|
||||
static inline bool watchdog_active(struct watchdog_device *wdd)
|
||||
{
|
||||
return test_bit(WDOG_ACTIVE, &wdd->status);
|
||||
}
|
||||
|
||||
/* Use the following function to set the nowayout feature */
|
||||
static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user