Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a5ab05a5
Commit
a5ab05a5
authored
Jan 19, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://linux-watchdog.bkbits.net/linux-2.6-watchdog
into home.osdl.org:/home/torvalds/v2.5/linux
parents
0010bc50
30cbd07c
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
524 additions
and
529 deletions
+524
-529
drivers/char/watchdog/acquirewdt.c
drivers/char/watchdog/acquirewdt.c
+24
-24
drivers/char/watchdog/advantechwdt.c
drivers/char/watchdog/advantechwdt.c
+1
-1
drivers/char/watchdog/alim1535_wdt.c
drivers/char/watchdog/alim1535_wdt.c
+2
-2
drivers/char/watchdog/alim7101_wdt.c
drivers/char/watchdog/alim7101_wdt.c
+1
-1
drivers/char/watchdog/amd7xx_tco.c
drivers/char/watchdog/amd7xx_tco.c
+47
-36
drivers/char/watchdog/cpu5wdt.c
drivers/char/watchdog/cpu5wdt.c
+13
-21
drivers/char/watchdog/eurotechwdt.c
drivers/char/watchdog/eurotechwdt.c
+47
-47
drivers/char/watchdog/i810-tco.c
drivers/char/watchdog/i810-tco.c
+22
-18
drivers/char/watchdog/ib700wdt.c
drivers/char/watchdog/ib700wdt.c
+29
-37
drivers/char/watchdog/indydog.c
drivers/char/watchdog/indydog.c
+10
-9
drivers/char/watchdog/machzwd.c
drivers/char/watchdog/machzwd.c
+68
-80
drivers/char/watchdog/mixcomwd.c
drivers/char/watchdog/mixcomwd.c
+26
-25
drivers/char/watchdog/pcwd.c
drivers/char/watchdog/pcwd.c
+40
-39
drivers/char/watchdog/sa1100_wdt.c
drivers/char/watchdog/sa1100_wdt.c
+1
-0
drivers/char/watchdog/sbc60xxwdt.c
drivers/char/watchdog/sbc60xxwdt.c
+1
-1
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc1200wdt.c
+9
-9
drivers/char/watchdog/scx200_wdt.c
drivers/char/watchdog/scx200_wdt.c
+29
-29
drivers/char/watchdog/shwdt.c
drivers/char/watchdog/shwdt.c
+7
-7
drivers/char/watchdog/softdog.c
drivers/char/watchdog/softdog.c
+15
-14
drivers/char/watchdog/w83627hf_wdt.c
drivers/char/watchdog/w83627hf_wdt.c
+1
-1
drivers/char/watchdog/w83877f_wdt.c
drivers/char/watchdog/w83877f_wdt.c
+1
-1
drivers/char/watchdog/wafer5823wdt.c
drivers/char/watchdog/wafer5823wdt.c
+2
-2
drivers/char/watchdog/wdt.c
drivers/char/watchdog/wdt.c
+60
-59
drivers/char/watchdog/wdt285.c
drivers/char/watchdog/wdt285.c
+6
-6
drivers/char/watchdog/wdt977.c
drivers/char/watchdog/wdt977.c
+8
-7
drivers/char/watchdog/wdt_pci.c
drivers/char/watchdog/wdt_pci.c
+54
-53
No files found.
drivers/char/watchdog/acquirewdt.c
View file @
a5ab05a5
...
@@ -100,7 +100,7 @@ static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_
...
@@ -100,7 +100,7 @@ static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_
* five months ago... */
* five months ago... */
expect_close
=
0
;
expect_close
=
0
;
/* scan to see wether or not we got the magic character */
/* scan to see w
h
ether or not we got the magic character */
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
char
c
;
char
c
;
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
...
...
drivers/char/watchdog/advantechwdt.c
View file @
a5ab05a5
...
@@ -183,7 +183,7 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -183,7 +183,7 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
}
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
...
drivers/char/watchdog/alim1535_wdt.c
View file @
a5ab05a5
...
@@ -153,7 +153,7 @@ static ssize_t ali_write(struct file *file, const char *data,
...
@@ -153,7 +153,7 @@ static ssize_t ali_write(struct file *file, const char *data,
* five months ago... */
* five months ago... */
ali_expect_release
=
0
;
ali_expect_release
=
0
;
/* scan to see wether or not we got the magic character */
/* scan to see w
h
ether or not we got the magic character */
for
(
i
=
0
;
i
!=
len
;
i
++
)
{
for
(
i
=
0
;
i
!=
len
;
i
++
)
{
char
c
;
char
c
;
if
(
get_user
(
c
,
data
+
i
))
if
(
get_user
(
c
,
data
+
i
))
...
@@ -402,7 +402,7 @@ static int __init watchdog_init(void)
...
@@ -402,7 +402,7 @@ static int __init watchdog_init(void)
spin_lock_init
(
&
ali_lock
);
spin_lock_init
(
&
ali_lock
);
/* Check wether or not the hardware watchdog is there */
/* Check w
h
ether or not the hardware watchdog is there */
if
(
ali_find_watchdog
()
!=
0
)
{
if
(
ali_find_watchdog
()
!=
0
)
{
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
...
drivers/char/watchdog/alim7101_wdt.c
View file @
a5ab05a5
drivers/char/watchdog/amd7xx_tco.c
View file @
a5ab05a5
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include <linux/config.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/watchdog.h>
...
@@ -57,11 +58,20 @@ static u32 pmbase; /* PMxx I/O base */
...
@@ -57,11 +58,20 @@ static u32 pmbase; /* PMxx I/O base */
static
struct
pci_dev
*
dev
;
static
struct
pci_dev
*
dev
;
static
struct
semaphore
open_sem
;
static
struct
semaphore
open_sem
;
static
spinlock_t
amdtco_lock
;
/* only for device access */
static
spinlock_t
amdtco_lock
;
/* only for device access */
static
int
expect_close
=
0
;
static
char
expect_close
;
MODULE_PARM
(
timeout
,
"i"
);
module_param
(
timeout
,
int
,
0
);
MODULE_PARM_DESC
(
timeout
,
"range is 0-38 seconds, default is 38"
);
MODULE_PARM_DESC
(
timeout
,
"range is 0-38 seconds, default is 38"
);
#ifdef CONFIG_WATCHDOG_NOWAYOUT
static
int
nowayout
=
1
;
#else
static
int
nowayout
=
0
;
#endif
module_param
(
nowayout
,
int
,
0
);
MODULE_PARM_DESC
(
nowayout
,
"Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"
);
static
inline
u8
seconds_to_ticks
(
int
seconds
)
static
inline
u8
seconds_to_ticks
(
int
seconds
)
{
{
/* the internal timer is stored as ticks which decrement
/* the internal timer is stored as ticks which decrement
...
@@ -170,12 +180,12 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int
...
@@ -170,12 +180,12 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int
static
struct
watchdog_info
ident
=
{
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
|
WDIOF_CARDRESET
,
.
options
=
WDIOF_SETTIMEOUT
|
WDIOF_CARDRESET
,
.
identity
=
"AMD 766/768"
.
identity
=
"AMD 766/768"
,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
ident
))
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
ident
))
...
@@ -223,7 +233,7 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int
...
@@ -223,7 +233,7 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int
static
int
amdtco_fop_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
amdtco_fop_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
amdtco_disable
();
amdtco_disable
();
printk
(
KERN_INFO
PFX
"Watchdog disabled
\n
"
);
printk
(
KERN_INFO
PFX
"Watchdog disabled
\n
"
);
}
else
{
}
else
{
...
@@ -231,6 +241,7 @@ static int amdtco_fop_release(struct inode *inode, struct file *file)
...
@@ -231,6 +241,7 @@ static int amdtco_fop_release(struct inode *inode, struct file *file)
printk
(
KERN_CRIT
PFX
"Unexpected close!, timeout in %d seconds
\n
"
,
timeout
);
printk
(
KERN_CRIT
PFX
"Unexpected close!, timeout in %d seconds
\n
"
,
timeout
);
}
}
expect_close
=
0
;
up
(
&
open_sem
);
up
(
&
open_sem
);
return
0
;
return
0
;
}
}
...
@@ -242,7 +253,7 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len,
...
@@ -242,7 +253,7 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len,
return
-
ESPIPE
;
return
-
ESPIPE
;
if
(
len
)
{
if
(
len
)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
if
(
!
nowayout
)
{
size_t
i
;
size_t
i
;
char
c
;
char
c
;
expect_close
=
0
;
expect_close
=
0
;
...
@@ -252,9 +263,9 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len,
...
@@ -252,9 +263,9 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len,
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
#endif
amdtco_ping
();
amdtco_ping
();
}
}
...
@@ -273,7 +284,7 @@ static int amdtco_notify_sys(struct notifier_block *this, unsigned long code, vo
...
@@ -273,7 +284,7 @@ static int amdtco_notify_sys(struct notifier_block *this, unsigned long code, vo
static
struct
notifier_block
amdtco_notifier
=
static
struct
notifier_block
amdtco_notifier
=
{
{
.
notifier_call
=
amdtco_notify_sys
.
notifier_call
=
amdtco_notify_sys
,
};
};
static
struct
file_operations
amdtco_fops
=
static
struct
file_operations
amdtco_fops
=
...
@@ -282,20 +293,20 @@ static struct file_operations amdtco_fops =
...
@@ -282,20 +293,20 @@ static struct file_operations amdtco_fops =
.
write
=
amdtco_fop_write
,
.
write
=
amdtco_fop_write
,
.
ioctl
=
amdtco_fop_ioctl
,
.
ioctl
=
amdtco_fop_ioctl
,
.
open
=
amdtco_fop_open
,
.
open
=
amdtco_fop_open
,
.
release
=
amdtco_fop_release
.
release
=
amdtco_fop_release
,
};
};
static
struct
miscdevice
amdtco_miscdev
=
static
struct
miscdevice
amdtco_miscdev
=
{
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
amdtco_fops
.
fops
=
&
amdtco_fops
,
};
};
static
struct
pci_device_id
amdtco_pci_tbl
[]
=
{
static
struct
pci_device_id
amdtco_pci_tbl
[]
=
{
/* AMD 766 PCI_IDs here */
/* AMD 766 PCI_IDs here */
{
PCI_VENDOR_ID_AMD
,
PCI_DEVICE_ID_AMD_OPUS_7443
,
PCI_ANY_ID
,
PCI_ANY_ID
,
},
{
PCI_VENDOR_ID_AMD
,
PCI_DEVICE_ID_AMD_OPUS_7443
,
PCI_ANY_ID
,
PCI_ANY_ID
,
},
{
0
,
}
{
0
,
}
,
};
};
MODULE_DEVICE_TABLE
(
pci
,
amdtco_pci_tbl
);
MODULE_DEVICE_TABLE
(
pci
,
amdtco_pci_tbl
);
...
...
drivers/char/watchdog/cpu5wdt.c
View file @
a5ab05a5
...
@@ -134,23 +134,15 @@ static int cpu5wdt_stop(void)
...
@@ -134,23 +134,15 @@ static int cpu5wdt_stop(void)
static
int
cpu5wdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
cpu5wdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
switch
(
iminor
(
inode
))
{
case
WATCHDOG_MINOR
:
if
(
test_and_set_bit
(
0
,
&
cpu5wdt_device
.
inuse
)
)
if
(
test_and_set_bit
(
0
,
&
cpu5wdt_device
.
inuse
)
)
return
-
EBUSY
;
return
-
EBUSY
;
break
;
default:
return
-
ENODEV
;
}
return
0
;
return
0
;
}
}
static
int
cpu5wdt_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
cpu5wdt_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
clear_bit
(
0
,
&
cpu5wdt_device
.
inuse
);
clear_bit
(
0
,
&
cpu5wdt_device
.
inuse
);
}
return
0
;
return
0
;
}
}
...
@@ -160,7 +152,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
...
@@ -160,7 +152,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
static
struct
watchdog_info
ident
=
static
struct
watchdog_info
ident
=
{
{
.
options
=
WDIOF_CARDRESET
,
.
options
=
WDIOF_CARDRESET
,
.
identity
=
"CPU5 WDT"
.
identity
=
"CPU5 WDT"
,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
...
@@ -191,7 +183,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
...
@@ -191,7 +183,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
}
}
break
;
break
;
default:
default:
return
-
E
INVAL
;
return
-
E
NOIOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
@@ -217,7 +209,7 @@ static struct file_operations cpu5wdt_fops = {
...
@@ -217,7 +209,7 @@ static struct file_operations cpu5wdt_fops = {
static
struct
miscdevice
cpu5wdt_misc
=
{
static
struct
miscdevice
cpu5wdt_misc
=
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
cpu5wdt_fops
.
fops
=
&
cpu5wdt_fops
,
};
};
/* init/exit function */
/* init/exit function */
...
...
drivers/char/watchdog/eurotechwdt.c
View file @
a5ab05a5
/*
/*
* Eurotech CPU-1220/1410 on board WDT driver
for Linux 2.4.x
* Eurotech CPU-1220/1410 on board WDT driver
*
*
* (c) Copyright 2001 Ascensit <support@ascensit.com>
* (c) Copyright 2001 Ascensit <support@ascensit.com>
* (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com>
* (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com>
...
@@ -277,7 +277,7 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
...
@@ -277,7 +277,7 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
...
@@ -406,7 +406,7 @@ static struct file_operations eurwdt_fops = {
...
@@ -406,7 +406,7 @@ static struct file_operations eurwdt_fops = {
static
struct
miscdevice
eurwdt_miscdev
=
{
static
struct
miscdevice
eurwdt_miscdev
=
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
eurwdt_fops
.
fops
=
&
eurwdt_fops
,
};
};
/*
/*
...
...
drivers/char/watchdog/i810-tco.c
View file @
a5ab05a5
...
@@ -197,7 +197,7 @@ static int i810tco_release (struct inode *inode, struct file *file)
...
@@ -197,7 +197,7 @@ static int i810tco_release (struct inode *inode, struct file *file)
/*
/*
* Shut off the timer.
* Shut off the timer.
*/
*/
if
(
tco_expect_close
==
42
&&
!
nowayout
)
{
if
(
tco_expect_close
==
42
)
{
tco_timer_stop
();
tco_timer_stop
();
}
else
{
}
else
{
tco_timer_reload
();
tco_timer_reload
();
...
@@ -217,8 +217,11 @@ static ssize_t i810tco_write (struct file *file, const char *data,
...
@@ -217,8 +217,11 @@ static ssize_t i810tco_write (struct file *file, const char *data,
/* See if we got the magic character 'V' and reload the timer */
/* See if we got the magic character 'V' and reload the timer */
if
(
len
)
{
if
(
len
)
{
if
(
!
nowayout
)
{
size_t
i
;
size_t
i
;
/* note: just in case someone wrote the magic character
* five months ago... */
tco_expect_close
=
0
;
tco_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 */
...
@@ -229,6 +232,7 @@ static ssize_t i810tco_write (struct file *file, const char *data,
...
@@ -229,6 +232,7 @@ static ssize_t i810tco_write (struct file *file, const char *data,
if
(
c
==
'V'
)
if
(
c
==
'V'
)
tco_expect_close
=
42
;
tco_expect_close
=
42
;
}
}
}
/* someone wrote to us, we should reload the timer */
/* someone wrote to us, we should reload the timer */
tco_timer_reload
();
tco_timer_reload
();
...
@@ -251,7 +255,7 @@ static int i810tco_ioctl (struct inode *inode, struct file *file,
...
@@ -251,7 +255,7 @@ static int i810tco_ioctl (struct inode *inode, struct file *file,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
...
...
drivers/char/watchdog/ib700wdt.c
View file @
a5ab05a5
/*
/*
* IB700 Single Board Computer WDT driver
for Linux 2.4.x
* IB700 Single Board Computer WDT driver
*
*
* (c) Copyright 2001 Charles Howes <chowes@vsol.net>
* (c) Copyright 2001 Charles Howes <chowes@vsol.net>
*
*
...
@@ -48,9 +48,9 @@
...
@@ -48,9 +48,9 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/system.h>
static
int
ibwdt_is_open
;
static
unsigned
long
ibwdt_is_open
;
static
spinlock_t
ibwdt_lock
;
static
spinlock_t
ibwdt_lock
;
static
int
expect_close
=
0
;
static
char
expect_close
;
#define PFX "ib700wdt: "
#define PFX "ib700wdt: "
...
@@ -157,7 +157,7 @@ ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
...
@@ -157,7 +157,7 @@ ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
ibwdt_ping
();
ibwdt_ping
();
...
@@ -174,7 +174,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -174,7 +174,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
struct
watchdog_info
ident
=
{
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
.
firmware_version
=
1
,
.
identity
=
"IB700 WDT"
.
identity
=
"IB700 WDT"
,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
...
@@ -184,9 +184,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -184,9 +184,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETSTATUS
:
if
(
copy_to_user
((
int
*
)
arg
,
&
ibwdt_is_open
,
sizeof
(
int
)))
return
put_user
(
0
,
(
int
*
)
arg
);
return
-
EFAULT
;
break
;
case
WDIOC_KEEPALIVE
:
case
WDIOC_KEEPALIVE
:
ibwdt_ping
();
ibwdt_ping
();
...
@@ -209,7 +207,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -209,7 +207,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break
;
break
;
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
@@ -217,9 +215,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -217,9 +215,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
int
static
int
ibwdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
ibwdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
spin_lock
(
&
ibwdt_lock
);
spin_lock
(
&
ibwdt_lock
);
if
(
ibwdt_is_open
)
{
if
(
test_and_set_bit
(
0
,
&
ibwdt_is_open
)
)
{
spin_unlock
(
&
ibwdt_lock
);
spin_unlock
(
&
ibwdt_lock
);
return
-
EBUSY
;
return
-
EBUSY
;
}
}
...
@@ -227,28 +224,23 @@ ibwdt_open(struct inode *inode, struct file *file)
...
@@ -227,28 +224,23 @@ ibwdt_open(struct inode *inode, struct file *file)
__module_get
(
THIS_MODULE
);
__module_get
(
THIS_MODULE
);
/* Activate */
/* Activate */
ibwdt_is_open
=
1
;
ibwdt_ping
();
ibwdt_ping
();
spin_unlock
(
&
ibwdt_lock
);
spin_unlock
(
&
ibwdt_lock
);
return
0
;
return
0
;
}
else
{
return
-
ENODEV
;
}
}
}
static
int
static
int
ibwdt_close
(
struct
inode
*
inode
,
struct
file
*
file
)
ibwdt_close
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
spin_lock
(
&
ibwdt_lock
);
spin_lock
(
&
ibwdt_lock
);
if
(
expect_close
)
if
(
expect_close
==
42
)
outb_p
(
wd_times
[
wd_margin
],
WDT_STOP
);
outb_p
(
wd_times
[
wd_margin
],
WDT_STOP
);
else
else
printk
(
KERN_CRIT
PFX
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
printk
(
KERN_CRIT
PFX
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
ibwdt_is_open
=
0
;
clear_bit
(
0
,
&
ibwdt_is_open
);
expect_close
=
0
;
spin_unlock
(
&
ibwdt_lock
);
spin_unlock
(
&
ibwdt_lock
);
}
return
0
;
return
0
;
}
}
...
@@ -282,7 +274,7 @@ static struct file_operations ibwdt_fops = {
...
@@ -282,7 +274,7 @@ static struct file_operations ibwdt_fops = {
static
struct
miscdevice
ibwdt_miscdev
=
{
static
struct
miscdevice
ibwdt_miscdev
=
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
ibwdt_fops
.
fops
=
&
ibwdt_fops
,
};
};
/*
/*
...
@@ -293,7 +285,7 @@ static struct miscdevice ibwdt_miscdev = {
...
@@ -293,7 +285,7 @@ static struct miscdevice ibwdt_miscdev = {
static
struct
notifier_block
ibwdt_notifier
=
{
static
struct
notifier_block
ibwdt_notifier
=
{
.
notifier_call
=
ibwdt_notify_sys
,
.
notifier_call
=
ibwdt_notify_sys
,
.
next
=
NULL
,
.
next
=
NULL
,
.
priority
=
0
.
priority
=
0
,
};
};
static
int
__init
ibwdt_init
(
void
)
static
int
__init
ibwdt_init
(
void
)
...
...
drivers/char/watchdog/indydog.c
View file @
a5ab05a5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
static
unsigned
long
indydog_alive
;
static
unsigned
long
indydog_alive
;
static
struct
sgimc_misc_ctrl
*
mcmisc_regs
;
static
struct
sgimc_misc_ctrl
*
mcmisc_regs
;
static
int
expect_close
=
0
;
static
char
expect_close
;
#ifdef CONFIG_WATCHDOG_NOWAYOUT
#ifdef CONFIG_WATCHDOG_NOWAYOUT
static
int
nowayout
=
1
;
static
int
nowayout
=
1
;
...
@@ -77,7 +77,7 @@ static int indydog_release(struct inode *inode, struct file *file)
...
@@ -77,7 +77,7 @@ static int indydog_release(struct inode *inode, struct file *file)
* Lock it in if it's a module and we set nowayout
* Lock it in if it's a module and we set nowayout
*/
*/
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
u32
mc_ctrl0
=
mcmisc_regs
->
cpuctrl0
;
u32
mc_ctrl0
=
mcmisc_regs
->
cpuctrl0
;
mc_ctrl0
&=
~
SGIMC_CCTRL0_WDOG
;
mc_ctrl0
&=
~
SGIMC_CCTRL0_WDOG
;
mcmisc_regs
->
cpuctrl0
=
mc_ctrl0
;
mcmisc_regs
->
cpuctrl0
=
mc_ctrl0
;
...
@@ -86,6 +86,7 @@ static int indydog_release(struct inode *inode, struct file *file)
...
@@ -86,6 +86,7 @@ static int indydog_release(struct inode *inode, struct file *file)
printk
(
KERN_CRIT
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
printk
(
KERN_CRIT
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
}
}
clear_bit
(
0
,
&
indydog_alive
);
clear_bit
(
0
,
&
indydog_alive
);
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
@@ -109,7 +110,7 @@ static ssize_t indydog_write(struct file *file, const char *data, size_t len, lo
...
@@ -109,7 +110,7 @@ static ssize_t indydog_write(struct file *file, const char *data, size_t len, lo
if
(
get_user
(
c
,
data
+
i
))
if
(
get_user
(
c
,
data
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
indydog_ping
();
indydog_ping
();
...
...
drivers/char/watchdog/machzwd.c
View file @
a5ab05a5
...
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CON
...
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CON
static
struct
watchdog_info
zf_info
=
{
static
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"
,
};
};
...
@@ -130,8 +130,8 @@ module_param(action, int, 0);
...
@@ -130,8 +130,8 @@ module_param(action, int, 0);
MODULE_PARM_DESC
(
action
,
"after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"
);
MODULE_PARM_DESC
(
action
,
"after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"
);
static
int
zf_action
=
GEN_RESET
;
static
int
zf_action
=
GEN_RESET
;
static
int
zf_is_open
=
0
;
static
unsigned
long
zf_is_open
;
static
int
zf_expect_close
=
0
;
static
char
zf_expect_close
;
static
spinlock_t
zf_lock
;
static
spinlock_t
zf_lock
;
static
spinlock_t
zf_port_lock
;
static
spinlock_t
zf_port_lock
;
static
struct
timer_list
zf_timer
;
static
struct
timer_list
zf_timer
;
...
@@ -330,8 +330,8 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
...
@@ -330,8 +330,8 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
if
(
get_user
(
c
,
buf
+
ofs
))
if
(
get_user
(
c
,
buf
+
ofs
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
){
if
(
c
==
'V'
){
zf_expect_close
=
1
;
zf_expect_close
=
42
;
dprintk
(
"zf_expect_close
1
\n
"
);
dprintk
(
"zf_expect_close
= 42
\n
"
);
}
}
}
}
}
}
...
@@ -359,16 +359,14 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -359,16 +359,14 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETSTATUS
:
if
(
copy_to_user
((
int
*
)
arg
,
&
zf_is_open
,
sizeof
(
int
)))
return
put_user
(
0
,
(
int
*
)
arg
);
return
-
EFAULT
;
break
;
case
WDIOC_KEEPALIVE
:
case
WDIOC_KEEPALIVE
:
zf_ping
(
0
);
zf_ping
(
0
);
break
;
break
;
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
...
@@ -376,10 +374,8 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -376,10 +374,8 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
int
zf_open
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
zf_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
switch
(
iminor
(
inode
)){
case
WATCHDOG_MINOR
:
spin_lock
(
&
zf_lock
);
spin_lock
(
&
zf_lock
);
if
(
zf_is_open
)
{
if
(
test_and_set_bit
(
0
,
&
zf_is_open
))
{
spin_unlock
(
&
zf_lock
);
spin_unlock
(
&
zf_lock
);
return
-
EBUSY
;
return
-
EBUSY
;
}
}
...
@@ -387,23 +383,16 @@ static int zf_open(struct inode *inode, struct file *file)
...
@@ -387,23 +383,16 @@ static int zf_open(struct inode *inode, struct file *file)
if
(
nowayout
)
if
(
nowayout
)
__module_get
(
THIS_MODULE
);
__module_get
(
THIS_MODULE
);
zf_is_open
=
1
;
spin_unlock
(
&
zf_lock
);
spin_unlock
(
&
zf_lock
);
zf_timer_on
();
zf_timer_on
();
return
0
;
return
0
;
default:
return
-
ENODEV
;
}
}
}
static
int
zf_close
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
zf_close
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
){
if
(
zf_expect_close
==
42
){
if
(
zf_expect_close
){
zf_timer_off
();
zf_timer_off
();
}
else
{
}
else
{
del_timer
(
&
zf_timer
);
del_timer
(
&
zf_timer
);
...
@@ -411,11 +400,10 @@ static int zf_close(struct inode *inode, struct file *file)
...
@@ -411,11 +400,10 @@ static int zf_close(struct inode *inode, struct file *file)
}
}
spin_lock
(
&
zf_lock
);
spin_lock
(
&
zf_lock
);
zf_is_open
=
0
;
clear_bit
(
0
,
&
zf_is_open
)
;
spin_unlock
(
&
zf_lock
);
spin_unlock
(
&
zf_lock
);
zf_expect_close
=
0
;
zf_expect_close
=
0
;
}
return
0
;
return
0
;
}
}
...
@@ -448,7 +436,7 @@ static struct file_operations zf_fops = {
...
@@ -448,7 +436,7 @@ static struct file_operations zf_fops = {
static
struct
miscdevice
zf_miscdev
=
{
static
struct
miscdevice
zf_miscdev
=
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
zf_fops
.
fops
=
&
zf_fops
,
};
};
...
@@ -459,7 +447,7 @@ static struct miscdevice zf_miscdev = {
...
@@ -459,7 +447,7 @@ static struct miscdevice zf_miscdev = {
static
struct
notifier_block
zf_notifier
=
{
static
struct
notifier_block
zf_notifier
=
{
.
notifier_call
=
zf_notify_sys
,
.
notifier_call
=
zf_notify_sys
,
.
next
=
NULL
,
.
next
=
NULL
,
.
priority
=
0
.
priority
=
0
,
};
};
static
void
__init
zf_show_action
(
int
act
)
static
void
__init
zf_show_action
(
int
act
)
...
...
drivers/char/watchdog/mixcomwd.c
View file @
a5ab05a5
...
@@ -55,12 +55,12 @@ static int mixcomwd_ioports[] = { 0x180, 0x280, 0x380, 0x000 };
...
@@ -55,12 +55,12 @@ static int mixcomwd_ioports[] = { 0x180, 0x280, 0x380, 0x000 };
#define FLASHCOM_WATCHDOG_OFFSET 0x4
#define FLASHCOM_WATCHDOG_OFFSET 0x4
#define FLASHCOM_ID 0x18
#define FLASHCOM_ID 0x18
static
long
mixcomwd_opened
;
/* long req'd for setbit --RR */
static
unsigned
long
mixcomwd_opened
;
/* long req'd for setbit --RR */
static
int
watchdog_port
;
static
int
watchdog_port
;
static
int
mixcomwd_timer_alive
;
static
int
mixcomwd_timer_alive
;
static
struct
timer_list
mixcomwd_timer
=
TIMER_INITIALIZER
(
NULL
,
0
,
0
);
static
struct
timer_list
mixcomwd_timer
=
TIMER_INITIALIZER
(
NULL
,
0
,
0
);
static
int
expect_close
=
0
;
static
char
expect_close
;
#ifdef CONFIG_WATCHDOG_NOWAYOUT
#ifdef CONFIG_WATCHDOG_NOWAYOUT
static
int
nowayout
=
1
;
static
int
nowayout
=
1
;
...
@@ -113,7 +113,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
...
@@ -113,7 +113,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
static
int
mixcomwd_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
mixcomwd_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
if
(
mixcomwd_timer_alive
)
{
if
(
mixcomwd_timer_alive
)
{
printk
(
KERN_ERR
"mixcomwd: release called while internal timer alive"
);
printk
(
KERN_ERR
"mixcomwd: release called while internal timer alive"
);
return
-
EBUSY
;
return
-
EBUSY
;
...
@@ -129,6 +129,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
...
@@ -129,6 +129,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
}
}
clear_bit
(
0
,
&
mixcomwd_opened
);
clear_bit
(
0
,
&
mixcomwd_opened
);
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
@@ -152,7 +153,7 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l
...
@@ -152,7 +153,7 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l
if
(
get_user
(
c
,
data
+
i
))
if
(
get_user
(
c
,
data
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
mixcomwd_ping
();
mixcomwd_ping
();
...
@@ -167,7 +168,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
...
@@ -167,7 +168,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
static
struct
watchdog_info
ident
=
{
static
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"
,
};
};
switch
(
cmd
)
switch
(
cmd
)
...
@@ -191,7 +192,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
...
@@ -191,7 +192,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
mixcomwd_ping
();
mixcomwd_ping
();
break
;
break
;
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
@@ -207,9 +208,9 @@ static struct file_operations mixcomwd_fops=
...
@@ -207,9 +208,9 @@ static struct file_operations mixcomwd_fops=
static
struct
miscdevice
mixcomwd_miscdev
=
static
struct
miscdevice
mixcomwd_miscdev
=
{
{
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
"watchdog"
,
.
name
=
"watchdog"
,
&
mixcomwd_fops
.
fops
=
&
mixcomwd_fops
,
};
};
static
int
__init
mixcomwd_checkcard
(
int
port
)
static
int
__init
mixcomwd_checkcard
(
int
port
)
...
...
drivers/char/watchdog/pcwd.c
View file @
a5ab05a5
...
@@ -86,7 +86,7 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
...
@@ -86,7 +86,7 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
#define WD_TIMEOUT 4
/* 2 seconds for a timeout */
#define WD_TIMEOUT 4
/* 2 seconds for a timeout */
static
int
timeout_val
=
WD_TIMEOUT
;
static
int
timeout_val
=
WD_TIMEOUT
;
static
int
timeout
=
2
;
static
int
timeout
=
2
;
static
int
expect_close
=
0
;
static
char
expect_close
;
module_param
(
timeout
,
int
,
0
);
module_param
(
timeout
,
int
,
0
);
MODULE_PARM_DESC
(
timeout
,
"Watchdog timeout in seconds (default=2)"
);
MODULE_PARM_DESC
(
timeout
,
"Watchdog timeout in seconds (default=2)"
);
...
@@ -248,14 +248,14 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
...
@@ -248,14 +248,14 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
int
cdat
,
rv
;
int
cdat
,
rv
;
static
struct
watchdog_info
ident
=
static
struct
watchdog_info
ident
=
{
{
WDIOF_OVERHEAT
|
WDIOF_CARDRESET
,
.
options
=
WDIOF_OVERHEAT
|
WDIOF_CARDRESET
,
1
,
.
firmware_version
=
1
,
"PCWD"
.
identity
=
"PCWD"
,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
void
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
((
void
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
...
@@ -415,7 +415,7 @@ static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
...
@@ -415,7 +415,7 @@ static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
pcwd_send_heartbeat
();
pcwd_send_heartbeat
();
...
@@ -477,7 +477,7 @@ static ssize_t pcwd_read(struct file *file, char *buf, size_t count,
...
@@ -477,7 +477,7 @@ static ssize_t pcwd_read(struct file *file, char *buf, size_t count,
static
int
pcwd_close
(
struct
inode
*
ino
,
struct
file
*
filep
)
static
int
pcwd_close
(
struct
inode
*
ino
,
struct
file
*
filep
)
{
{
if
(
iminor
(
ino
)
==
WATCHDOG_MINOR
)
{
if
(
iminor
(
ino
)
==
WATCHDOG_MINOR
)
{
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
/* Disable the board */
/* Disable the board */
if
(
revision
==
PCWD_REVISION_C
)
{
if
(
revision
==
PCWD_REVISION_C
)
{
spin_lock
(
&
io_lock
);
spin_lock
(
&
io_lock
);
...
@@ -488,6 +488,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
...
@@ -488,6 +488,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
atomic_inc
(
&
open_allowed
);
atomic_inc
(
&
open_allowed
);
}
}
}
}
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
@@ -576,15 +577,15 @@ static struct file_operations pcwd_fops = {
...
@@ -576,15 +577,15 @@ static struct file_operations pcwd_fops = {
};
};
static
struct
miscdevice
pcwd_miscdev
=
{
static
struct
miscdevice
pcwd_miscdev
=
{
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
"watchdog"
,
.
name
=
"watchdog"
,
&
pcwd_fops
.
fops
=
&
pcwd_fops
,
};
};
static
struct
miscdevice
temp_miscdev
=
{
static
struct
miscdevice
temp_miscdev
=
{
TEMP_MINOR
,
.
minor
=
TEMP_MINOR
,
"temperature"
,
.
name
=
"temperature"
,
&
pcwd_fops
.
fops
=
&
pcwd_fops
,
};
};
static
void
__init
pcwd_validate_timeout
(
void
)
static
void
__init
pcwd_validate_timeout
(
void
)
...
...
drivers/char/watchdog/sa1100_wdt.c
View file @
a5ab05a5
...
@@ -77,6 +77,7 @@ static int sa1100dog_release(struct inode *inode, struct file *file)
...
@@ -77,6 +77,7 @@ static int sa1100dog_release(struct inode *inode, struct file *file)
}
}
clear_bit
(
1
,
&
sa1100wdt_users
);
clear_bit
(
1
,
&
sa1100wdt_users
);
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
...
drivers/char/watchdog/sbc60xxwdt.c
View file @
a5ab05a5
...
@@ -183,7 +183,7 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
...
@@ -183,7 +183,7 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
* five months ago... */
* five months ago... */
wdt_expect_close
=
0
;
wdt_expect_close
=
0
;
/* scan to see wether or not we got the magic character */
/* scan to see w
h
ether or not we got the magic character */
for
(
ofs
=
0
;
ofs
!=
count
;
ofs
++
)
for
(
ofs
=
0
;
ofs
!=
count
;
ofs
++
)
{
{
char
c
;
char
c
;
...
...
drivers/char/watchdog/sc1200wdt.c
View file @
a5ab05a5
...
@@ -175,12 +175,12 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
...
@@ -175,12 +175,12 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
static
struct
watchdog_info
ident
=
{
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
0
,
.
firmware_version
=
0
,
.
identity
=
"PC87307/PC97307"
.
identity
=
"PC87307/PC97307"
,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
/* Keep Pavel Machek amused ;) */
return
-
ENO
IOCTLCMD
;
/* Keep Pavel Machek amused ;) */
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
ident
))
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
ident
))
...
@@ -292,7 +292,7 @@ static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code,
...
@@ -292,7 +292,7 @@ static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code,
static
struct
notifier_block
sc1200wdt_notifier
=
static
struct
notifier_block
sc1200wdt_notifier
=
{
{
notifier_call:
sc1200wdt_notify_sys
.
notifier_call
=
sc1200wdt_notify_sys
,
};
};
static
struct
file_operations
sc1200wdt_fops
=
static
struct
file_operations
sc1200wdt_fops
=
...
@@ -301,7 +301,7 @@ static struct file_operations sc1200wdt_fops =
...
@@ -301,7 +301,7 @@ static struct file_operations sc1200wdt_fops =
.
write
=
sc1200wdt_write
,
.
write
=
sc1200wdt_write
,
.
ioctl
=
sc1200wdt_ioctl
,
.
ioctl
=
sc1200wdt_ioctl
,
.
open
=
sc1200wdt_open
,
.
open
=
sc1200wdt_open
,
.
release
=
sc1200wdt_release
.
release
=
sc1200wdt_release
,
};
};
static
struct
miscdevice
sc1200wdt_miscdev
=
static
struct
miscdevice
sc1200wdt_miscdev
=
...
@@ -334,7 +334,7 @@ static int __init sc1200wdt_probe(void)
...
@@ -334,7 +334,7 @@ static int __init sc1200wdt_probe(void)
struct
pnp_device_id
scl200wdt_pnp_devices
[]
=
{
struct
pnp_device_id
scl200wdt_pnp_devices
[]
=
{
/* National Semiconductor PC87307/PC97307 watchdog component */
/* National Semiconductor PC87307/PC97307 watchdog component */
{.
id
=
"NSC0800"
,
.
driver_data
=
0
},
{.
id
=
"NSC0800"
,
.
driver_data
=
0
},
{.
id
=
""
}
{.
id
=
""
}
,
};
};
static
int
scl200wdt_pnp_probe
(
struct
pnp_dev
*
dev
,
const
struct
pnp_device_id
*
dev_id
)
static
int
scl200wdt_pnp_probe
(
struct
pnp_dev
*
dev
,
const
struct
pnp_device_id
*
dev_id
)
...
...
drivers/char/watchdog/scx200_wdt.c
View file @
a5ab05a5
/*
linux/drivers/char/scx200_wdt.c
/*
drivers/char/watchdog/scx200_wdt.c
National Semiconductor SCx200 Watchdog support
National Semiconductor SCx200 Watchdog support
...
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
...
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
static
u16
wdto_restart
;
static
u16
wdto_restart
;
static
struct
semaphore
open_semaphore
;
static
struct
semaphore
open_semaphore
;
static
unsigned
expect_close
;
static
char
expect_close
;
/* Bits of the WDCNFG register */
/* Bits of the WDCNFG register */
#define W_ENABLE 0x00fa
/* Enable watchdog */
#define W_ENABLE 0x00fa
/* Enable watchdog */
...
@@ -98,18 +98,18 @@ static int scx200_wdt_open(struct inode *inode, struct file *file)
...
@@ -98,18 +98,18 @@ static int scx200_wdt_open(struct inode *inode, struct file *file)
if
(
down_trylock
(
&
open_semaphore
))
if
(
down_trylock
(
&
open_semaphore
))
return
-
EBUSY
;
return
-
EBUSY
;
scx200_wdt_enable
();
scx200_wdt_enable
();
expect_close
=
0
;
return
0
;
return
0
;
}
}
static
int
scx200_wdt_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
scx200_wdt_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
!
expect_close
)
{
if
(
expect_close
!=
42
)
{
printk
(
KERN_WARNING
NAME
": watchdog device closed unexpectedly, will not disable the watchdog timer
\n
"
);
printk
(
KERN_WARNING
NAME
": watchdog device closed unexpectedly, will not disable the watchdog timer
\n
"
);
}
else
if
(
!
nowayout
)
{
}
else
if
(
!
nowayout
)
{
scx200_wdt_disable
();
scx200_wdt_disable
();
}
}
expect_close
=
0
;
up
(
&
open_semaphore
);
up
(
&
open_semaphore
);
return
0
;
return
0
;
...
@@ -127,7 +127,7 @@ static int scx200_wdt_notify_sys(struct notifier_block *this,
...
@@ -127,7 +127,7 @@ static int scx200_wdt_notify_sys(struct notifier_block *this,
static
struct
notifier_block
scx200_wdt_notifier
=
static
struct
notifier_block
scx200_wdt_notifier
=
{
{
.
notifier_call
=
scx200_wdt_notify_sys
.
notifier_call
=
scx200_wdt_notify_sys
,
};
};
static
ssize_t
scx200_wdt_write
(
struct
file
*
file
,
const
char
*
data
,
static
ssize_t
scx200_wdt_write
(
struct
file
*
file
,
const
char
*
data
,
...
@@ -149,7 +149,7 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data,
...
@@ -149,7 +149,7 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data,
if
(
get_user
(
c
,
data
+
i
))
if
(
get_user
(
c
,
data
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
return
len
;
return
len
;
...
@@ -170,7 +170,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
...
@@ -170,7 +170,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
sizeof
(
ident
)))
...
...
drivers/char/watchdog/shwdt.c
View file @
a5ab05a5
...
@@ -303,7 +303,7 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
...
@@ -303,7 +303,7 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
return
retval
;
return
retval
;
}
}
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
...
...
drivers/char/watchdog/softdog.c
View file @
a5ab05a5
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
#define TIMER_MARGIN 60
/* (secs) Default is 1 minute */
#define TIMER_MARGIN 60
/* (secs) Default is 1 minute */
static
int
expect_close
=
0
;
static
char
expect_close
;
static
int
soft_margin
=
TIMER_MARGIN
;
/* in seconds */
static
int
soft_margin
=
TIMER_MARGIN
;
/* in seconds */
#ifdef ONLY_TESTING
#ifdef ONLY_TESTING
static
int
soft_noboot
=
1
;
static
int
soft_noboot
=
1
;
...
@@ -120,12 +120,13 @@ static int softdog_release(struct inode *inode, struct file *file)
...
@@ -120,12 +120,13 @@ static int softdog_release(struct inode *inode, struct file *file)
* Shut off the timer.
* Shut off the timer.
* Lock it in if it's a module and we set nowayout
* Lock it in if it's a module and we set nowayout
*/
*/
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
del_timer
(
&
watchdog_ticktock
);
del_timer
(
&
watchdog_ticktock
);
}
else
{
}
else
{
printk
(
KERN_CRIT
"SOFTDOG: WDT device closed unexpectedly. WDT will not stop!
\n
"
);
printk
(
KERN_CRIT
"SOFTDOG: WDT device closed unexpectedly. WDT will not stop!
\n
"
);
}
}
clear_bit
(
0
,
&
timer_alive
);
clear_bit
(
0
,
&
timer_alive
);
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
@@ -151,7 +152,7 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo
...
@@ -151,7 +152,7 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo
if
(
get_user
(
c
,
data
+
i
))
if
(
get_user
(
c
,
data
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
mod_timer
(
&
watchdog_ticktock
,
jiffies
+
(
soft_margin
*
HZ
));
mod_timer
(
&
watchdog_ticktock
,
jiffies
+
(
soft_margin
*
HZ
));
...
@@ -169,7 +170,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
...
@@ -169,7 +170,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
};
};
switch
(
cmd
)
{
switch
(
cmd
)
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
return
-
EFAULT
;
...
...
drivers/char/watchdog/w83627hf_wdt.c
View file @
a5ab05a5
...
@@ -184,7 +184,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -184,7 +184,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
}
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
...
drivers/char/watchdog/w83877f_wdt.c
View file @
a5ab05a5
...
@@ -205,7 +205,7 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
...
@@ -205,7 +205,7 @@ static ssize_t fop_write(struct file * file, const char * buf, size_t count, lof
* five months ago... */
* five months ago... */
wdt_expect_close
=
0
;
wdt_expect_close
=
0
;
/* scan to see wether or not we got the magic character */
/* scan to see w
h
ether or not we got the magic character */
for
(
ofs
=
0
;
ofs
!=
count
;
ofs
++
)
for
(
ofs
=
0
;
ofs
!=
count
;
ofs
++
)
{
{
char
c
;
char
c
;
...
...
drivers/char/watchdog/wafer5823wdt.c
View file @
a5ab05a5
...
@@ -109,7 +109,7 @@ static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, lo
...
@@ -109,7 +109,7 @@ static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, lo
/* In case it was set long ago */
/* In case it was set long ago */
expect_close
=
0
;
expect_close
=
0
;
/* scan to see wether or not we got the magic character */
/* scan to see w
h
ether or not we got the magic character */
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
char
c
;
char
c
;
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
...
@@ -182,7 +182,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
...
@@ -182,7 +182,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
}
}
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
}
}
return
0
;
return
0
;
}
}
...
...
drivers/char/watchdog/wdt.c
View file @
a5ab05a5
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
#include "wd501p.h"
#include "wd501p.h"
static
unsigned
long
wdt_is_open
;
static
unsigned
long
wdt_is_open
;
static
int
expect_close
;
static
char
expect_close
;
/*
/*
* You must set these - there is no sane way to probe for this board.
* You must set these - there is no sane way to probe for this board.
...
@@ -261,7 +261,7 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
...
@@ -261,7 +261,7 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
wdt_ping
();
wdt_ping
();
...
@@ -326,14 +326,14 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -326,14 +326,14 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
WDIOF_EXTERN1
|
WDIOF_EXTERN2
|
WDIOF_FANFAULT
|
WDIOF_EXTERN1
|
WDIOF_EXTERN2
|
WDIOF_FANFAULT
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
.
firmware_version
=
1
,
.
identity
=
"WDT500/501"
.
identity
=
"WDT500/501"
,
};
};
ident
.
options
&=
WDT_OPTION_MASK
;
/* Mask down to the card we have */
ident
.
options
&=
WDT_OPTION_MASK
;
/* Mask down to the card we have */
switch
(
cmd
)
switch
(
cmd
)
{
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
...
@@ -414,13 +414,14 @@ static int wdt_release(struct inode *inode, struct file *file)
...
@@ -414,13 +414,14 @@ static int wdt_release(struct inode *inode, struct file *file)
{
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
{
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
inb_p
(
WDT_DC
);
/* Disable counters */
inb_p
(
WDT_DC
);
/* Disable counters */
wdt_ctr_load
(
2
,
0
);
/* 0 length reset pulses now */
wdt_ctr_load
(
2
,
0
);
/* 0 length reset pulses now */
}
else
{
}
else
{
printk
(
KERN_CRIT
"wdt: WDT device closed unexpectedly. WDT will not stop!
\n
"
);
printk
(
KERN_CRIT
"wdt: WDT device closed unexpectedly. WDT will not stop!
\n
"
);
}
}
clear_bit
(
0
,
&
wdt_is_open
);
clear_bit
(
0
,
&
wdt_is_open
);
expect_close
=
0
;
}
}
return
0
;
return
0
;
}
}
...
@@ -468,7 +469,7 @@ static struct miscdevice wdt_miscdev=
...
@@ -468,7 +469,7 @@ static struct miscdevice wdt_miscdev=
{
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
wdt_fops
.
fops
=
&
wdt_fops
,
};
};
#ifdef CONFIG_WDT_501
#ifdef CONFIG_WDT_501
...
@@ -476,7 +477,7 @@ static struct miscdevice temp_miscdev=
...
@@ -476,7 +477,7 @@ static struct miscdevice temp_miscdev=
{
{
.
minor
=
TEMP_MINOR
,
.
minor
=
TEMP_MINOR
,
.
name
=
"temperature"
,
.
name
=
"temperature"
,
.
fops
=
&
wdt_fops
.
fops
=
&
wdt_fops
,
};
};
#endif
#endif
...
@@ -489,7 +490,7 @@ static struct notifier_block wdt_notifier=
...
@@ -489,7 +490,7 @@ static struct notifier_block wdt_notifier=
{
{
.
notifier_call
=
wdt_notify_sys
,
.
notifier_call
=
wdt_notify_sys
,
.
next
=
NULL
,
.
next
=
NULL
,
.
priority
=
0
.
priority
=
0
,
};
};
/**
/**
...
...
drivers/char/watchdog/wdt285.c
View file @
a5ab05a5
...
@@ -132,7 +132,7 @@ watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
...
@@ -132,7 +132,7 @@ watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
static
struct
watchdog_info
ident
=
{
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
,
.
options
=
WDIOF_SETTIMEOUT
,
.
identity
=
"Footbridge Watchdog"
.
identity
=
"Footbridge Watchdog"
,
};
};
static
int
static
int
...
@@ -192,7 +192,7 @@ static struct file_operations watchdog_fops = {
...
@@ -192,7 +192,7 @@ static struct file_operations watchdog_fops = {
static
struct
miscdevice
watchdog_miscdev
=
{
static
struct
miscdevice
watchdog_miscdev
=
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
watchdog_fops
.
fops
=
&
watchdog_fops
,
};
};
static
int
__init
footbridge_watchdog_init
(
void
)
static
int
__init
footbridge_watchdog_init
(
void
)
...
...
drivers/char/watchdog/wdt977.c
View file @
a5ab05a5
...
@@ -43,7 +43,7 @@ static int timeout = DEFAULT_TIMEOUT*60; /* TO in seconds from user */
...
@@ -43,7 +43,7 @@ static int timeout = DEFAULT_TIMEOUT*60; /* TO in seconds from user */
static
int
timeoutM
=
DEFAULT_TIMEOUT
;
/* timeout in minutes */
static
int
timeoutM
=
DEFAULT_TIMEOUT
;
/* timeout in minutes */
static
unsigned
long
timer_alive
;
static
unsigned
long
timer_alive
;
static
int
testmode
;
static
int
testmode
;
static
int
expect_close
=
0
;
static
char
expect_close
;
module_param
(
timeout
,
int
,
0
);
module_param
(
timeout
,
int
,
0
);
MODULE_PARM_DESC
(
timeout
,
"Watchdog timeout in seconds (60..15300), default=60"
);
MODULE_PARM_DESC
(
timeout
,
"Watchdog timeout in seconds (60..15300), default=60"
);
...
@@ -165,7 +165,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
...
@@ -165,7 +165,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
* Shut off the timer.
* Shut off the timer.
* Lock it in if it's a module and we set nowayout
* Lock it in if it's a module and we set nowayout
*/
*/
if
(
!
nowayout
)
if
(
expect_close
==
42
)
{
{
/* unlock the SuperIO chip */
/* unlock the SuperIO chip */
outb
(
0x87
,
0x370
);
outb
(
0x87
,
0x370
);
...
@@ -202,6 +202,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
...
@@ -202,6 +202,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
}
else
{
}
else
{
printk
(
KERN_CRIT
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
printk
(
KERN_CRIT
"WDT device closed unexpectedly. WDT will not stop!
\n
"
);
}
}
expect_close
=
0
;
return
0
;
return
0
;
}
}
...
@@ -235,7 +236,7 @@ static ssize_t wdt977_write(struct file *file, const char *buf, size_t count, lo
...
@@ -235,7 +236,7 @@ static ssize_t wdt977_write(struct file *file, const char *buf, size_t count, lo
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
...
@@ -257,7 +258,7 @@ static ssize_t wdt977_write(struct file *file, const char *buf, size_t count, lo
...
@@ -257,7 +258,7 @@ static ssize_t wdt977_write(struct file *file, const char *buf, size_t count, lo
static
struct
watchdog_info
ident
=
{
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
,
.
options
=
WDIOF_SETTIMEOUT
,
.
identity
=
"Winbond 83977"
.
identity
=
"Winbond 83977"
,
};
};
static
int
wdt977_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
static
int
wdt977_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
...
@@ -268,7 +269,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
...
@@ -268,7 +269,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
switch
(
cmd
)
{
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
...
@@ -341,7 +342,7 @@ static struct miscdevice wdt977_miscdev=
...
@@ -341,7 +342,7 @@ static struct miscdevice wdt977_miscdev=
{
{
.
minor
=
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
name
=
"watchdog"
,
.
fops
=
&
wdt977_fops
.
fops
=
&
wdt977_fops
,
};
};
static
int
__init
nwwatchdog_init
(
void
)
static
int
__init
nwwatchdog_init
(
void
)
...
...
drivers/char/watchdog/wdt_pci.c
View file @
a5ab05a5
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
static
struct
semaphore
open_sem
;
static
struct
semaphore
open_sem
;
static
spinlock_t
wdtpci_lock
;
static
spinlock_t
wdtpci_lock
;
static
int
expect_close
=
0
;
static
char
expect_close
;
static
int
io
;
static
int
io
;
static
int
irq
;
static
int
irq
;
...
@@ -247,7 +247,7 @@ static ssize_t wdtpci_write(struct file *file, const char *buf, size_t count, lo
...
@@ -247,7 +247,7 @@ static ssize_t wdtpci_write(struct file *file, const char *buf, size_t count, lo
if
(
get_user
(
c
,
buf
+
i
))
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
c
==
'V'
)
if
(
c
==
'V'
)
expect_close
=
1
;
expect_close
=
42
;
}
}
}
}
wdtpci_ping
();
wdtpci_ping
();
...
@@ -319,7 +319,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
...
@@ -319,7 +319,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
switch
(
cmd
)
switch
(
cmd
)
{
{
default:
default:
return
-
ENO
TTY
;
return
-
ENO
IOCTLCMD
;
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
...
@@ -425,7 +425,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
...
@@ -425,7 +425,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
if
(
iminor
(
inode
)
==
WATCHDOG_MINOR
)
{
unsigned
long
flags
;
unsigned
long
flags
;
if
(
expect_close
)
{
if
(
expect_close
==
42
)
{
spin_lock_irqsave
(
&
wdtpci_lock
,
flags
);
spin_lock_irqsave
(
&
wdtpci_lock
,
flags
);
inb_p
(
WDT_DC
);
/* Disable counters */
inb_p
(
WDT_DC
);
/* Disable counters */
wdtpci_ctr_load
(
2
,
0
);
/* 0 length reset pulses now */
wdtpci_ctr_load
(
2
,
0
);
/* 0 length reset pulses now */
...
@@ -434,6 +434,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
...
@@ -434,6 +434,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
printk
(
KERN_CRIT
PFX
"Unexpected close, not stopping timer!"
);
printk
(
KERN_CRIT
PFX
"Unexpected close, not stopping timer!"
);
wdtpci_ping
();
wdtpci_ping
();
}
}
expect_close
=
0
;
up
(
&
open_sem
);
up
(
&
open_sem
);
}
}
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment