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
2e2cb285
Commit
2e2cb285
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: cs46xx annotation
cs46xx annotated
parent
35a2f28e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
48 deletions
+51
-48
sound/oss/cs46xx.c
sound/oss/cs46xx.c
+51
-48
No files found.
sound/oss/cs46xx.c
View file @
2e2cb285
...
@@ -1717,7 +1717,7 @@ static irqreturn_t cs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -1717,7 +1717,7 @@ static irqreturn_t cs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/**********************************************************************/
/**********************************************************************/
static
ssize_t
cs_midi_read
(
struct
file
*
file
,
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
cs_midi_read
(
struct
file
*
file
,
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
ssize_t
ret
;
ssize_t
ret
;
...
@@ -1762,7 +1762,7 @@ static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_
...
@@ -1762,7 +1762,7 @@ static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_
}
}
static
ssize_t
cs_midi_write
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
cs_midi_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
ssize_t
ret
;
ssize_t
ret
;
...
@@ -2037,7 +2037,7 @@ static void CopySamples(char *dst, char *src, int count, unsigned fmt,
...
@@ -2037,7 +2037,7 @@ static void CopySamples(char *dst, char *src, int count, unsigned fmt,
*/
*/
static
unsigned
cs_copy_to_user
(
static
unsigned
cs_copy_to_user
(
struct
cs_state
*
s
,
struct
cs_state
*
s
,
void
*
dest
,
void
__user
*
dest
,
void
*
hwsrc
,
void
*
hwsrc
,
unsigned
cnt
,
unsigned
cnt
,
unsigned
*
copied
)
unsigned
*
copied
)
...
@@ -2046,8 +2046,8 @@ static unsigned cs_copy_to_user(
...
@@ -2046,8 +2046,8 @@ static unsigned cs_copy_to_user(
void
*
src
=
hwsrc
;
/* default to the standard destination buffer addr */
void
*
src
=
hwsrc
;
/* default to the standard destination buffer addr */
CS_DBGOUT
(
CS_FUNCTION
,
6
,
printk
(
KERN_INFO
CS_DBGOUT
(
CS_FUNCTION
,
6
,
printk
(
KERN_INFO
"cs_copy_to_user()+ fmt=0x%x cnt=%d dest=
0x%.8x
\n
"
,
"cs_copy_to_user()+ fmt=0x%x cnt=%d dest=
%p
\n
"
,
dmabuf
->
fmt
,(
unsigned
)
cnt
,
(
unsigned
)
dest
)
);
dmabuf
->
fmt
,(
unsigned
)
cnt
,
dest
)
);
if
(
cnt
>
dmabuf
->
dmasize
)
if
(
cnt
>
dmabuf
->
dmasize
)
{
{
...
@@ -2074,8 +2074,8 @@ static unsigned cs_copy_to_user(
...
@@ -2074,8 +2074,8 @@ static unsigned cs_copy_to_user(
if
(
copy_to_user
(
dest
,
src
,
cnt
))
if
(
copy_to_user
(
dest
,
src
,
cnt
))
{
{
CS_DBGOUT
(
CS_FUNCTION
,
2
,
printk
(
KERN_ERR
CS_DBGOUT
(
CS_FUNCTION
,
2
,
printk
(
KERN_ERR
"cs46xx: cs_copy_to_user()- fault dest=
0x%x src=0x%x
cnt=%d
\n
"
,
"cs46xx: cs_copy_to_user()- fault dest=
%p src=%p
cnt=%d
\n
"
,
(
unsigned
)
dest
,(
unsigned
)
src
,
cnt
)
);
dest
,
src
,
cnt
)
);
*
copied
=
0
;
*
copied
=
0
;
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -2087,7 +2087,7 @@ static unsigned cs_copy_to_user(
...
@@ -2087,7 +2087,7 @@ static unsigned cs_copy_to_user(
/* in this loop, dmabuf.count signifies the amount of data that is waiting to be copied to
/* in this loop, dmabuf.count signifies the amount of data that is waiting to be copied to
the user's buffer. it is filled by the dma machine and drained by this loop. */
the user's buffer. it is filled by the dma machine and drained by this loop. */
static
ssize_t
cs_read
(
struct
file
*
file
,
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
cs_read
(
struct
file
*
file
,
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_state
*
state
;
struct
cs_state
*
state
;
...
@@ -2165,8 +2165,8 @@ static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *pp
...
@@ -2165,8 +2165,8 @@ static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *pp
CS_DBGOUT
(
CS_WAVE_READ
,
2
,
printk
(
KERN_INFO
CS_DBGOUT
(
CS_WAVE_READ
,
2
,
printk
(
KERN_INFO
"_read() copy_to cnt=%d count=%d "
,
cnt
,
count
)
);
"_read() copy_to cnt=%d count=%d "
,
cnt
,
count
)
);
CS_DBGOUT
(
CS_WAVE_READ
,
8
,
printk
(
KERN_INFO
CS_DBGOUT
(
CS_WAVE_READ
,
8
,
printk
(
KERN_INFO
" .dmasize=%d .count=%d buffer=
0x%.8x
ret=%d
\n
"
,
" .dmasize=%d .count=%d buffer=
%p
ret=%d
\n
"
,
dmabuf
->
dmasize
,
dmabuf
->
count
,
(
unsigned
)
buffer
,
ret
)
);
dmabuf
->
dmasize
,
dmabuf
->
count
,
buffer
,
ret
)
);
if
(
cs_copy_to_user
(
state
,
buffer
,
if
(
cs_copy_to_user
(
state
,
buffer
,
(
void
*
)((
unsigned
)
dmabuf
->
rawbuf
+
swptr
),
cnt
,
&
copied
))
(
void
*
)((
unsigned
)
dmabuf
->
rawbuf
+
swptr
),
cnt
,
&
copied
))
...
@@ -2196,7 +2196,7 @@ static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *pp
...
@@ -2196,7 +2196,7 @@ static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *pp
/* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
/* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
the soundcard. it is drained by the dma machine and filled by this loop. */
the soundcard. it is drained by the dma machine and filled by this loop. */
static
ssize_t
cs_write
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
cs_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_card
*
card
=
(
struct
cs_card
*
)
file
->
private_data
;
struct
cs_state
*
state
;
struct
cs_state
*
state
;
...
@@ -2486,6 +2486,8 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2486,6 +2486,8 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
audio_buf_info
abinfo
;
audio_buf_info
abinfo
;
count_info
cinfo
;
count_info
cinfo
;
int
val
,
valsave
,
mapped
,
ret
;
int
val
,
valsave
,
mapped
,
ret
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
__user
*
p
=
argp
;
state
=
(
struct
cs_state
*
)
card
->
states
[
0
];
state
=
(
struct
cs_state
*
)
card
->
states
[
0
];
if
(
state
)
if
(
state
)
...
@@ -2507,7 +2509,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2507,7 +2509,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
switch
(
cmd
)
switch
(
cmd
)
{
{
case
OSS_GETVERSION
:
case
OSS_GETVERSION
:
return
put_user
(
SOUND_VERSION
,
(
int
*
)
arg
);
return
put_user
(
SOUND_VERSION
,
p
);
case
SNDCTL_DSP_RESET
:
case
SNDCTL_DSP_RESET
:
/* FIXME: spin_lock ? */
/* FIXME: spin_lock ? */
...
@@ -2550,7 +2552,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2550,7 +2552,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
return
0
;
return
0
;
case
SNDCTL_DSP_SPEED
:
/* set sample rate */
case
SNDCTL_DSP_SPEED
:
/* set sample rate */
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
val
>=
0
)
{
if
(
val
>=
0
)
{
if
(
file
->
f_mode
&
FMODE_READ
)
{
if
(
file
->
f_mode
&
FMODE_READ
)
{
...
@@ -2582,12 +2584,12 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2582,12 +2584,12 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
file
->
f_mode
&
FMODE_WRITE
?
"DAC"
:
""
,
file
->
f_mode
&
FMODE_WRITE
?
"DAC"
:
""
,
file
->
f_mode
&
FMODE_READ
?
"ADC"
:
""
,
file
->
f_mode
&
FMODE_READ
?
"ADC"
:
""
,
dmabuf
->
rate
)
);
dmabuf
->
rate
)
);
return
put_user
(
dmabuf
->
rate
,
(
int
*
)
arg
);
return
put_user
(
dmabuf
->
rate
,
p
);
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SNDCTL_DSP_STEREO
:
/* set stereo or mono channel */
case
SNDCTL_DSP_STEREO
:
/* set stereo or mono channel */
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
state
=
(
struct
cs_state
*
)
card
->
states
[
1
];
state
=
(
struct
cs_state
*
)
card
->
states
[
1
];
...
@@ -2637,7 +2639,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2637,7 +2639,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
if
((
val
=
prog_dmabuf
(
state
)))
if
((
val
=
prog_dmabuf
(
state
)))
return
val
;
return
val
;
return
put_user
(
dmabuf
->
fragsize
,
(
int
*
)
arg
);
return
put_user
(
dmabuf
->
fragsize
,
p
);
}
}
}
}
if
(
file
->
f_mode
&
FMODE_READ
)
{
if
(
file
->
f_mode
&
FMODE_READ
)
{
...
@@ -2648,16 +2650,16 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2648,16 +2650,16 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
if
((
val
=
prog_dmabuf
(
state
)))
if
((
val
=
prog_dmabuf
(
state
)))
return
val
;
return
val
;
return
put_user
(
dmabuf
->
fragsize
/
dmabuf
->
divisor
,
return
put_user
(
dmabuf
->
fragsize
/
dmabuf
->
divisor
,
(
int
*
)
arg
);
p
);
}
}
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SNDCTL_DSP_GETFMTS
:
/* Returns a mask of supported sample format*/
case
SNDCTL_DSP_GETFMTS
:
/* Returns a mask of supported sample format*/
return
put_user
(
AFMT_S16_LE
|
AFMT_U8
,
(
int
*
)
arg
);
return
put_user
(
AFMT_S16_LE
|
AFMT_U8
,
p
);
case
SNDCTL_DSP_SETFMT
:
/* Select sample format */
case
SNDCTL_DSP_SETFMT
:
/* Select sample format */
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
CS_DBGOUT
(
CS_IOCTL
|
CS_PARMS
,
4
,
printk
(
CS_DBGOUT
(
CS_IOCTL
|
CS_PARMS
,
4
,
printk
(
"cs46xx: cs_ioctl() DSP_SETFMT %s %s %s %s
\n
"
,
"cs46xx: cs_ioctl() DSP_SETFMT %s %s %s %s
\n
"
,
...
@@ -2730,14 +2732,14 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2730,14 +2732,14 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
if
(
dmabuf
)
if
(
dmabuf
)
{
{
if
(
dmabuf
->
fmt
&
CS_FMT_16BIT
)
if
(
dmabuf
->
fmt
&
CS_FMT_16BIT
)
return
put_user
(
AFMT_S16_LE
,
(
int
*
)
arg
);
return
put_user
(
AFMT_S16_LE
,
p
);
else
else
return
put_user
(
AFMT_U8
,
(
int
*
)
arg
);
return
put_user
(
AFMT_U8
,
p
);
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SNDCTL_DSP_CHANNELS
:
case
SNDCTL_DSP_CHANNELS
:
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
val
!=
0
)
{
if
(
val
!=
0
)
{
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
...
@@ -2776,7 +2778,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2776,7 +2778,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
}
}
}
}
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_STEREO
)
?
2
:
1
,
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_STEREO
)
?
2
:
1
,
(
int
*
)
arg
);
p
);
case
SNDCTL_DSP_POST
:
case
SNDCTL_DSP_POST
:
/*
/*
...
@@ -2793,7 +2795,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2793,7 +2795,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
if
(
dmabuf
->
subdivision
)
if
(
dmabuf
->
subdivision
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
val
!=
1
&&
val
!=
2
)
if
(
val
!=
1
&&
val
!=
2
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2807,7 +2809,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2807,7 +2809,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
if
(
dmabuf
->
subdivision
)
if
(
dmabuf
->
subdivision
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
val
!=
1
&&
val
!=
2
)
if
(
val
!=
1
&&
val
!=
2
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2817,7 +2819,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2817,7 +2819,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
return
0
;
return
0
;
case
SNDCTL_DSP_SETFRAGMENT
:
case
SNDCTL_DSP_SETFRAGMENT
:
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
...
@@ -2861,7 +2863,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2861,7 +2863,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
abinfo
.
fragments
=
abinfo
.
bytes
>>
dmabuf
->
fragshift
;
abinfo
.
fragments
=
abinfo
.
bytes
>>
dmabuf
->
fragshift
;
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
return
copy_to_user
(
(
void
*
)
arg
,
&
abinfo
,
sizeof
(
abinfo
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
abinfo
,
sizeof
(
abinfo
))
?
-
EFAULT
:
0
;
}
}
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -2879,7 +2881,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2879,7 +2881,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
abinfo
.
fragstotal
=
dmabuf
->
numfrag
;
abinfo
.
fragstotal
=
dmabuf
->
numfrag
;
abinfo
.
fragments
=
abinfo
.
bytes
>>
dmabuf
->
fragshift
;
abinfo
.
fragments
=
abinfo
.
bytes
>>
dmabuf
->
fragshift
;
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
return
copy_to_user
(
(
void
*
)
arg
,
&
abinfo
,
sizeof
(
abinfo
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
abinfo
,
sizeof
(
abinfo
))
?
-
EFAULT
:
0
;
}
}
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -2889,7 +2891,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2889,7 +2891,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
case
SNDCTL_DSP_GETCAPS
:
case
SNDCTL_DSP_GETCAPS
:
return
put_user
(
DSP_CAP_REALTIME
|
DSP_CAP_TRIGGER
|
DSP_CAP_MMAP
,
return
put_user
(
DSP_CAP_REALTIME
|
DSP_CAP_TRIGGER
|
DSP_CAP_MMAP
,
(
int
*
)
arg
);
p
);
case
SNDCTL_DSP_GETTRIGGER
:
case
SNDCTL_DSP_GETTRIGGER
:
val
=
0
;
val
=
0
;
...
@@ -2915,10 +2917,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2915,10 +2917,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
}
}
}
}
CS_DBGOUT
(
CS_IOCTL
,
2
,
printk
(
"cs46xx: DSP_GETTRIGGER()- val=0x%x
\n
"
,
val
)
);
CS_DBGOUT
(
CS_IOCTL
,
2
,
printk
(
"cs46xx: DSP_GETTRIGGER()- val=0x%x
\n
"
,
val
)
);
return
put_user
(
val
,
(
int
*
)
arg
);
return
put_user
(
val
,
p
);
case
SNDCTL_DSP_SETTRIGGER
:
case
SNDCTL_DSP_SETTRIGGER
:
if
(
get_user
(
val
,
(
int
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
file
->
f_mode
&
FMODE_READ
)
{
if
(
file
->
f_mode
&
FMODE_READ
)
{
state
=
(
struct
cs_state
*
)
card
->
states
[
0
];
state
=
(
struct
cs_state
*
)
card
->
states
[
0
];
...
@@ -2961,7 +2963,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2961,7 +2963,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
cinfo
.
blocks
=
dmabuf
->
count
/
dmabuf
->
divisor
>>
dmabuf
->
fragshift
;
cinfo
.
blocks
=
dmabuf
->
count
/
dmabuf
->
divisor
>>
dmabuf
->
fragshift
;
cinfo
.
ptr
=
dmabuf
->
hwptr
/
dmabuf
->
divisor
;
cinfo
.
ptr
=
dmabuf
->
hwptr
/
dmabuf
->
divisor
;
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
if
(
copy_to_user
(
argp
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -2996,7 +2998,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -2996,7 +2998,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
"cs46xx: GETOPTR bytes=%d blocks=%d ptr=%d
\n
"
,
"cs46xx: GETOPTR bytes=%d blocks=%d ptr=%d
\n
"
,
cinfo
.
bytes
,
cinfo
.
blocks
,
cinfo
.
ptr
)
);
cinfo
.
bytes
,
cinfo
.
blocks
,
cinfo
.
ptr
)
);
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
state
->
card
->
lock
,
flags
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
if
(
copy_to_user
(
argp
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -3019,7 +3021,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -3019,7 +3021,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
}
}
else
else
val
=
0
;
val
=
0
;
return
put_user
(
val
,
(
int
*
)
arg
);
return
put_user
(
val
,
p
);
case
SOUND_PCM_READ_RATE
:
case
SOUND_PCM_READ_RATE
:
if
(
file
->
f_mode
&
FMODE_READ
)
if
(
file
->
f_mode
&
FMODE_READ
)
...
@@ -3029,9 +3031,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -3029,9 +3031,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
if
(
state
)
if
(
state
)
{
{
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
return
put_user
(
dmabuf
->
rate
,
(
int
*
)
arg
);
return
put_user
(
dmabuf
->
rate
,
p
);
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SOUND_PCM_READ_CHANNELS
:
case
SOUND_PCM_READ_CHANNELS
:
...
@@ -3043,9 +3045,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -3043,9 +3045,9 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
{
{
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_STEREO
)
?
2
:
1
,
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_STEREO
)
?
2
:
1
,
(
int
*
)
arg
);
p
);
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SOUND_PCM_READ_BITS
:
case
SOUND_PCM_READ_BITS
:
if
(
file
->
f_mode
&
FMODE_READ
)
if
(
file
->
f_mode
&
FMODE_READ
)
...
@@ -3056,10 +3058,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -3056,10 +3058,10 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
{
{
dmabuf
=
&
state
->
dmabuf
;
dmabuf
=
&
state
->
dmabuf
;
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_16BIT
)
?
return
put_user
((
dmabuf
->
fmt
&
CS_FMT_16BIT
)
?
AFMT_S16_LE
:
AFMT_U8
,
(
int
*
)
arg
);
AFMT_S16_LE
:
AFMT_U8
,
p
);
}
}
return
put_user
(
0
,
(
int
*
)
arg
);
return
put_user
(
0
,
p
);
case
SNDCTL_DSP_MAPINBUF
:
case
SNDCTL_DSP_MAPINBUF
:
case
SNDCTL_DSP_MAPOUTBUF
:
case
SNDCTL_DSP_MAPOUTBUF
:
...
@@ -4164,6 +4166,7 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int
...
@@ -4164,6 +4166,7 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int
struct
ac97_codec
*
codec
=
(
struct
ac97_codec
*
)
file
->
private_data
;
struct
ac97_codec
*
codec
=
(
struct
ac97_codec
*
)
file
->
private_data
;
struct
cs_card
*
card
=
NULL
;
struct
cs_card
*
card
=
NULL
;
struct
list_head
*
entry
;
struct
list_head
*
entry
;
unsigned
long
__user
*
p
=
(
long
__user
*
)
arg
;
#if CSDEBUG_INTERFACE
#if CSDEBUG_INTERFACE
int
val
;
int
val
;
...
@@ -4178,25 +4181,25 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int
...
@@ -4178,25 +4181,25 @@ static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int
{
{
case
SOUND_MIXER_CS_GETDBGMASK
:
case
SOUND_MIXER_CS_GETDBGMASK
:
return
put_user
(
cs_debugmask
,
(
unsigned
long
*
)
arg
);
return
put_user
(
cs_debugmask
,
p
);
case
SOUND_MIXER_CS_GETDBGLEVEL
:
case
SOUND_MIXER_CS_GETDBGLEVEL
:
return
put_user
(
cs_debuglevel
,
(
unsigned
long
*
)
arg
);
return
put_user
(
cs_debuglevel
,
p
);
case
SOUND_MIXER_CS_SETDBGMASK
:
case
SOUND_MIXER_CS_SETDBGMASK
:
if
(
get_user
(
val
,
(
unsigned
long
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
cs_debugmask
=
val
;
cs_debugmask
=
val
;
return
0
;
return
0
;
case
SOUND_MIXER_CS_SETDBGLEVEL
:
case
SOUND_MIXER_CS_SETDBGLEVEL
:
if
(
get_user
(
val
,
(
unsigned
long
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
cs_debuglevel
=
val
;
cs_debuglevel
=
val
;
return
0
;
return
0
;
case
SOUND_MIXER_CS_APM
:
case
SOUND_MIXER_CS_APM
:
if
(
get_user
(
val
,
(
unsigned
long
*
)
arg
))
if
(
get_user
(
val
,
p
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
val
==
CS_IOCTL_CMD_SUSPEND
)
if
(
val
==
CS_IOCTL_CMD_SUSPEND
)
{
{
...
...
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