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
796c43e5
Commit
796c43e5
authored
Jun 03, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jun 03, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: ppdev annotation
parent
138b97b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
27 deletions
+24
-27
drivers/char/ppdev.c
drivers/char/ppdev.c
+24
-27
No files found.
drivers/char/ppdev.c
View file @
796c43e5
...
...
@@ -103,7 +103,7 @@ static inline void pp_enable_irq (struct pp_struct *pp)
port
->
ops
->
enable_irq
(
port
);
}
static
ssize_t
pp_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
static
ssize_t
pp_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
minor
=
iminor
(
file
->
f_dentry
->
d_inode
);
...
...
@@ -186,8 +186,8 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count,
return
bytes_read
;
}
static
ssize_t
pp_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
pp_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
minor
=
iminor
(
file
->
f_dentry
->
d_inode
);
struct
pp_struct
*
pp
=
file
->
private_data
;
...
...
@@ -335,6 +335,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
unsigned
int
minor
=
iminor
(
inode
);
struct
pp_struct
*
pp
=
file
->
private_data
;
struct
parport
*
port
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
/* First handle the cases that don't take arguments. */
switch
(
cmd
)
{
...
...
@@ -396,7 +397,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
case
PPSETMODE
:
{
int
mode
;
if
(
copy_from_user
(
&
mode
,
(
int
*
)
arg
,
sizeof
(
mode
)))
if
(
copy_from_user
(
&
mode
,
argp
,
sizeof
(
mode
)))
return
-
EFAULT
;
/* FIXME: validate mode */
pp
->
state
.
mode
=
mode
;
...
...
@@ -418,7 +419,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
}
else
{
mode
=
pp
->
state
.
mode
;
}
if
(
copy_to_user
(
(
int
*
)
arg
,
&
mode
,
sizeof
(
mode
)))
{
if
(
copy_to_user
(
argp
,
&
mode
,
sizeof
(
mode
)))
{
return
-
EFAULT
;
}
return
0
;
...
...
@@ -426,7 +427,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
case
PPSETPHASE
:
{
int
phase
;
if
(
copy_from_user
(
&
phase
,
(
int
*
)
arg
,
sizeof
(
phase
)))
{
if
(
copy_from_user
(
&
phase
,
argp
,
sizeof
(
phase
)))
{
return
-
EFAULT
;
}
/* FIXME: validate phase */
...
...
@@ -447,7 +448,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
}
else
{
phase
=
pp
->
state
.
phase
;
}
if
(
copy_to_user
(
(
int
*
)
arg
,
&
phase
,
sizeof
(
phase
)))
{
if
(
copy_to_user
(
argp
,
&
phase
,
sizeof
(
phase
)))
{
return
-
EFAULT
;
}
return
0
;
...
...
@@ -461,7 +462,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return
-
ENODEV
;
modes
=
port
->
modes
;
if
(
copy_to_user
(
(
unsigned
int
*
)
arg
,
&
modes
,
sizeof
(
modes
)))
{
if
(
copy_to_user
(
argp
,
&
modes
,
sizeof
(
modes
)))
{
return
-
EFAULT
;
}
return
0
;
...
...
@@ -470,7 +471,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
{
int
uflags
;
if
(
copy_from_user
(
&
uflags
,
(
int
*
)
arg
,
sizeof
(
uflags
)))
{
if
(
copy_from_user
(
&
uflags
,
argp
,
sizeof
(
uflags
)))
{
return
-
EFAULT
;
}
pp
->
flags
&=
~
PP_FLAGMASK
;
...
...
@@ -482,7 +483,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
int
uflags
;
uflags
=
pp
->
flags
&
PP_FLAGMASK
;
if
(
copy_to_user
(
(
int
*
)
arg
,
&
uflags
,
sizeof
(
uflags
)))
{
if
(
copy_to_user
(
argp
,
&
uflags
,
sizeof
(
uflags
)))
{
return
-
EFAULT
;
}
return
0
;
...
...
@@ -509,17 +510,17 @@ static int pp_ioctl(struct inode *inode, struct file *file,
case
PPRSTATUS
:
reg
=
parport_read_status
(
port
);
if
(
copy_to_user
(
(
unsigned
char
*
)
arg
,
&
reg
,
sizeof
(
reg
)))
if
(
copy_to_user
(
argp
,
&
reg
,
sizeof
(
reg
)))
return
-
EFAULT
;
return
0
;
case
PPRDATA
:
reg
=
parport_read_data
(
port
);
if
(
copy_to_user
(
(
unsigned
char
*
)
arg
,
&
reg
,
sizeof
(
reg
)))
if
(
copy_to_user
(
argp
,
&
reg
,
sizeof
(
reg
)))
return
-
EFAULT
;
return
0
;
case
PPRCONTROL
:
reg
=
parport_read_control
(
port
);
if
(
copy_to_user
(
(
unsigned
char
*
)
arg
,
&
reg
,
sizeof
(
reg
)))
if
(
copy_to_user
(
argp
,
&
reg
,
sizeof
(
reg
)))
return
-
EFAULT
;
return
0
;
case
PPYIELD
:
...
...
@@ -538,29 +539,29 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return
0
;
case
PPWCONTROL
:
if
(
copy_from_user
(
&
reg
,
(
unsigned
char
*
)
arg
,
sizeof
(
reg
)))
if
(
copy_from_user
(
&
reg
,
argp
,
sizeof
(
reg
)))
return
-
EFAULT
;
parport_write_control
(
port
,
reg
);
return
0
;
case
PPWDATA
:
if
(
copy_from_user
(
&
reg
,
(
unsigned
char
*
)
arg
,
sizeof
(
reg
)))
if
(
copy_from_user
(
&
reg
,
argp
,
sizeof
(
reg
)))
return
-
EFAULT
;
parport_write_data
(
port
,
reg
);
return
0
;
case
PPFCONTROL
:
if
(
copy_from_user
(
&
mask
,
(
unsigned
char
*
)
arg
,
if
(
copy_from_user
(
&
mask
,
argp
,
sizeof
(
mask
)))
return
-
EFAULT
;
if
(
copy_from_user
(
&
reg
,
1
+
(
unsigned
char
*
)
arg
,
if
(
copy_from_user
(
&
reg
,
1
+
(
unsigned
char
__user
*
)
arg
,
sizeof
(
reg
)))
return
-
EFAULT
;
parport_frob_control
(
port
,
mask
,
reg
);
return
0
;
case
PPDATADIR
:
if
(
copy_from_user
(
&
mode
,
(
int
*
)
arg
,
sizeof
(
mode
)))
if
(
copy_from_user
(
&
mode
,
argp
,
sizeof
(
mode
)))
return
-
EFAULT
;
if
(
mode
)
port
->
ops
->
data_reverse
(
port
);
...
...
@@ -569,7 +570,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return
0
;
case
PPNEGOT
:
if
(
copy_from_user
(
&
mode
,
(
int
*
)
arg
,
sizeof
(
mode
)))
if
(
copy_from_user
(
&
mode
,
argp
,
sizeof
(
mode
)))
return
-
EFAULT
;
switch
((
ret
=
parport_negotiate
(
port
,
mode
)))
{
case
0
:
break
;
...
...
@@ -584,8 +585,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return
ret
;
case
PPWCTLONIRQ
:
if
(
copy_from_user
(
&
reg
,
(
unsigned
char
*
)
arg
,
sizeof
(
reg
)))
if
(
copy_from_user
(
&
reg
,
argp
,
sizeof
(
reg
)))
return
-
EFAULT
;
/* Remember what to set the control lines to, for next
...
...
@@ -596,14 +596,13 @@ static int pp_ioctl(struct inode *inode, struct file *file,
case
PPCLRIRQ
:
ret
=
atomic_read
(
&
pp
->
irqc
);
if
(
copy_to_user
(
(
int
*
)
arg
,
&
ret
,
sizeof
(
ret
)))
if
(
copy_to_user
(
argp
,
&
ret
,
sizeof
(
ret
)))
return
-
EFAULT
;
atomic_sub
(
ret
,
&
pp
->
irqc
);
return
0
;
case
PPSETTIME
:
if
(
copy_from_user
(
&
par_timeout
,
(
struct
timeval
*
)
arg
,
sizeof
(
struct
timeval
)))
{
if
(
copy_from_user
(
&
par_timeout
,
argp
,
sizeof
(
struct
timeval
)))
{
return
-
EFAULT
;
}
/* Convert to jiffies, place in pp->pdev->timeout */
...
...
@@ -622,10 +621,8 @@ static int pp_ioctl(struct inode *inode, struct file *file,
to_jiffies
=
pp
->
pdev
->
timeout
;
par_timeout
.
tv_sec
=
to_jiffies
/
HZ
;
par_timeout
.
tv_usec
=
(
to_jiffies
%
(
long
)
HZ
)
*
(
1000000
/
HZ
);
if
(
copy_to_user
((
struct
timeval
*
)
arg
,
&
par_timeout
,
sizeof
(
struct
timeval
)))
{
if
(
copy_to_user
(
argp
,
&
par_timeout
,
sizeof
(
struct
timeval
)))
return
-
EFAULT
;
}
return
0
;
default:
...
...
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