Commit d4bab1b0 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [WATCHDOG] i6300esb.c: change platform_driver to pci_driver
  [WATCHDOG] i6300esb: fix unlock register with
  [WATCHDOG] drivers/watchdog/wdt.c:wdt_ioctl(): make `ident' non-static
  [WATCHDOG] change reboot_notifier to platform-shutdown method.
  [WATCHDOG] watchdog_info constify
  [WATCHDOG] gef_wdt: Author corrections following split of GE Fanuc joint venture
  [WATCHDOG] iTCO_wdt: clean up probe(), modify err msg
  [WATCHDOG] ep93xx: watchdog timer driver for TS-72xx SBCs cleanup
  [WATCHDOG] support for max63xx watchdog timer chips
  [WATCHDOG] ep93xx: added platform side support for TS-72xx WDT driver
  [WATCHDOG] ep93xx: implemented watchdog timer driver for TS-72xx SBCs
parents 56b78921 2786095a
...@@ -65,6 +65,8 @@ ...@@ -65,6 +65,8 @@
#define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000
#define TS72XX_RTC_DATA_SIZE 0x00001000 #define TS72XX_RTC_DATA_SIZE 0x00001000
#define TS72XX_WDT_CONTROL_PHYS_BASE 0x23800000
#define TS72XX_WDT_FEED_PHYS_BASE 0x23c00000
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -166,6 +166,26 @@ static struct platform_device ts72xx_rtc_device = { ...@@ -166,6 +166,26 @@ static struct platform_device ts72xx_rtc_device = {
.num_resources = 0, .num_resources = 0,
}; };
static struct resource ts72xx_wdt_resources[] = {
{
.start = TS72XX_WDT_CONTROL_PHYS_BASE,
.end = TS72XX_WDT_CONTROL_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = TS72XX_WDT_FEED_PHYS_BASE,
.end = TS72XX_WDT_FEED_PHYS_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ts72xx_wdt_device = {
.name = "ts72xx-wdt",
.id = -1,
.num_resources = ARRAY_SIZE(ts72xx_wdt_resources),
.resource = ts72xx_wdt_resources,
};
static struct ep93xx_eth_data ts72xx_eth_data = { static struct ep93xx_eth_data ts72xx_eth_data = {
.phy_id = 1, .phy_id = 1,
}; };
...@@ -175,6 +195,7 @@ static void __init ts72xx_init_machine(void) ...@@ -175,6 +195,7 @@ static void __init ts72xx_init_machine(void)
ep93xx_init_devices(); ep93xx_init_devices();
ts72xx_register_flash(); ts72xx_register_flash();
platform_device_register(&ts72xx_rtc_device); platform_device_register(&ts72xx_rtc_device);
platform_device_register(&ts72xx_wdt_device);
ep93xx_register_eth(&ts72xx_eth_data, 1); ep93xx_register_eth(&ts72xx_eth_data, 1);
} }
......
...@@ -553,7 +553,7 @@ static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data, ...@@ -553,7 +553,7 @@ static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data,
return 0; return 0;
} }
static struct watchdog_info mpc5200_wdt_info = { static const struct watchdog_info mpc5200_wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
.identity = WDT_IDENTITY, .identity = WDT_IDENTITY,
}; };
......
...@@ -55,6 +55,11 @@ config SOFT_WATCHDOG ...@@ -55,6 +55,11 @@ config SOFT_WATCHDOG
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called softdog. module will be called softdog.
config MAX63XX_WATCHDOG
tristate "Max63xx watchdog"
help
Support for memory mapped max63{69,70,71,72,73,74} watchdog timer.
config WM831X_WATCHDOG config WM831X_WATCHDOG
tristate "WM831x watchdog" tristate "WM831x watchdog"
depends on MFD_WM831X depends on MFD_WM831X
...@@ -289,6 +294,17 @@ config ADX_WATCHDOG ...@@ -289,6 +294,17 @@ config ADX_WATCHDOG
Say Y here if you want support for the watchdog timer on Avionic Say Y here if you want support for the watchdog timer on Avionic
Design Xanthos boards. Design Xanthos boards.
config TS72XX_WATCHDOG
tristate "TS-72XX SBC Watchdog"
depends on MACH_TS72XX
help
Technologic Systems TS-7200, TS-7250 and TS-7260 boards have
watchdog timer implemented in a external CPLD chip. Say Y here
if you want to support for the watchdog timer on TS-72XX boards.
To compile this driver as a module, choose M here: the
module will be called ts72xx_wdt.
# AVR32 Architecture # AVR32 Architecture
config AT32AP700X_WDT config AT32AP700X_WDT
...@@ -845,10 +861,10 @@ config TXX9_WDT ...@@ -845,10 +861,10 @@ config TXX9_WDT
# POWERPC Architecture # POWERPC Architecture
config GEF_WDT config GEF_WDT
tristate "GE Fanuc Watchdog Timer" tristate "GE Watchdog Timer"
depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A
---help--- ---help---
Watchdog timer found in a number of GE Fanuc single board computers. Watchdog timer found in a number of GE single board computers.
config MPC5200_WDT config MPC5200_WDT
bool "MPC52xx Watchdog Timer" bool "MPC52xx Watchdog Timer"
......
...@@ -46,6 +46,7 @@ obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o ...@@ -46,6 +46,7 @@ obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o
obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o
obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o
obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
# AVR32 Architecture # AVR32 Architecture
obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
...@@ -142,4 +143,5 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o ...@@ -142,4 +143,5 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o
# Architecture Independant # Architecture Independant
obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
...@@ -150,7 +150,7 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -150,7 +150,7 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int options, retval = -EINVAL; int options, retval = -EINVAL;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
.identity = WATCHDOG_NAME, .identity = WATCHDOG_NAME,
......
...@@ -137,7 +137,7 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -137,7 +137,7 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int new_timeout; int new_timeout;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -37,7 +37,7 @@ struct adx_wdt { ...@@ -37,7 +37,7 @@ struct adx_wdt {
spinlock_t lock; spinlock_t lock;
}; };
static struct watchdog_info adx_wdt_info = { static const struct watchdog_info adx_wdt_info = {
.identity = "Avionic Design Xanthos Watchdog", .identity = "Avionic Design Xanthos Watchdog",
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
}; };
......
...@@ -180,7 +180,7 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -180,7 +180,7 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -238,7 +238,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -238,7 +238,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
| WDIOF_MAGICCLOSE, | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
......
...@@ -219,7 +219,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data, ...@@ -219,7 +219,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data,
static long ar7_wdt_ioctl(struct file *file, static long ar7_wdt_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.identity = LONGNAME, .identity = LONGNAME,
.firmware_version = 1, .firmware_version = 1,
.options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
......
...@@ -202,7 +202,7 @@ static int at32_wdt_get_status(void) ...@@ -202,7 +202,7 @@ static int at32_wdt_get_status(void)
return status; return status;
} }
static struct watchdog_info at32_wdt_info = { static const struct watchdog_info at32_wdt_info = {
.identity = "at32ap700x watchdog", .identity = "at32ap700x watchdog",
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -121,7 +121,7 @@ static int at91_wdt_settimeout(int new_time) ...@@ -121,7 +121,7 @@ static int at91_wdt_settimeout(int new_time)
return 0; return 0;
} }
static struct watchdog_info at91_wdt_info = { static const struct watchdog_info at91_wdt_info = {
.identity = "at91 watchdog", .identity = "at91 watchdog",
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
}; };
......
...@@ -149,7 +149,7 @@ static ssize_t bcm47xx_wdt_write(struct file *file, const char __user *data, ...@@ -149,7 +149,7 @@ static ssize_t bcm47xx_wdt_write(struct file *file, const char __user *data,
return len; return len;
} }
static struct watchdog_info bcm47xx_wdt_info = { static const struct watchdog_info bcm47xx_wdt_info = {
.identity = DRV_NAME, .identity = DRV_NAME,
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -74,7 +72,7 @@ ...@@ -74,7 +72,7 @@
static unsigned int timeout = WATCHDOG_TIMEOUT; static unsigned int timeout = WATCHDOG_TIMEOUT;
static int nowayout = WATCHDOG_NOWAYOUT; static int nowayout = WATCHDOG_NOWAYOUT;
static struct watchdog_info bfin_wdt_info; static const struct watchdog_info bfin_wdt_info;
static unsigned long open_check; static unsigned long open_check;
static char expect_close; static char expect_close;
static DEFINE_SPINLOCK(bfin_wdt_spinlock); static DEFINE_SPINLOCK(bfin_wdt_spinlock);
...@@ -309,26 +307,6 @@ static long bfin_wdt_ioctl(struct file *file, ...@@ -309,26 +307,6 @@ static long bfin_wdt_ioctl(struct file *file,
} }
} }
/**
* bfin_wdt_notify_sys - Notifier Handler
* @this: notifier block
* @code: notifier event
* @unused: unused
*
* Handles specific events, such as turning off the watchdog during a
* shutdown event.
*/
static int bfin_wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
stampit();
if (code == SYS_DOWN || code == SYS_HALT)
bfin_wdt_stop();
return NOTIFY_DONE;
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int state_before_suspend; static int state_before_suspend;
...@@ -388,40 +366,28 @@ static struct miscdevice bfin_wdt_miscdev = { ...@@ -388,40 +366,28 @@ static struct miscdevice bfin_wdt_miscdev = {
.fops = &bfin_wdt_fops, .fops = &bfin_wdt_fops,
}; };
static struct watchdog_info bfin_wdt_info = { static const struct watchdog_info bfin_wdt_info = {
.identity = "Blackfin Watchdog", .identity = "Blackfin Watchdog",
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
}; };
static struct notifier_block bfin_wdt_notifier = {
.notifier_call = bfin_wdt_notify_sys,
};
/** /**
* bfin_wdt_probe - Initialize module * bfin_wdt_probe - Initialize module
* *
* Registers the misc device and notifier handler. Actual device * Registers the misc device. Actual device
* initialization is handled by bfin_wdt_open(). * initialization is handled by bfin_wdt_open().
*/ */
static int __devinit bfin_wdt_probe(struct platform_device *pdev) static int __devinit bfin_wdt_probe(struct platform_device *pdev)
{ {
int ret; int ret;
ret = register_reboot_notifier(&bfin_wdt_notifier);
if (ret) {
pr_devinit(KERN_ERR PFX
"cannot register reboot notifier (err=%d)\n", ret);
return ret;
}
ret = misc_register(&bfin_wdt_miscdev); ret = misc_register(&bfin_wdt_miscdev);
if (ret) { if (ret) {
pr_devinit(KERN_ERR PFX pr_devinit(KERN_ERR PFX
"cannot register miscdev on minor=%d (err=%d)\n", "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret); WATCHDOG_MINOR, ret);
unregister_reboot_notifier(&bfin_wdt_notifier);
return ret; return ret;
} }
...@@ -434,21 +400,33 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev) ...@@ -434,21 +400,33 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev)
/** /**
* bfin_wdt_remove - Initialize module * bfin_wdt_remove - Initialize module
* *
* Unregisters the misc device and notifier handler. Actual device * Unregisters the misc device. Actual device
* deinitialization is handled by bfin_wdt_close(). * deinitialization is handled by bfin_wdt_close().
*/ */
static int __devexit bfin_wdt_remove(struct platform_device *pdev) static int __devexit bfin_wdt_remove(struct platform_device *pdev)
{ {
misc_deregister(&bfin_wdt_miscdev); misc_deregister(&bfin_wdt_miscdev);
unregister_reboot_notifier(&bfin_wdt_notifier);
return 0; return 0;
} }
/**
* bfin_wdt_shutdown - Soft Shutdown Handler
*
* Handles the soft shutdown event.
*/
static void bfin_wdt_shutdown(struct platform_device *pdev)
{
stampit();
bfin_wdt_stop();
}
static struct platform_device *bfin_wdt_device; static struct platform_device *bfin_wdt_device;
static struct platform_driver bfin_wdt_driver = { static struct platform_driver bfin_wdt_driver = {
.probe = bfin_wdt_probe, .probe = bfin_wdt_probe,
.remove = __devexit_p(bfin_wdt_remove), .remove = __devexit_p(bfin_wdt_remove),
.shutdown = bfin_wdt_shutdown,
.suspend = bfin_wdt_suspend, .suspend = bfin_wdt_suspend,
.resume = bfin_wdt_resume, .resume = bfin_wdt_resume,
.driver = { .driver = {
......
...@@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf, ...@@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf,
return count; return count;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
.identity = "PowerPC Book-E Watchdog", .identity = "PowerPC Book-E Watchdog",
}; };
......
...@@ -257,7 +257,7 @@ static long coh901327_ioctl(struct file *file, unsigned int cmd, ...@@ -257,7 +257,7 @@ static long coh901327_ioctl(struct file *file, unsigned int cmd,
struct watchdog_info __user *ident; struct watchdog_info __user *ident;
int __user *i; int __user *i;
} uarg; } uarg;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET | .options = WDIOF_CARDRESET |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
......
...@@ -154,7 +154,7 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -154,7 +154,7 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
unsigned int value; unsigned int value;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET, .options = WDIOF_CARDRESET,
.identity = "CPU5 WDT", .identity = "CPU5 WDT",
}; };
......
...@@ -403,7 +403,7 @@ static int cpwd_release(struct inode *inode, struct file *file) ...@@ -403,7 +403,7 @@ static int cpwd_release(struct inode *inode, struct file *file)
static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
static struct watchdog_info info = { static const struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT, .options = WDIOF_SETTIMEOUT,
.firmware_version = 1, .firmware_version = 1,
.identity = DRIVER_NAME, .identity = DRIVER_NAME,
......
...@@ -142,7 +142,7 @@ davinci_wdt_write(struct file *file, const char *data, size_t len, ...@@ -142,7 +142,7 @@ davinci_wdt_write(struct file *file, const char *data, size_t len,
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING, .options = WDIOF_KEEPALIVEPING,
.identity = "DaVinci Watchdog", .identity = "DaVinci Watchdog",
}; };
......
...@@ -131,7 +131,7 @@ ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, ...@@ -131,7 +131,7 @@ ep93xx_wdt_write(struct file *file, const char __user *data, size_t len,
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE,
.identity = "EP93xx Watchdog", .identity = "EP93xx Watchdog",
}; };
......
...@@ -238,7 +238,7 @@ static long eurwdt_ioctl(struct file *file, ...@@ -238,7 +238,7 @@ static long eurwdt_ioctl(struct file *file,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
| WDIOF_MAGICCLOSE, | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
......
/* /*
* GE Fanuc watchdog userspace interface * GE watchdog userspace interface
* *
* Author: Martyn Welch <martyn.welch@gefanuc.com> * Author: Martyn Welch <martyn.welch@ge.com>
* *
* Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc. * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -161,11 +161,11 @@ static long gef_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -161,11 +161,11 @@ static long gef_wdt_ioctl(struct file *file, unsigned int cmd,
int timeout; int timeout;
int options; int options;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
static struct watchdog_info info = { static const struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
.firmware_version = 0, .firmware_version = 0,
.identity = "GE Fanuc watchdog", .identity = "GE watchdog",
}; };
switch (cmd) { switch (cmd) {
...@@ -311,7 +311,7 @@ static struct of_platform_driver gef_wdt_driver = { ...@@ -311,7 +311,7 @@ static struct of_platform_driver gef_wdt_driver = {
static int __init gef_wdt_init(void) static int __init gef_wdt_init(void)
{ {
printk(KERN_INFO "GE Fanuc watchdog driver\n"); printk(KERN_INFO "GE watchdog driver\n");
return of_register_platform_driver(&gef_wdt_driver); return of_register_platform_driver(&gef_wdt_driver);
} }
...@@ -323,8 +323,8 @@ static void __exit gef_wdt_exit(void) ...@@ -323,8 +323,8 @@ static void __exit gef_wdt_exit(void)
module_init(gef_wdt_init); module_init(gef_wdt_init);
module_exit(gef_wdt_exit); module_exit(gef_wdt_exit);
MODULE_AUTHOR("Martyn Welch <martyn.welch@gefanuc.com>"); MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>");
MODULE_DESCRIPTION("GE Fanuc watchdog driver"); MODULE_DESCRIPTION("GE watchdog driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_ALIAS("platform: gef_wdt"); MODULE_ALIAS("platform: gef_wdt");
...@@ -142,7 +142,7 @@ static long geodewdt_ioctl(struct file *file, unsigned int cmd, ...@@ -142,7 +142,7 @@ static long geodewdt_ioctl(struct file *file, unsigned int cmd,
int __user *p = argp; int __user *p = argp;
int interval; int interval;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
| WDIOF_MAGICCLOSE, | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
......
...@@ -554,7 +554,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data, ...@@ -554,7 +554,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data,
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/platform_device.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
#include <linux/io.h> #include <linux/io.h>
/* Module and version information */ /* Module and version information */
#define ESB_VERSION "0.04" #define ESB_VERSION "0.05"
#define ESB_MODULE_NAME "i6300ESB timer" #define ESB_MODULE_NAME "i6300ESB timer"
#define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION
#define PFX ESB_MODULE_NAME ": " #define PFX ESB_MODULE_NAME ": "
...@@ -65,7 +64,7 @@ ...@@ -65,7 +64,7 @@
/* Config register bits */ /* Config register bits */
#define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */ #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */
#define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */ #define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */
#define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */ #define ESB_WDT_INTTYPE (0x03 << 0) /* Interrupt type on timer1 timeout */
/* Reload register bits */ /* Reload register bits */
#define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */
...@@ -82,7 +81,9 @@ static unsigned long timer_alive; ...@@ -82,7 +81,9 @@ static unsigned long timer_alive;
static struct pci_dev *esb_pci; static struct pci_dev *esb_pci;
static unsigned short triggered; /* The status of the watchdog upon boot */ static unsigned short triggered; /* The status of the watchdog upon boot */
static char esb_expect_close; static char esb_expect_close;
static struct platform_device *esb_platform_device;
/* We can only use 1 card due to the /dev/watchdog restriction */
static int cards_found;
/* module parameters */ /* module parameters */
/* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */
...@@ -111,8 +112,8 @@ MODULE_PARM_DESC(nowayout, ...@@ -111,8 +112,8 @@ MODULE_PARM_DESC(nowayout,
*/ */
static inline void esb_unlock_registers(void) static inline void esb_unlock_registers(void)
{ {
writeb(ESB_UNLOCK1, ESB_RELOAD_REG); writew(ESB_UNLOCK1, ESB_RELOAD_REG);
writeb(ESB_UNLOCK2, ESB_RELOAD_REG); writew(ESB_UNLOCK2, ESB_RELOAD_REG);
} }
static int esb_timer_start(void) static int esb_timer_start(void)
...@@ -256,7 +257,7 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -256,7 +257,7 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int new_heartbeat; int new_heartbeat;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
...@@ -332,11 +333,6 @@ static struct miscdevice esb_miscdev = { ...@@ -332,11 +333,6 @@ static struct miscdevice esb_miscdev = {
/* /*
* Data for PCI driver interface * Data for PCI driver interface
*
* This data only exists for exporting the supported
* PCI ids via MODULE_DEVICE_TABLE. We do not actually
* register a pci_driver, because someone else might one day
* want to register another driver on the same PCI id.
*/ */
static struct pci_device_id esb_pci_tbl[] = { static struct pci_device_id esb_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), },
...@@ -348,29 +344,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl); ...@@ -348,29 +344,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl);
* Init & exit routines * Init & exit routines
*/ */
static unsigned char __devinit esb_getdevice(void) static unsigned char __devinit esb_getdevice(struct pci_dev *pdev)
{ {
/* if (pci_enable_device(pdev)) {
* Find the PCI device
*/
esb_pci = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_ESB_9, NULL);
if (!esb_pci)
return 0;
if (pci_enable_device(esb_pci)) {
printk(KERN_ERR PFX "failed to enable device\n"); printk(KERN_ERR PFX "failed to enable device\n");
goto err_devput; goto err_devput;
} }
if (pci_request_region(esb_pci, 0, ESB_MODULE_NAME)) { if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) {
printk(KERN_ERR PFX "failed to request region\n"); printk(KERN_ERR PFX "failed to request region\n");
goto err_disable; goto err_disable;
} }
BASEADDR = pci_ioremap_bar(esb_pci, 0); BASEADDR = pci_ioremap_bar(pdev, 0);
if (BASEADDR == NULL) { if (BASEADDR == NULL) {
/* Something's wrong here, BASEADDR has to be set */ /* Something's wrong here, BASEADDR has to be set */
printk(KERN_ERR PFX "failed to get BASEADDR\n"); printk(KERN_ERR PFX "failed to get BASEADDR\n");
...@@ -378,14 +364,14 @@ static unsigned char __devinit esb_getdevice(void) ...@@ -378,14 +364,14 @@ static unsigned char __devinit esb_getdevice(void)
} }
/* Done */ /* Done */
esb_pci = pdev;
return 1; return 1;
err_release: err_release:
pci_release_region(esb_pci, 0); pci_release_region(pdev, 0);
err_disable: err_disable:
pci_disable_device(esb_pci); pci_disable_device(pdev);
err_devput: err_devput:
pci_dev_put(esb_pci);
return 0; return 0;
} }
...@@ -430,12 +416,23 @@ static void __devinit esb_initdevice(void) ...@@ -430,12 +416,23 @@ static void __devinit esb_initdevice(void)
esb_timer_set_heartbeat(heartbeat); esb_timer_set_heartbeat(heartbeat);
} }
static int __devinit esb_probe(struct platform_device *dev) static int __devinit esb_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{ {
int ret; int ret;
cards_found++;
if (cards_found == 1)
printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n",
ESB_VERSION);
if (cards_found > 1) {
printk(KERN_ERR PFX "This driver only supports 1 device\n");
return -ENODEV;
}
/* Check whether or not the hardware watchdog is there */ /* Check whether or not the hardware watchdog is there */
if (!esb_getdevice() || esb_pci == NULL) if (!esb_getdevice(pdev) || esb_pci == NULL)
return -ENODEV; return -ENODEV;
/* Check that the heartbeat value is within it's range; /* Check that the heartbeat value is within it's range;
...@@ -467,11 +464,11 @@ static int __devinit esb_probe(struct platform_device *dev) ...@@ -467,11 +464,11 @@ static int __devinit esb_probe(struct platform_device *dev)
iounmap(BASEADDR); iounmap(BASEADDR);
pci_release_region(esb_pci, 0); pci_release_region(esb_pci, 0);
pci_disable_device(esb_pci); pci_disable_device(esb_pci);
pci_dev_put(esb_pci); esb_pci = NULL;
return ret; return ret;
} }
static int __devexit esb_remove(struct platform_device *dev) static void __devexit esb_remove(struct pci_dev *pdev)
{ {
/* Stop the timer before we leave */ /* Stop the timer before we leave */
if (!nowayout) if (!nowayout)
...@@ -482,54 +479,30 @@ static int __devexit esb_remove(struct platform_device *dev) ...@@ -482,54 +479,30 @@ static int __devexit esb_remove(struct platform_device *dev)
iounmap(BASEADDR); iounmap(BASEADDR);
pci_release_region(esb_pci, 0); pci_release_region(esb_pci, 0);
pci_disable_device(esb_pci); pci_disable_device(esb_pci);
pci_dev_put(esb_pci); esb_pci = NULL;
return 0;
} }
static void esb_shutdown(struct platform_device *dev) static void esb_shutdown(struct pci_dev *pdev)
{ {
esb_timer_stop(); esb_timer_stop();
} }
static struct platform_driver esb_platform_driver = { static struct pci_driver esb_driver = {
.name = ESB_MODULE_NAME,
.id_table = esb_pci_tbl,
.probe = esb_probe, .probe = esb_probe,
.remove = __devexit_p(esb_remove), .remove = __devexit_p(esb_remove),
.shutdown = esb_shutdown, .shutdown = esb_shutdown,
.driver = {
.owner = THIS_MODULE,
.name = ESB_MODULE_NAME,
},
}; };
static int __init watchdog_init(void) static int __init watchdog_init(void)
{ {
int err; return pci_register_driver(&esb_driver);
printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n",
ESB_VERSION);
err = platform_driver_register(&esb_platform_driver);
if (err)
return err;
esb_platform_device = platform_device_register_simple(ESB_MODULE_NAME,
-1, NULL, 0);
if (IS_ERR(esb_platform_device)) {
err = PTR_ERR(esb_platform_device);
goto unreg_platform_driver;
}
return 0;
unreg_platform_driver:
platform_driver_unregister(&esb_platform_driver);
return err;
} }
static void __exit watchdog_cleanup(void) static void __exit watchdog_cleanup(void)
{ {
platform_device_unregister(esb_platform_device); pci_unregister_driver(&esb_driver);
platform_driver_unregister(&esb_platform_driver);
printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
} }
......
...@@ -584,7 +584,7 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -584,7 +584,7 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd,
int new_heartbeat; int new_heartbeat;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
...@@ -698,7 +698,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, ...@@ -698,7 +698,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
if (iTCO_wdt_private.iTCO_version == 2) { if (iTCO_wdt_private.iTCO_version == 2) {
pci_read_config_dword(pdev, 0xf0, &base_address); pci_read_config_dword(pdev, 0xf0, &base_address);
if ((base_address & 1) == 0) { if ((base_address & 1) == 0) {
printk(KERN_ERR PFX "RCBA is disabled by harddware\n"); printk(KERN_ERR PFX "RCBA is disabled by hardware\n");
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
...@@ -708,8 +708,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, ...@@ -708,8 +708,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
/* Check chipset's NO_REBOOT bit */ /* Check chipset's NO_REBOOT bit */
if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) {
printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, " printk(KERN_INFO PFX "unable to reset NO_REBOOT flag, "
"reboot disabled by hardware\n"); "platform may have disabled it\n");
ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ ret = -ENODEV; /* Cannot reset NO_REBOOT bit */
goto out_unmap; goto out_unmap;
} }
...@@ -805,6 +805,7 @@ static void __devexit iTCO_wdt_cleanup(void) ...@@ -805,6 +805,7 @@ static void __devexit iTCO_wdt_cleanup(void)
static int __devinit iTCO_wdt_probe(struct platform_device *dev) static int __devinit iTCO_wdt_probe(struct platform_device *dev)
{ {
int ret = -ENODEV;
int found = 0; int found = 0;
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
const struct pci_device_id *ent; const struct pci_device_id *ent;
...@@ -814,19 +815,17 @@ static int __devinit iTCO_wdt_probe(struct platform_device *dev) ...@@ -814,19 +815,17 @@ static int __devinit iTCO_wdt_probe(struct platform_device *dev)
for_each_pci_dev(pdev) { for_each_pci_dev(pdev) {
ent = pci_match_id(iTCO_wdt_pci_tbl, pdev); ent = pci_match_id(iTCO_wdt_pci_tbl, pdev);
if (ent) { if (ent) {
if (!(iTCO_wdt_init(pdev, ent, dev))) { found++;
found++; ret = iTCO_wdt_init(pdev, ent, dev);
if (!ret)
break; break;
}
} }
} }
if (!found) { if (!found)
printk(KERN_INFO PFX "No card detected\n"); printk(KERN_INFO PFX "No card detected\n");
return -ENODEV;
}
return 0; return ret;
} }
static int __devexit iTCO_wdt_remove(struct platform_device *dev) static int __devexit iTCO_wdt_remove(struct platform_device *dev)
......
...@@ -174,7 +174,7 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -174,7 +174,7 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
| WDIOF_MAGICCLOSE, | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
......
...@@ -111,7 +111,7 @@ static long indydog_ioctl(struct file *file, unsigned int cmd, ...@@ -111,7 +111,7 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int options, retval = -EINVAL; int options, retval = -EINVAL;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING, .options = WDIOF_KEEPALIVEPING,
.firmware_version = 0, .firmware_version = 0,
.identity = "Hardware Watchdog for SGI IP22", .identity = "Hardware Watchdog for SGI IP22",
......
...@@ -236,7 +236,7 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -236,7 +236,7 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.identity = "IT8712F Watchdog", .identity = "IT8712F Watchdog",
.firmware_version = 1, .firmware_version = 1,
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
......
...@@ -421,7 +421,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, ...@@ -421,7 +421,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf,
return count; return count;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
.firmware_version = 1, .firmware_version = 1,
.identity = WATCHDOG_NAME, .identity = WATCHDOG_NAME,
......
...@@ -100,7 +100,7 @@ static ssize_t ixp2000_wdt_write(struct file *file, const char *data, ...@@ -100,7 +100,7 @@ static ssize_t ixp2000_wdt_write(struct file *file, const char *data,
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
.identity = "IXP2000 Watchdog", .identity = "IXP2000 Watchdog",
......
...@@ -89,7 +89,7 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) ...@@ -89,7 +89,7 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
.identity = "IXP4xx Watchdog", .identity = "IXP4xx Watchdog",
......
...@@ -145,7 +145,7 @@ static int ks8695_wdt_close(struct inode *inode, struct file *file) ...@@ -145,7 +145,7 @@ static int ks8695_wdt_close(struct inode *inode, struct file *file)
return 0; return 0;
} }
static struct watchdog_info ks8695_wdt_info = { static const struct watchdog_info ks8695_wdt_info = {
.identity = "ks8695 watchdog", .identity = "ks8695 watchdog",
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
}; };
......
...@@ -101,7 +101,7 @@ MODULE_PARM_DESC(nowayout, ...@@ -101,7 +101,7 @@ MODULE_PARM_DESC(nowayout,
#define PFX "machzwd" #define PFX "machzwd"
static struct watchdog_info zf_info = { static const struct watchdog_info zf_info = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
.identity = "ZF-Logic watchdog", .identity = "ZF-Logic watchdog",
......
/*
* drivers/char/watchdog/max63xx_wdt.c
*
* Driver for max63{69,70,71,72,73,74} watchdog timers
*
* Copyright (C) 2009 Marc Zyngier <maz@misterjones.org>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
* This driver assumes the watchdog pins are memory mapped (as it is
* the case for the Arcom Zeus). Should it be connected over GPIOs or
* another interface, some abstraction will have to be introduced.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/device.h>
#define DEFAULT_HEARTBEAT 60
#define MAX_HEARTBEAT 60
static int heartbeat = DEFAULT_HEARTBEAT;
static int nowayout = WATCHDOG_NOWAYOUT;
/*
* Memory mapping: a single byte, 3 first lower bits to select bit 3
* to ping the watchdog.
*/
#define MAX6369_WDSET (7 << 0)
#define MAX6369_WDI (1 << 3)
static DEFINE_SPINLOCK(io_lock);
static unsigned long wdt_status;
#define WDT_IN_USE 0
#define WDT_RUNNING 1
#define WDT_OK_TO_CLOSE 2
static int nodelay;
static struct resource *wdt_mem;
static void __iomem *wdt_base;
static struct platform_device *max63xx_pdev;
/*
* The timeout values used are actually the absolute minimum the chip
* offers. Typical values on my board are slightly over twice as long
* (10s setting ends up with a 25s timeout), and can be up to 3 times
* the nominal setting (according to the datasheet). So please take
* these values with a grain of salt. Same goes for the initial delay
* "feature". Only max6373/74 have a few settings without this initial
* delay (selected with the "nodelay" parameter).
*
* I also decided to remove from the tables any timeout smaller than a
* second, as it looked completly overkill...
*/
/* Timeouts in second */
struct max63xx_timeout {
u8 wdset;
u8 tdelay;
u8 twd;
};
static struct max63xx_timeout max6369_table[] = {
{ 5, 1, 1 },
{ 6, 10, 10 },
{ 7, 60, 60 },
{ },
};
static struct max63xx_timeout max6371_table[] = {
{ 6, 60, 3 },
{ 7, 60, 60 },
{ },
};
static struct max63xx_timeout max6373_table[] = {
{ 2, 60, 1 },
{ 5, 0, 1 },
{ 1, 3, 3 },
{ 7, 60, 10 },
{ 6, 0, 10 },
{ },
};
static struct max63xx_timeout *current_timeout;
static struct max63xx_timeout *
max63xx_select_timeout(struct max63xx_timeout *table, int value)
{
while (table->twd) {
if (value <= table->twd) {
if (nodelay && table->tdelay == 0)
return table;
if (!nodelay)
return table;
}
table++;
}
return NULL;
}
static void max63xx_wdt_ping(void)
{
u8 val;
spin_lock(&io_lock);
val = __raw_readb(wdt_base);
__raw_writeb(val | MAX6369_WDI, wdt_base);
__raw_writeb(val & ~MAX6369_WDI, wdt_base);
spin_unlock(&io_lock);
}
static void max63xx_wdt_enable(struct max63xx_timeout *entry)
{
u8 val;
if (test_and_set_bit(WDT_RUNNING, &wdt_status))
return;
spin_lock(&io_lock);
val = __raw_readb(wdt_base);
val &= ~MAX6369_WDSET;
val |= entry->wdset;
__raw_writeb(val, wdt_base);
spin_unlock(&io_lock);
/* check for a edge triggered startup */
if (entry->tdelay == 0)
max63xx_wdt_ping();
}
static void max63xx_wdt_disable(void)
{
spin_lock(&io_lock);
__raw_writeb(3, wdt_base);
spin_unlock(&io_lock);
clear_bit(WDT_RUNNING, &wdt_status);
}
static int max63xx_wdt_open(struct inode *inode, struct file *file)
{
if (test_and_set_bit(WDT_IN_USE, &wdt_status))
return -EBUSY;
max63xx_wdt_enable(current_timeout);
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
return nonseekable_open(inode, file);
}
static ssize_t max63xx_wdt_write(struct file *file, const char *data,
size_t len, loff_t *ppos)
{
if (len) {
if (!nowayout) {
size_t i;
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
for (i = 0; i != len; i++) {
char c;
if (get_user(c, data + i))
return -EFAULT;
if (c == 'V')
set_bit(WDT_OK_TO_CLOSE, &wdt_status);
}
}
max63xx_wdt_ping();
}
return len;
}
static const struct watchdog_info ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
.identity = "max63xx Watchdog",
};
static long max63xx_wdt_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int ret = -ENOTTY;
switch (cmd) {
case WDIOC_GETSUPPORT:
ret = copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident)) ? -EFAULT : 0;
break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
ret = put_user(0, (int *)arg);
break;
case WDIOC_KEEPALIVE:
max63xx_wdt_ping();
ret = 0;
break;
case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
}
return ret;
}
static int max63xx_wdt_release(struct inode *inode, struct file *file)
{
if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
max63xx_wdt_disable();
else
dev_crit(&max63xx_pdev->dev,
"device closed unexpectedly - timer will not stop\n");
clear_bit(WDT_IN_USE, &wdt_status);
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
return 0;
}
static const struct file_operations max63xx_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = max63xx_wdt_write,
.unlocked_ioctl = max63xx_wdt_ioctl,
.open = max63xx_wdt_open,
.release = max63xx_wdt_release,
};
static struct miscdevice max63xx_wdt_miscdev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.fops = &max63xx_wdt_fops,
};
static int __devinit max63xx_wdt_probe(struct platform_device *pdev)
{
int ret = 0;
int size;
struct resource *res;
struct device *dev = &pdev->dev;
struct max63xx_timeout *table;
table = (struct max63xx_timeout *)pdev->id_entry->driver_data;
if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
heartbeat = DEFAULT_HEARTBEAT;
dev_info(dev, "requesting %ds heartbeat\n", heartbeat);
current_timeout = max63xx_select_timeout(table, heartbeat);
if (!current_timeout) {
dev_err(dev, "unable to satisfy heartbeat request\n");
return -EINVAL;
}
dev_info(dev, "using %ds heartbeat with %ds initial delay\n",
current_timeout->twd, current_timeout->tdelay);
heartbeat = current_timeout->twd;
max63xx_pdev = pdev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "failed to get memory region resource\n");
return -ENOENT;
}
size = resource_size(res);
wdt_mem = request_mem_region(res->start, size, pdev->name);
if (wdt_mem == NULL) {
dev_err(dev, "failed to get memory region\n");
return -ENOENT;
}
wdt_base = ioremap(res->start, size);
if (!wdt_base) {
dev_err(dev, "failed to map memory region\n");
ret = -ENOMEM;
goto out_request;
}
ret = misc_register(&max63xx_wdt_miscdev);
if (ret < 0) {
dev_err(dev, "cannot register misc device\n");
goto out_unmap;
}
return 0;
out_unmap:
iounmap(wdt_base);
out_request:
release_resource(wdt_mem);
kfree(wdt_mem);
return ret;
}
static int __devexit max63xx_wdt_remove(struct platform_device *pdev)
{
misc_deregister(&max63xx_wdt_miscdev);
if (wdt_mem) {
release_resource(wdt_mem);
kfree(wdt_mem);
wdt_mem = NULL;
}
if (wdt_base)
iounmap(wdt_base);
return 0;
}
static struct platform_device_id max63xx_id_table[] = {
{ "max6369_wdt", (kernel_ulong_t)max6369_table, },
{ "max6370_wdt", (kernel_ulong_t)max6369_table, },
{ "max6371_wdt", (kernel_ulong_t)max6371_table, },
{ "max6372_wdt", (kernel_ulong_t)max6371_table, },
{ "max6373_wdt", (kernel_ulong_t)max6373_table, },
{ "max6374_wdt", (kernel_ulong_t)max6373_table, },
{ },
};
MODULE_DEVICE_TABLE(platform, max63xx_id_table);
static struct platform_driver max63xx_wdt_driver = {
.probe = max63xx_wdt_probe,
.remove = __devexit_p(max63xx_wdt_remove),
.id_table = max63xx_id_table,
.driver = {
.name = "max63xx_wdt",
.owner = THIS_MODULE,
},
};
static int __init max63xx_wdt_init(void)
{
return platform_driver_register(&max63xx_wdt_driver);
}
static void __exit max63xx_wdt_exit(void)
{
platform_driver_unregister(&max63xx_wdt_driver);
}
module_init(max63xx_wdt_init);
module_exit(max63xx_wdt_exit);
MODULE_AUTHOR("Marc Zyngier <maz@misterjones.org>");
MODULE_DESCRIPTION("max63xx Watchdog Driver");
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat,
"Watchdog heartbeat period in seconds from 1 to "
__MODULE_STRING(MAX_HEARTBEAT) ", default "
__MODULE_STRING(DEFAULT_HEARTBEAT));
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
module_param(nodelay, int, 0);
MODULE_PARM_DESC(nodelay,
"Force selection of a timeout setting without initial delay "
"(max6373/74 only, default=0)");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
...@@ -201,7 +201,7 @@ static long mixcomwd_ioctl(struct file *file, ...@@ -201,7 +201,7 @@ static long mixcomwd_ioctl(struct file *file,
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
int status; int status;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
.identity = "MixCOM watchdog", .identity = "MixCOM watchdog",
......
...@@ -148,7 +148,7 @@ static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -148,7 +148,7 @@ static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING, .options = WDIOF_KEEPALIVEPING,
.firmware_version = 1, .firmware_version = 1,
.identity = "MPC8xxx", .identity = "MPC8xxx",
......
...@@ -213,7 +213,7 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data, ...@@ -213,7 +213,7 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data,
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -179,7 +179,7 @@ static long mv64x60_wdt_ioctl(struct file *file, ...@@ -179,7 +179,7 @@ static long mv64x60_wdt_ioctl(struct file *file,
int timeout; int timeout;
int options; int options;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
static struct watchdog_info info = { static const struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE | WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
......
...@@ -407,7 +407,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, ...@@ -407,7 +407,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd,
int __user *i; int __user *i;
} uarg; } uarg;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -606,7 +606,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -606,7 +606,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int temperature; int temperature;
int new_heartbeat; int new_heartbeat;
int __user *argp = (int __user *)arg; int __user *argp = (int __user *)arg;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_OVERHEAT | .options = WDIOF_OVERHEAT |
WDIOF_CARDRESET | WDIOF_CARDRESET |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -481,7 +481,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -481,7 +481,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_OVERHEAT | .options = WDIOF_OVERHEAT |
WDIOF_CARDRESET | WDIOF_CARDRESET |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
......
...@@ -404,7 +404,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, ...@@ -404,7 +404,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -52,7 +52,7 @@ static struct { ...@@ -52,7 +52,7 @@ static struct {
struct timer_list timer; /* The timer that pings the watchdog */ struct timer_list timer; /* The timer that pings the watchdog */
} pikawdt_private; } pikawdt_private;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.identity = DRV_NAME, .identity = DRV_NAME,
.options = WDIOF_CARDRESET | .options = WDIOF_CARDRESET |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
......
...@@ -141,7 +141,7 @@ static long pnx833x_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -141,7 +141,7 @@ static long pnx833x_wdt_ioctl(struct file *file, unsigned int cmd,
int options, new_timeout = 0; int options, new_timeout = 0;
uint32_t timeout, timeout_left = 0; uint32_t timeout, timeout_left = 0;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
.firmware_version = 0, .firmware_version = 0,
.identity = "Hardware Watchdog for PNX833x", .identity = "Hardware Watchdog for PNX833x",
......
...@@ -198,7 +198,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -198,7 +198,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int new_timeout; int new_timeout;
unsigned int value; unsigned int value;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | .options = WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING | WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -149,7 +149,7 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -149,7 +149,7 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
unsigned int value; unsigned int value;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET, .options = WDIOF_CARDRESET,
.identity = "RDC321x WDT", .identity = "RDC321x WDT",
}; };
......
...@@ -85,7 +85,7 @@ static int riowd_release(struct inode *inode, struct file *filp) ...@@ -85,7 +85,7 @@ static int riowd_release(struct inode *inode, struct file *filp)
static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ {
static struct watchdog_info info = { static const struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT, .options = WDIOF_SETTIMEOUT,
.firmware_version = 1, .firmware_version = 1,
.identity = DRIVER_NAME, .identity = DRIVER_NAME,
......
...@@ -111,7 +111,7 @@ static ssize_t fitpc2_wdt_write(struct file *file, const char *data, ...@@ -111,7 +111,7 @@ static ssize_t fitpc2_wdt_write(struct file *file, const char *data,
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
.identity = WATCHDOG_NAME, .identity = WATCHDOG_NAME,
......
...@@ -250,7 +250,7 @@ static long sch311x_wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -250,7 +250,7 @@ static long sch311x_wdt_ioctl(struct file *file, unsigned int cmd,
int new_timeout; int new_timeout;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | .options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
......
...@@ -94,7 +94,7 @@ static ssize_t stmp3xxx_wdt_write(struct file *file, const char __user *data, ...@@ -94,7 +94,7 @@ static ssize_t stmp3xxx_wdt_write(struct file *file, const char __user *data,
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_CARDRESET | .options = WDIOF_CARDRESET |
WDIOF_MAGICCLOSE | WDIOF_MAGICCLOSE |
WDIOF_SETTIMEOUT | WDIOF_SETTIMEOUT |
......
This diff is collapsed.
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -166,14 +165,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd, ...@@ -166,14 +165,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd,
} }
} }
static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
if (code == SYS_DOWN || code == SYS_HALT)
txx9wdt_stop();
return NOTIFY_DONE;
}
static const struct file_operations txx9wdt_fops = { static const struct file_operations txx9wdt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
...@@ -189,10 +180,6 @@ static struct miscdevice txx9wdt_miscdev = { ...@@ -189,10 +180,6 @@ static struct miscdevice txx9wdt_miscdev = {
.fops = &txx9wdt_fops, .fops = &txx9wdt_fops,
}; };
static struct notifier_block txx9wdt_notifier = {
.notifier_call = txx9wdt_notify_sys,
};
static int __init txx9wdt_probe(struct platform_device *dev) static int __init txx9wdt_probe(struct platform_device *dev)
{ {
struct resource *res; struct resource *res;
...@@ -221,13 +208,8 @@ static int __init txx9wdt_probe(struct platform_device *dev) ...@@ -221,13 +208,8 @@ static int __init txx9wdt_probe(struct platform_device *dev)
if (!txx9wdt_reg) if (!txx9wdt_reg)
goto exit_busy; goto exit_busy;
ret = register_reboot_notifier(&txx9wdt_notifier);
if (ret)
goto exit;
ret = misc_register(&txx9wdt_miscdev); ret = misc_register(&txx9wdt_miscdev);
if (ret) { if (ret) {
unregister_reboot_notifier(&txx9wdt_notifier);
goto exit; goto exit;
} }
...@@ -249,14 +231,19 @@ static int __init txx9wdt_probe(struct platform_device *dev) ...@@ -249,14 +231,19 @@ static int __init txx9wdt_probe(struct platform_device *dev)
static int __exit txx9wdt_remove(struct platform_device *dev) static int __exit txx9wdt_remove(struct platform_device *dev)
{ {
misc_deregister(&txx9wdt_miscdev); misc_deregister(&txx9wdt_miscdev);
unregister_reboot_notifier(&txx9wdt_notifier);
clk_disable(txx9_imclk); clk_disable(txx9_imclk);
clk_put(txx9_imclk); clk_put(txx9_imclk);
return 0; return 0;
} }
static void txx9wdt_shutdown(struct platform_device *dev)
{
txx9wdt_stop();
}
static struct platform_driver txx9wdt_driver = { static struct platform_driver txx9wdt_driver = {
.remove = __exit_p(txx9wdt_remove), .remove = __exit_p(txx9wdt_remove),
.shutdown = txx9wdt_shutdown,
.driver = { .driver = {
.name = "txx9wdt", .name = "txx9wdt",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -201,7 +201,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -201,7 +201,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *p = argp; int __user *p = argp;
int new_timeout; int new_timeout;
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE, WDIOF_MAGICCLOSE,
.firmware_version = 1, .firmware_version = 1,
......
...@@ -371,7 +371,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, ...@@ -371,7 +371,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf,
* according to their available features. * according to their available features.
*/ */
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
.firmware_version = 1, .firmware_version = 1,
.identity = WATCHDOG_NAME, .identity = WATCHDOG_NAME,
......
...@@ -312,7 +312,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd, ...@@ -312,7 +312,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd,
{ {
int __user *argp = (void __user *)arg; int __user *argp = (void __user *)arg;
int i; int i;
static struct watchdog_info wdinfo = { static const struct watchdog_info wdinfo = {
.options = WDRTAS_SUPPORTED_MASK, .options = WDRTAS_SUPPORTED_MASK,
.firmware_version = 0, .firmware_version = 0,
.identity = "wdrtas", .identity = "wdrtas",
......
...@@ -358,7 +358,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -358,7 +358,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int new_heartbeat; int new_heartbeat;
int status; int status;
static struct watchdog_info ident = { struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT| .options = WDIOF_SETTIMEOUT|
WDIOF_MAGICCLOSE| WDIOF_MAGICCLOSE|
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
......
...@@ -412,7 +412,7 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd, ...@@ -412,7 +412,7 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd,
int new_heartbeat; int new_heartbeat;
int status; int status;
static struct watchdog_info ident = { struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT| .options = WDIOF_SETTIMEOUT|
WDIOF_MAGICCLOSE| WDIOF_MAGICCLOSE|
WDIOF_KEEPALIVEPING, WDIOF_KEEPALIVEPING,
......
...@@ -213,7 +213,7 @@ static ssize_t wm831x_wdt_write(struct file *file, ...@@ -213,7 +213,7 @@ static ssize_t wm831x_wdt_write(struct file *file,
return count; return count;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.identity = "WM831x Watchdog", .identity = "WM831x Watchdog",
}; };
......
...@@ -177,7 +177,7 @@ static ssize_t wm8350_wdt_write(struct file *file, ...@@ -177,7 +177,7 @@ static ssize_t wm8350_wdt_write(struct file *file,
return count; return count;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.identity = "WM8350 Watchdog", .identity = "WM8350 Watchdog",
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment