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
Kirill Smelkov
linux
Commits
cb960669
Commit
cb960669
authored
Jun 17, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jun 17, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: drivers/char/watchdog annotation
Trivial annotations in drivers/char/watchdog/*
parent
bdda2a3e
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
173 additions
and
135 deletions
+173
-135
drivers/char/watchdog/acquirewdt.c
drivers/char/watchdog/acquirewdt.c
+7
-5
drivers/char/watchdog/advantechwdt.c
drivers/char/watchdog/advantechwdt.c
+8
-6
drivers/char/watchdog/alim1535_wdt.c
drivers/char/watchdog/alim1535_wdt.c
+8
-6
drivers/char/watchdog/alim7101_wdt.c
drivers/char/watchdog/alim7101_wdt.c
+8
-6
drivers/char/watchdog/cpu5wdt.c
drivers/char/watchdog/cpu5wdt.c
+5
-4
drivers/char/watchdog/eurotechwdt.c
drivers/char/watchdog/eurotechwdt.c
+9
-8
drivers/char/watchdog/i8xx_tco.c
drivers/char/watchdog/i8xx_tco.c
+8
-6
drivers/char/watchdog/ib700wdt.c
drivers/char/watchdog/ib700wdt.c
+7
-5
drivers/char/watchdog/machzwd.c
drivers/char/watchdog/machzwd.c
+5
-4
drivers/char/watchdog/mixcomwd.c
drivers/char/watchdog/mixcomwd.c
+5
-4
drivers/char/watchdog/pcwd_pci.c
drivers/char/watchdog/pcwd_pci.c
+11
-9
drivers/char/watchdog/pcwd_usb.c
drivers/char/watchdog/pcwd_usb.c
+11
-9
drivers/char/watchdog/sbc60xxwdt.c
drivers/char/watchdog/sbc60xxwdt.c
+8
-6
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc1200wdt.c
+9
-7
drivers/char/watchdog/sc520_wdt.c
drivers/char/watchdog/sc520_wdt.c
+8
-6
drivers/char/watchdog/scx200_wdt.c
drivers/char/watchdog/scx200_wdt.c
+7
-6
drivers/char/watchdog/softdog.c
drivers/char/watchdog/softdog.c
+7
-5
drivers/char/watchdog/w83627hf_wdt.c
drivers/char/watchdog/w83627hf_wdt.c
+8
-6
drivers/char/watchdog/w83877f_wdt.c
drivers/char/watchdog/w83877f_wdt.c
+8
-6
drivers/char/watchdog/wafer5823wdt.c
drivers/char/watchdog/wafer5823wdt.c
+8
-7
drivers/char/watchdog/wdt.c
drivers/char/watchdog/wdt.c
+9
-7
drivers/char/watchdog/wdt_pci.c
drivers/char/watchdog/wdt_pci.c
+9
-7
No files found.
drivers/char/watchdog/acquirewdt.c
View file @
cb960669
...
...
@@ -111,7 +111,7 @@ static void acq_stop(void)
* /dev/watchdog handling.
*/
static
ssize_t
acq_write
(
struct
file
*
file
,
const
char
*
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
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -146,6 +146,8 @@ static int acq_ioctl(struct inode *inode, 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
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_MAGICCLOSE
,
...
...
@@ -156,22 +158,22 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
acq_keepalive
();
return
0
;
case
WDIOC_GETTIMEOUT
:
return
put_user
(
WATCHDOG_HEARTBEAT
,
(
int
*
)
arg
);
return
put_user
(
WATCHDOG_HEARTBEAT
,
p
);
case
WDIOC_SETOPTIONS
:
{
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
...
...
drivers/char/watchdog/advantechwdt.c
View file @
cb960669
...
...
@@ -100,7 +100,7 @@ advwdt_disable(void)
}
static
ssize_t
advwdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
advwdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -130,6 +130,8 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned
long
arg
)
{
int
new_timeout
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
...
...
@@ -138,20 +140,20 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
advwdt_ping
();
break
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
((
new_timeout
<
1
)
||
(
new_timeout
>
63
))
return
-
EINVAL
;
...
...
@@ -160,13 +162,13 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
case
WDIOC_SETOPTIONS
:
{
int
options
,
retval
=
-
EINVAL
;
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
{
...
...
drivers/char/watchdog/alim1535_wdt.c
View file @
cb960669
...
...
@@ -138,7 +138,7 @@ static int ali_settimer(int t)
* the next close to turn off the watchdog.
*/
static
ssize_t
ali_write
(
struct
file
*
file
,
const
char
*
data
,
static
ssize_t
ali_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
...
...
@@ -184,6 +184,8 @@ static ssize_t ali_write(struct file *file, const char *data,
static
int
ali_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
...
...
@@ -194,12 +196,12 @@ static int ali_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
ali_keepalive
();
...
...
@@ -209,7 +211,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -229,7 +231,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
{
int
new_timeout
;
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
ali_settimer
(
new_timeout
))
...
...
@@ -240,7 +242,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
default:
return
-
ENOIOCTLCMD
;
...
...
drivers/char/watchdog/alim7101_wdt.c
View file @
cb960669
...
...
@@ -148,7 +148,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling
*/
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* We can't seek */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -203,6 +203,8 @@ static int fop_close(struct inode * inode, struct file * file)
static
int
fop_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
...
...
@@ -213,10 +215,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_keepalive
();
return
0
;
...
...
@@ -224,7 +226,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -243,7 +245,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
{
int
new_timeout
;
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
new_timeout
<
1
||
new_timeout
>
3600
)
/* arbitrary upper limit */
...
...
@@ -254,7 +256,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
/* Fall through */
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
default:
return
-
ENOIOCTLCMD
;
}
...
...
drivers/char/watchdog/cpu5wdt.c
View file @
cb960669
...
...
@@ -145,6 +145,7 @@ static int cpu5wdt_release(struct inode *inode, struct file *file)
static
int
cpu5wdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
unsigned
int
value
;
static
struct
watchdog_info
ident
=
{
...
...
@@ -159,15 +160,15 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
case
WDIOC_GETSTATUS
:
value
=
inb
(
port
+
CPU5WDT_STATUS_REG
);
value
=
(
value
>>
2
)
&
1
;
if
(
copy_to_user
(
(
int
*
)
arg
,
(
int
*
)
&
value
,
sizeof
(
int
))
)
if
(
copy_to_user
(
argp
,
&
value
,
sizeof
(
int
))
)
return
-
EFAULT
;
break
;
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
)
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
)
return
-
EFAULT
;
break
;
case
WDIOC_SETOPTIONS
:
if
(
copy_from_user
(
&
value
,
(
int
*
)
arg
,
sizeof
(
int
))
)
if
(
copy_from_user
(
&
value
,
argp
,
sizeof
(
int
))
)
return
-
EFAULT
;
switch
(
value
)
{
case
WDIOS_ENABLECARD
:
...
...
@@ -185,7 +186,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
return
0
;
}
static
ssize_t
cpu5wdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
cpu5wdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
if
(
!
count
)
return
-
EIO
;
...
...
drivers/char/watchdog/eurotechwdt.c
View file @
cb960669
...
...
@@ -196,8 +196,8 @@ static void eurwdt_ping(void)
* write of data will do, as we we don't define content meaning.
*/
static
ssize_t
eurwdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
eurwdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -237,6 +237,8 @@ loff_t *ppos)
static
int
eurwdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
...
...
@@ -251,19 +253,18 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
eurwdt_ping
();
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
copy_from_user
(
&
time
,
(
int
*
)
arg
,
sizeof
(
int
)))
if
(
copy_from_user
(
&
time
,
p
,
sizeof
(
int
)))
return
-
EFAULT
;
/* Sanity check */
...
...
@@ -275,10 +276,10 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
eurwdt_timeout
,
(
int
*
)
arg
);
return
put_user
(
eurwdt_timeout
,
p
);
case
WDIOC_SETOPTIONS
:
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
{
eurwdt_disable_timer
();
...
...
drivers/char/watchdog/i8xx_tco.c
View file @
cb960669
...
...
@@ -212,7 +212,7 @@ static int i8xx_tco_release (struct inode *inode, struct file *file)
return
0
;
}
static
ssize_t
i8xx_tco_write
(
struct
file
*
file
,
const
char
*
data
,
static
ssize_t
i8xx_tco_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
...
...
@@ -249,6 +249,8 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
{
int
new_options
,
retval
=
-
EINVAL
;
int
new_heartbeat
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
|
WDIOF_KEEPALIVEPING
|
...
...
@@ -259,12 +261,12 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
tco_timer_keepalive
();
...
...
@@ -272,7 +274,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case
WDIOC_SETOPTIONS
:
{
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -291,7 +293,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
case
WDIOC_SETTIMEOUT
:
{
if
(
get_user
(
new_heartbeat
,
(
int
*
)
arg
))
if
(
get_user
(
new_heartbeat
,
p
))
return
-
EFAULT
;
if
(
tco_timer_set_heartbeat
(
new_heartbeat
))
...
...
@@ -302,7 +304,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
heartbeat
,
(
int
*
)
arg
);
return
put_user
(
heartbeat
,
p
);
default:
return
-
ENOIOCTLCMD
;
...
...
drivers/char/watchdog/ib700wdt.c
View file @
cb960669
...
...
@@ -139,7 +139,7 @@ ibwdt_ping(void)
}
static
ssize_t
ibwdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
ibwdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -170,6 +170,8 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned
long
arg
)
{
int
i
,
new_margin
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
...
...
@@ -179,19 +181,19 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
break
;
case
WDIOC_GETSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
ibwdt_ping
();
break
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_margin
,
(
int
*
)
arg
))
if
(
get_user
(
new_margin
,
p
))
return
-
EFAULT
;
if
((
new_margin
<
0
)
||
(
new_margin
>
30
))
return
-
EINVAL
;
...
...
@@ -203,7 +205,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
wd_times
[
wd_margin
],
(
int
*
)
arg
);
return
put_user
(
wd_times
[
wd_margin
],
p
);
break
;
default:
...
...
drivers/char/watchdog/machzwd.c
View file @
cb960669
...
...
@@ -302,7 +302,7 @@ static void zf_ping(unsigned long data)
}
}
static
ssize_t
zf_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
static
ssize_t
zf_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
...
...
@@ -352,15 +352,16 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
static
int
zf_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
switch
(
cmd
){
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
zf_info
,
sizeof
(
zf_info
)))
if
(
copy_to_user
(
argp
,
&
zf_info
,
sizeof
(
zf_info
)))
return
-
EFAULT
;
break
;
case
WDIOC_GETSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
zf_ping
(
0
);
...
...
drivers/char/watchdog/mixcomwd.c
View file @
cb960669
...
...
@@ -134,7 +134,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
}
static
ssize_t
mixcomwd_write
(
struct
file
*
file
,
const
char
*
data
,
size_t
len
,
loff_t
*
ppos
)
static
ssize_t
mixcomwd_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
if
(
ppos
!=
&
file
->
f_pos
)
{
return
-
ESPIPE
;
...
...
@@ -164,6 +164,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l
static
int
mixcomwd_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
int
status
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_MAGICCLOSE
,
...
...
@@ -178,13 +180,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
if
(
!
nowayout
)
{
status
|=
mixcomwd_timer_alive
;
}
if
(
copy_to_user
(
(
int
*
)
arg
,
&
status
,
sizeof
(
int
)))
{
if
(
copy_to_user
(
p
,
&
status
,
sizeof
(
int
)))
{
return
-
EFAULT
;
}
break
;
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
{
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
{
return
-
EFAULT
;
}
break
;
...
...
drivers/char/watchdog/pcwd_pci.c
View file @
cb960669
...
...
@@ -258,7 +258,7 @@ static int pcipcwd_get_temperature(int *temperature)
* /dev/watchdog handling
*/
static
ssize_t
pcipcwd_write
(
struct
file
*
file
,
const
char
*
data
,
static
ssize_t
pcipcwd_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
...
...
@@ -293,6 +293,8 @@ static ssize_t pcipcwd_write(struct file *file, const char *data,
static
int
pcipcwd_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_OVERHEAT
|
WDIOF_CARDRESET
|
...
...
@@ -305,7 +307,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
...
...
@@ -314,11 +316,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
pcipcwd_get_status
(
&
status
);
return
put_user
(
status
,
(
int
*
)
arg
);
return
put_user
(
status
,
p
);
}
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
pcipcwd_private
.
boot_status
,
(
int
*
)
arg
);
return
put_user
(
pcipcwd_private
.
boot_status
,
p
);
case
WDIOC_GETTEMP
:
{
...
...
@@ -327,7 +329,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
if
(
pcipcwd_get_temperature
(
&
temperature
))
return
-
EFAULT
;
return
put_user
(
temperature
,
(
int
*
)
arg
);
return
put_user
(
temperature
,
p
);
}
case
WDIOC_KEEPALIVE
:
...
...
@@ -338,7 +340,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -363,7 +365,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
{
int
new_heartbeat
;
if
(
get_user
(
new_heartbeat
,
(
int
*
)
arg
))
if
(
get_user
(
new_heartbeat
,
p
))
return
-
EFAULT
;
if
(
pcipcwd_set_heartbeat
(
new_heartbeat
))
...
...
@@ -374,7 +376,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
heartbeat
,
(
int
*
)
arg
);
return
put_user
(
heartbeat
,
p
);
default:
return
-
ENOIOCTLCMD
;
...
...
@@ -413,7 +415,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
static
ssize_t
pcipcwd_temp_read
(
struct
file
*
file
,
char
*
data
,
static
ssize_t
pcipcwd_temp_read
(
struct
file
*
file
,
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
int
temperature
;
...
...
drivers/char/watchdog/pcwd_usb.c
View file @
cb960669
...
...
@@ -326,7 +326,7 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
* /dev/watchdog handling
*/
static
ssize_t
usb_pcwd_write
(
struct
file
*
file
,
const
char
*
data
,
static
ssize_t
usb_pcwd_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
...
...
@@ -361,6 +361,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char *data,
static
int
usb_pcwd_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
...
...
@@ -371,12 +373,12 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_GETTEMP
:
{
...
...
@@ -385,7 +387,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
if
(
usb_pcwd_get_temperature
(
usb_pcwd_device
,
&
temperature
))
return
-
EFAULT
;
return
put_user
(
temperature
,
(
int
*
)
arg
);
return
put_user
(
temperature
,
p
);
}
case
WDIOC_KEEPALIVE
:
...
...
@@ -396,7 +398,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -416,7 +418,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
{
int
new_heartbeat
;
if
(
get_user
(
new_heartbeat
,
(
int
*
)
arg
))
if
(
get_user
(
new_heartbeat
,
p
))
return
-
EFAULT
;
if
(
usb_pcwd_set_heartbeat
(
usb_pcwd_device
,
new_heartbeat
))
...
...
@@ -427,7 +429,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
heartbeat
,
(
int
*
)
arg
);
return
put_user
(
heartbeat
,
p
);
default:
return
-
ENOIOCTLCMD
;
...
...
@@ -466,7 +468,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
static
ssize_t
usb_pcwd_temperature_read
(
struct
file
*
file
,
char
*
data
,
static
ssize_t
usb_pcwd_temperature_read
(
struct
file
*
file
,
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
int
temperature
;
...
...
@@ -478,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
if
(
usb_pcwd_get_temperature
(
usb_pcwd_device
,
&
temperature
))
return
-
EFAULT
;
if
(
copy_to_user
(
data
,
&
temperature
,
1
))
if
(
copy_to_user
(
data
,
&
temperature
,
1
))
return
-
EFAULT
;
return
1
;
...
...
drivers/char/watchdog/sbc60xxwdt.c
View file @
cb960669
...
...
@@ -166,7 +166,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling
*/
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* We can't seek */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -230,6 +230,8 @@ static int fop_close(struct inode * inode, struct file * file)
static
int
fop_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
...
...
@@ -242,10 +244,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_keepalive
();
return
0
;
...
...
@@ -253,7 +255,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_timeout
;
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
new_timeout
<
1
||
new_timeout
>
3600
)
/* arbitrary upper limit */
...
...
@@ -283,7 +285,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
}
}
...
...
drivers/char/watchdog/sc1200wdt.c
View file @
cb960669
...
...
@@ -174,6 +174,8 @@ static int sc1200wdt_open(struct inode *inode, struct file *file)
static
int
sc1200wdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
int
new_timeout
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
0
,
...
...
@@ -185,22 +187,22 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
return
-
ENOIOCTLCMD
;
/* Keep Pavel Machek amused ;) */
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
ident
))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
ident
))
return
-
EFAULT
;
return
0
;
case
WDIOC_GETSTATUS
:
return
put_user
(
sc1200wdt_status
(),
(
int
*
)
arg
);
return
put_user
(
sc1200wdt_status
(),
p
);
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
sc1200wdt_write_data
(
WDTO
,
timeout
);
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
/* the API states this is given in secs */
...
...
@@ -213,13 +215,13 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
/* fall through and return the new timeout */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
*
60
,
(
int
*
)
arg
);
return
put_user
(
timeout
*
60
,
p
);
case
WDIOC_SETOPTIONS
:
{
int
options
,
retval
=
-
EINVAL
;
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -254,7 +256,7 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
}
static
ssize_t
sc1200wdt_write
(
struct
file
*
file
,
const
char
*
data
,
size_t
len
,
loff_t
*
ppos
)
static
ssize_t
sc1200wdt_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
...
...
drivers/char/watchdog/sc520_wdt.c
View file @
cb960669
...
...
@@ -225,7 +225,7 @@ static int wdt_set_heartbeat(int t)
* /dev/watchdog handling
*/
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* We can't seek */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -285,6 +285,8 @@ static int fop_close(struct inode * inode, struct file * file)
static
int
fop_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
...
...
@@ -296,10 +298,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_keepalive
();
return
0
;
...
...
@@ -307,7 +309,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -326,7 +328,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_timeout
;
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
wdt_set_heartbeat
(
new_timeout
))
...
...
@@ -336,7 +338,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
}
}
...
...
drivers/char/watchdog/scx200_wdt.c
View file @
cb960669
...
...
@@ -132,7 +132,7 @@ static struct notifier_block scx200_wdt_notifier =
.
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
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -163,6 +163,8 @@ static ssize_t scx200_wdt_write(struct file *file, const char *data,
static
int
scx200_wdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
identity
=
"NatSemi SCx200 Watchdog"
,
.
firmware_version
=
1
,
...
...
@@ -174,20 +176,19 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
return
0
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
if
(
put_user
(
0
,
(
int
*
)
arg
))
if
(
put_user
(
0
,
p
))
return
-
EFAULT
;
return
0
;
case
WDIOC_KEEPALIVE
:
scx200_wdt_ping
();
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_margin
,
(
int
*
)
arg
))
if
(
get_user
(
new_margin
,
p
))
return
-
EFAULT
;
if
(
new_margin
<
1
)
return
-
EINVAL
;
...
...
@@ -195,7 +196,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
scx200_wdt_update_margin
();
scx200_wdt_ping
();
case
WDIOC_GETTIMEOUT
:
if
(
put_user
(
margin
,
(
int
*
)
arg
))
if
(
put_user
(
margin
,
p
))
return
-
EFAULT
;
return
0
;
}
...
...
drivers/char/watchdog/softdog.c
View file @
cb960669
...
...
@@ -161,7 +161,7 @@ static int softdog_release(struct inode *inode, struct file *file)
return
0
;
}
static
ssize_t
softdog_write
(
struct
file
*
file
,
const
char
*
data
,
size_t
len
,
loff_t
*
ppos
)
static
ssize_t
softdog_write
(
struct
file
*
file
,
const
char
__user
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -194,6 +194,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo
static
int
softdog_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
int
new_margin
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
|
...
...
@@ -206,23 +208,23 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
softdog_keepalive
();
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_margin
,
(
int
*
)
arg
))
if
(
get_user
(
new_margin
,
p
))
return
-
EFAULT
;
if
(
softdog_set_heartbeat
(
new_margin
))
return
-
EINVAL
;
softdog_keepalive
();
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
soft_margin
,
(
int
*
)
arg
);
return
put_user
(
soft_margin
,
p
);
}
}
...
...
drivers/char/watchdog/w83627hf_wdt.c
View file @
cb960669
...
...
@@ -142,7 +142,7 @@ wdt_set_heartbeat(int t)
}
static
ssize_t
wdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
wdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -171,6 +171,8 @@ static int
wdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
int
new_timeout
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
...
...
@@ -180,20 +182,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_ping
();
break
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
wdt_set_heartbeat
(
new_timeout
))
return
-
EINVAL
;
...
...
@@ -201,13 +203,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
case
WDIOC_SETOPTIONS
:
{
int
options
,
retval
=
-
EINVAL
;
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
{
...
...
drivers/char/watchdog/w83877f_wdt.c
View file @
cb960669
...
...
@@ -188,7 +188,7 @@ static void wdt_keepalive(void)
* /dev/watchdog handling
*/
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
fop_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* We can't seek */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -249,6 +249,8 @@ static int fop_close(struct inode * inode, struct file * file)
static
int
fop_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
...
...
@@ -261,10 +263,10 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
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
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_keepalive
();
return
0
;
...
...
@@ -272,7 +274,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_options
,
retval
=
-
EINVAL
;
if
(
get_user
(
new_options
,
(
int
*
)
arg
))
if
(
get_user
(
new_options
,
p
))
return
-
EFAULT
;
if
(
new_options
&
WDIOS_DISABLECARD
)
{
...
...
@@ -291,7 +293,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
int
new_timeout
;
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
(
new_timeout
<
1
||
new_timeout
>
3600
)
/* arbitrary upper limit */
...
...
@@ -302,7 +304,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* Fall through */
}
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
}
}
...
...
drivers/char/watchdog/wafer5823wdt.c
View file @
cb960669
...
...
@@ -95,7 +95,7 @@ wafwdt_stop(void)
inb_p
(
wdt_stop
);
}
static
ssize_t
wafwdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
wafwdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -128,6 +128,8 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
unsigned
long
arg
)
{
int
new_timeout
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_KEEPALIVEPING
|
WDIOF_SETTIMEOUT
|
WDIOF_MAGICCLOSE
,
.
firmware_version
=
1
,
...
...
@@ -136,21 +138,20 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
)))
if
(
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
)))
return
-
EFAULT
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wafwdt_ping
();
break
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_timeout
,
(
int
*
)
arg
))
if
(
get_user
(
new_timeout
,
p
))
return
-
EFAULT
;
if
((
new_timeout
<
1
)
||
(
new_timeout
>
255
))
return
-
EINVAL
;
...
...
@@ -159,13 +160,13 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wafwdt_start
();
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
timeout
,
(
int
*
)
arg
);
return
put_user
(
timeout
,
p
);
case
WDIOC_SETOPTIONS
:
{
int
options
,
retval
=
-
EINVAL
;
if
(
get_user
(
options
,
(
int
*
)
arg
))
if
(
get_user
(
options
,
p
))
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
{
...
...
drivers/char/watchdog/wdt.c
View file @
cb960669
...
...
@@ -286,7 +286,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* write of data will do, as we we don't define content meaning.
*/
static
ssize_t
wdt_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
wdt_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -327,6 +327,8 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
static
int
wdt_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
int
new_heartbeat
;
int
status
;
...
...
@@ -351,18 +353,18 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
wdt_get_status
(
&
status
);
return
put_user
(
status
,
(
int
*
)
arg
);
return
put_user
(
status
,
p
);
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdt_ping
();
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_heartbeat
,
(
int
*
)
arg
))
if
(
get_user
(
new_heartbeat
,
p
))
return
-
EFAULT
;
if
(
wdt_set_heartbeat
(
new_heartbeat
))
...
...
@@ -371,7 +373,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
wdt_ping
();
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
heartbeat
,
(
int
*
)
arg
);
return
put_user
(
heartbeat
,
p
);
}
}
...
...
@@ -435,7 +437,7 @@ static int wdt_release(struct inode *inode, struct file *file)
* farenheit. It was designed by an imperial measurement luddite.
*/
static
ssize_t
wdt_temp_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ptr
)
static
ssize_t
wdt_temp_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ptr
)
{
int
temperature
;
...
...
drivers/char/watchdog/wdt_pci.c
View file @
cb960669
...
...
@@ -331,7 +331,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* write of data will do, as we we don't define content meaning.
*/
static
ssize_t
wdtpci_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
wdtpci_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
...
...
@@ -374,6 +374,8 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
{
int
new_heartbeat
;
int
status
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_SETTIMEOUT
|
...
...
@@ -396,18 +398,18 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
default:
return
-
ENOIOCTLCMD
;
case
WDIOC_GETSUPPORT
:
return
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
ident
,
sizeof
(
ident
))
?-
EFAULT
:
0
;
case
WDIOC_GETSTATUS
:
wdtpci_get_status
(
&
status
);
return
put_user
(
status
,
(
int
*
)
arg
);
return
put_user
(
status
,
p
);
case
WDIOC_GETBOOTSTATUS
:
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
WDIOC_KEEPALIVE
:
wdtpci_ping
();
return
0
;
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_heartbeat
,
(
int
*
)
arg
))
if
(
get_user
(
new_heartbeat
,
p
))
return
-
EFAULT
;
if
(
wdtpci_set_heartbeat
(
new_heartbeat
))
...
...
@@ -416,7 +418,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
wdtpci_ping
();
/* Fall */
case
WDIOC_GETTIMEOUT
:
return
put_user
(
heartbeat
,
(
int
*
)
arg
);
return
put_user
(
heartbeat
,
p
);
}
}
...
...
@@ -484,7 +486,7 @@ static int wdtpci_release(struct inode *inode, struct file *file)
* fahrenheit. It was designed by an imperial measurement luddite.
*/
static
ssize_t
wdtpci_temp_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ptr
)
static
ssize_t
wdtpci_temp_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ptr
)
{
int
temperature
;
...
...
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