Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-wat…
Browse files Browse the repository at this point in the history
…chdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog: (70 commits)
  [WATCHDOG] more coding style clean-up's
  [WATCHDOG] sbc8360.c - move stop code into a function
  [WATCHDOG] Coding style - Indentation - part 2
  [WATCHDOG] Coding style - Indentation - part 1
  [WATCHDOG] mpc8xxx_wdt: add support for MPC8xx watchdogs
  [WATCHDOG] mpc8xxx_wdt: fix build
  [WATCHDOG] mpc8xxx_wdt: various renames, mostly s/mpc83xx/mpc8xxx/g
  [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
  [WATCHDOG] mpc83xx_wdt: add support for MPC86xx CPUs
  [WATCHDOG] mpc83xx_wdt: convert to the OF platform driver
  [WATCHDOG] pcwd: a couple of watchdogs escaped conversion
  [WATCHDOG] Clean-up includes
  [WATCHDOG] hpwdt.c - fix double includes
  [WATCHDOG 57/57] wdt501/pci: Clean up, coding style and switch to unlocked_ioctl
  [WATCHDOG 56/57] wdt977: clean up, coding style and switch to unlocked_ioctl
  [WATCHDOG 55/57] wdt285: switch to unlocked_ioctl and tidy up oddments of coding style
  [WATCHDOG 54/57] wdrtas: clean up, coding style, switch to unlocked_ioctl
  [WATCHDOG 53/57] wafer5823wdt: Clean up, coding style, switch to unlocked_ioctl
  [WATCHDOG 52/57] w83977f_wdt: clean up, coding style and switch to unlocked_ioctl
  [WATCHDOG 51/57] w83877f_wdt: clean up code, coding style, switch to unlocked_ioctl
  ...
  • Loading branch information
Linus Torvalds committed Aug 8, 2008
2 parents 3df302f + 7944d3a commit b588e2b
Show file tree
Hide file tree
Showing 70 changed files with 3,837 additions and 3,746 deletions.
16 changes: 12 additions & 4 deletions drivers/watchdog/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ config PC87413_WDT
module will be called pc87413_wdt.

Most people will say N.

config 60XX_WDT
tristate "SBC-60XX Watchdog Timer"
depends on X86
Expand Down Expand Up @@ -695,9 +695,17 @@ config 8xx_WDT
tristate "MPC8xx Watchdog Timer"
depends on 8xx

config 83xx_WDT
tristate "MPC83xx Watchdog Timer"
depends on PPC_83xx
config 8xxx_WDT
tristate "MPC8xxx Platform Watchdog Timer"
depends on PPC_8xx || PPC_83xx || PPC_86xx
help
This driver is for a SoC level watchdog that exists on some
Freescale PowerPC processors. So far this driver supports:
- MPC8xx watchdogs
- MPC83xx watchdogs
- MPC86xx watchdogs

For BookE processors (MPC85xx) use the BOOKE_WDT driver instead.

config MV64X60_WDT
tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
Expand Down
4 changes: 2 additions & 2 deletions drivers/watchdog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o

# MIPS Architecture
obj-$(CONFIG_INDYDOG) += indydog.o
obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
Expand All @@ -103,7 +103,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
# POWERPC Architecture
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o
obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o

Expand Down
130 changes: 63 additions & 67 deletions drivers/watchdog/acquirewdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,39 +58,45 @@
#include <linux/types.h> /* For standard types (like size_t) */
#include <linux/errno.h> /* For the -ENODEV/... values */
#include <linux/kernel.h> /* For printk/panic/... */
#include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
#include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV
(WATCHDOG_MINOR) */
#include <linux/watchdog.h> /* For the watchdog specific items */
#include <linux/fs.h> /* For file operations */
#include <linux/ioport.h> /* For io-port access */
#include <linux/platform_device.h> /* For platform_driver framework */
#include <linux/init.h> /* For __init/__exit/... */

#include <asm/uaccess.h> /* For copy_to_user/put_user/... */
#include <asm/io.h> /* For inb/outb/... */
#include <linux/uaccess.h> /* For copy_to_user/put_user/... */
#include <linux/io.h> /* For inb/outb/... */

/* Module information */
#define DRV_NAME "acquirewdt"
#define PFX DRV_NAME ": "
#define WATCHDOG_NAME "Acquire WDT"
#define WATCHDOG_HEARTBEAT 0 /* There is no way to see what the correct time-out period is */
/* There is no way to see what the correct time-out period is */
#define WATCHDOG_HEARTBEAT 0

/* internal variables */
static struct platform_device *acq_platform_device; /* the watchdog platform device */
/* the watchdog platform device */
static struct platform_device *acq_platform_device;
static unsigned long acq_is_open;
static char expect_close;

/* module parameters */
static int wdt_stop = 0x43; /* You must set this - there is no sane way to probe for this board. */
/* You must set this - there is no sane way to probe for this board. */
static int wdt_stop = 0x43;
module_param(wdt_stop, int, 0);
MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)");

