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
06c2ec1f
Commit
06c2ec1f
authored
Aug 29, 2002
by
Peter Wächtler
Committed by
Linus Torvalds
Aug 29, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] oss/audio.c - convert cli to spinlocks
parent
ec114740
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
25 deletions
+11
-25
sound/oss/audio.c
sound/oss/audio.c
+11
-25
No files found.
sound/oss/audio.c
View file @
06c2ec1f
...
...
@@ -291,10 +291,6 @@ int audio_write(int dev, struct file *file, const char *buf, int count)
if
(
audio_devs
[
dev
]
->
local_conversion
&
CNV_MU_LAW
)
{
/*
* This just allows interrupts while the conversion is running
*/
sti
();
translate_bytes
(
ulaw_dsp
,
(
unsigned
char
*
)
dma_buf
,
l
);
}
c
-=
used
;
...
...
@@ -352,11 +348,6 @@ int audio_read(int dev, struct file *file, char *buf, int count)
if
(
audio_devs
[
dev
]
->
local_conversion
&
CNV_MU_LAW
)
{
/*
* This just allows interrupts while the conversion is running
*/
sti
();
translate_bytes
(
dsp_ulaw
,
(
unsigned
char
*
)
dmabuf
,
l
);
}
...
...
@@ -515,8 +506,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg)
break
;
}
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
dmap
->
lock
,
flags
);
/* Compute number of bytes that have been played */
count
=
DMAbuf_get_buffer_pointer
(
dev
,
dmap
,
DMODE_OUTPUT
);
if
(
count
<
dmap
->
fragment_size
&&
dmap
->
qhead
!=
0
)
...
...
@@ -527,7 +517,7 @@ int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg)
count
=
dmap
->
user_counter
-
count
;
if
(
count
<
0
)
count
=
0
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
val
=
count
;
break
;
...
...
@@ -836,15 +826,14 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
if
(
!
(
audio_devs
[
dev
]
->
flags
&
DMA_DUPLEX
)
&&
(
bits
&
PCM_ENABLE_INPUT
)
&&
(
bits
&
PCM_ENABLE_OUTPUT
))
return
-
EINVAL
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
dmap
->
lock
,
flags
);
changed
=
audio_devs
[
dev
]
->
enable_bits
^
bits
;
if
((
changed
&
bits
)
&
PCM_ENABLE_INPUT
&&
audio_devs
[
dev
]
->
go
)
{
reorganize_buffers
(
dev
,
dmap_in
,
1
);
if
((
err
=
audio_devs
[
dev
]
->
d
->
prepare_for_input
(
dev
,
dmap_in
->
fragment_size
,
dmap_in
->
nbufs
))
<
0
)
{
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
return
-
err
;
}
dmap_in
->
dma_mode
=
DMODE_INPUT
;
...
...
@@ -867,7 +856,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
if (changed && audio_devs[dev]->d->trigger)
audio_devs[dev]->d->trigger(dev, bits * audio_devs[dev]->go);
#endif
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
/* Falls through... */
case
SNDCTL_DSP_GETTRIGGER
:
...
...
@@ -884,8 +873,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
case
SNDCTL_DSP_GETIPTR
:
if
(
!
(
audio_devs
[
dev
]
->
open_mode
&
OPEN_READ
))
return
-
EINVAL
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
dmap
->
lock
,
flags
);
cinfo
.
bytes
=
dmap_in
->
byte_counter
;
cinfo
.
ptr
=
DMAbuf_get_buffer_pointer
(
dev
,
dmap_in
,
DMODE_INPUT
)
&
~
3
;
if
(
cinfo
.
ptr
<
dmap_in
->
fragment_size
&&
dmap_in
->
qtail
!=
0
)
...
...
@@ -894,7 +882,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
cinfo
.
bytes
+=
cinfo
.
ptr
;
if
(
dmap_in
->
mapping_flags
&
DMA_MAP_MAPPED
)
dmap_in
->
qlen
=
0
;
/* Reset interrupt counter */
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
if
(
copy_to_user
(
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
0
;
...
...
@@ -903,8 +891,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
if
(
!
(
audio_devs
[
dev
]
->
open_mode
&
OPEN_WRITE
))
return
-
EINVAL
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
dmap
->
lock
,
flags
);
cinfo
.
bytes
=
dmap_out
->
byte_counter
;
cinfo
.
ptr
=
DMAbuf_get_buffer_pointer
(
dev
,
dmap_out
,
DMODE_OUTPUT
)
&
~
3
;
if
(
cinfo
.
ptr
<
dmap_out
->
fragment_size
&&
dmap_out
->
qhead
!=
0
)
...
...
@@ -913,7 +900,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
cinfo
.
bytes
+=
cinfo
.
ptr
;
if
(
dmap_out
->
mapping_flags
&
DMA_MAP_MAPPED
)
dmap_out
->
qlen
=
0
;
/* Reset interrupt counter */
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
if
(
copy_to_user
(
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
0
;
...
...
@@ -926,8 +913,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
ret
=
0
;
break
;
}
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
dmap
->
lock
,
flags
);
/* Compute number of bytes that have been played */
count
=
DMAbuf_get_buffer_pointer
(
dev
,
dmap_out
,
DMODE_OUTPUT
);
if
(
count
<
dmap_out
->
fragment_size
&&
dmap_out
->
qhead
!=
0
)
...
...
@@ -937,7 +923,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
count
=
dmap_out
->
user_counter
-
count
;
if
(
count
<
0
)
count
=
0
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
dmap
->
lock
,
flags
);
ret
=
count
;
break
;
...
...
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