static int wdt_start = 0x443; /* You must set this - there is no sane way to probe for this board. */
/* You must set this - there is no sane way to probe for this board. */
static int wdt_start = 0x443;
module_param(wdt_start, int, 0);
MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");

static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");

/*
* Watchdog Operations
Expand All @@ -112,18 +118,18 @@ static void acq_stop(void)
* /dev/watchdog handling
*/

static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
static ssize_t acq_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
/* See if we got the magic character 'V' and reload the timer */
if(count) {
if (count) {
if (!nowayout) {
size_t i;

/* note: just in case someone wrote the magic character
* five months ago... */
five months ago... */
expect_close = 0;

/* scan to see whether or not we got the magic character */
/* scan to see whether or not we got the
magic character */
for (i = 0; i != count; i++) {
char c;
if (get_user(c, buf + i))
Expand All @@ -132,64 +138,55 @@ static ssize_t acq_write(struct file *file, const char __user *buf, size_t count
expect_close = 42;
}
}

/* Well, anyhow someone wrote to us, we should return that favour */
/* Well, anyhow someone wrote to us, we should
return that favour */
acq_keepalive();
}
return count;
}

static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int options, retval = -EINVAL;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident =
{
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = WATCHDOG_NAME,
};

switch(cmd)
{
switch (cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;

case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);

case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;

case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);
return put_user(0, p);

case WDIOC_SETOPTIONS:
{
if (get_user(options, p))
return -EFAULT;

if (options & WDIOS_DISABLECARD)
{
acq_stop();
retval = 0;
}

if (options & WDIOS_ENABLECARD)
{
acq_keepalive();
retval = 0;
}

return retval;
if (get_user(options, p))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
acq_stop();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
acq_keepalive();
retval = 0;
}
return retval;
}
case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;

case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);

default:
return -ENOTTY;
return -ENOTTY;
}
}

Expand All @@ -211,7 +208,8 @@ static int acq_close(struct inode *inode, struct file *file)
if (expect_close == 42) {
acq_stop();
} else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
printk(KERN_CRIT PFX
"Unexpected close, not stopping watchdog!\n");
acq_keepalive();
}
clear_bit(0, &acq_is_open);
Expand All @@ -227,7 +225,7 @@ static const struct file_operations acq_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = acq_write,
.ioctl = acq_ioctl,
.unlocked_ioctl = acq_ioctl,
.open = acq_open,
.release = acq_close,
};
Expand All @@ -248,32 +246,29 @@ static int __devinit acq_probe(struct platform_device *dev)

if (wdt_stop != wdt_start) {
if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
wdt_stop);
printk(KERN_ERR PFX
"I/O address 0x%04x already in use\n", wdt_stop);
ret = -EIO;
goto out;
}
}

if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
wdt_start);
ret = -EIO;
goto unreg_stop;
}

ret = misc_register(&acq_miscdev);
if (ret != 0) {
printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
printk(KERN_ERR PFX
"cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
goto unreg_regions;
}

printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
nowayout);
printk(KERN_INFO PFX "initialized. (nowayout=%d)\n", nowayout);

return 0;

unreg_regions:
release_region(wdt_start, 1);
unreg_stop:
Expand All @@ -286,9 +281,9 @@ static int __devinit acq_probe(struct platform_device *dev)
static int __devexit acq_remove(struct platform_device *dev)
{
misc_deregister(&acq_miscdev);
release_region(wdt_start,1);
if(wdt_stop != wdt_start)
release_region(wdt_stop,1);
release_region(wdt_start, 1);
if (wdt_stop != wdt_start)
release_region(wdt_stop, 1);

return 0;
}
Expand All @@ -313,18 +308,19 @@ static int __init acq_init(void)
{
int err;

printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
printk(KERN_INFO
"WDT driver for Acquire single board computer initialising.\n");

err = platform_driver_register(&acquirewdt_driver);
if (err)
return err;

acq_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
acq_platform_device = platform_device_register_simple(DRV_NAME,
-1, NULL, 0);
if (IS_ERR(acq_platform_device)) {
err = PTR_ERR(acq_platform_device);
goto unreg_platform_driver;
}

return 0;

unreg_platform_driver:
Expand Down
Loading

0 comments on commit b588e2b

Please sign in to comment.