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
6681f46b
Commit
6681f46b
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/sscape.c - convert cli to spinlocks
parent
d0dd4250
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
46 deletions
+32
-46
sound/oss/sscape.c
sound/oss/sscape.c
+32
-46
No files found.
sound/oss/sscape.c
View file @
6681f46b
...
...
@@ -40,6 +40,7 @@
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/wrapper.h>
#include <linux/spinlock.h>
#include "coproc.h"
...
...
@@ -115,7 +116,7 @@ typedef struct sscape_info
char
*
raw_buf
;
unsigned
long
raw_buf_phys
;
int
buffsize
;
/* -------------------------- */
spinlock_t
lock
;
int
ok
;
/* Properly detected */
int
failed
;
int
dma_allocated
;
...
...
@@ -164,11 +165,10 @@ static unsigned char sscape_read(struct sscape_info *devc, int reg)
unsigned
long
flags
;
unsigned
char
val
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
outb
(
reg
,
PORT
(
ODIE_ADDR
));
val
=
inb
(
PORT
(
ODIE_DATA
));
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
val
;
}
...
...
@@ -176,11 +176,10 @@ static void sscape_write(struct sscape_info *devc, int reg, int data)
{
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
outb
(
reg
,
PORT
(
ODIE_ADDR
));
outb
(
data
,
PORT
(
ODIE_DATA
));
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
}
static
unsigned
char
sscape_pnp_read_codec
(
sscape_info
*
devc
,
unsigned
char
reg
)
...
...
@@ -188,11 +187,10 @@ static unsigned char sscape_pnp_read_codec(sscape_info* devc, unsigned char reg)
unsigned
char
res
;
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
outb
(
reg
,
devc
->
codec
);
res
=
inb
(
devc
->
codec
+
1
);
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
res
;
}
...
...
@@ -201,11 +199,10 @@ static void sscape_pnp_write_codec(sscape_info* devc, unsigned char reg, unsigne
{
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
outb
(
reg
,
devc
->
codec
);
outb
(
data
,
devc
->
codec
+
1
);
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
}
static
void
host_open
(
struct
sscape_info
*
devc
)
...
...
@@ -223,9 +220,7 @@ static int host_write(struct sscape_info *devc, unsigned char *data, int count)
unsigned
long
flags
;
int
i
,
timeout_val
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
/*
* Send the command and data bytes
*/
...
...
@@ -238,12 +233,12 @@ static int host_write(struct sscape_info *devc, unsigned char *data, int count)
if
(
timeout_val
<=
0
)
{
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
0
;
}
outb
(
data
[
i
],
PORT
(
HOST_DATA
));
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
1
;
}
...
...
@@ -253,9 +248,7 @@ static int host_read(struct sscape_info *devc)
int
timeout_val
;
unsigned
char
data
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
/*
* Read a byte
*/
...
...
@@ -266,11 +259,11 @@ static int host_read(struct sscape_info *devc)
if
(
timeout_val
<=
0
)
{
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
-
1
;
}
data
=
inb
(
PORT
(
HOST_DATA
));
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
data
;
}
...
...
@@ -391,14 +384,13 @@ static void sscape_coproc_close(void *dev_info, int sub_device)
struct
sscape_info
*
devc
=
dev_info
;
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
if
(
devc
->
dma_allocated
)
{
sscape_write
(
devc
,
GA_DMAA_REG
,
0x20
);
/* DMA channel disabled */
devc
->
dma_allocated
=
0
;
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
;
}
...
...
@@ -420,14 +412,13 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
* before continuing.
*/
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
codec_dma_bits
=
sscape_read
(
devc
,
GA_CDCFG_REG
);
if
(
devc
->
dma_allocated
==
0
)
devc
->
dma_allocated
=
1
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
sscape_write
(
devc
,
GA_HMCTL_REG
,
(
temp
=
sscape_read
(
devc
,
GA_HMCTL_REG
))
&
0x3f
);
/*Reset */
...
...
@@ -449,8 +440,7 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
}
memcpy
(
audio_devs
[
devc
->
codec_audiodev
]
->
dmap_out
->
raw_buf
,
block
,
size
);
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
/******** INTERRUPTS DISABLED NOW ********/
...
...
@@ -475,7 +465,7 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
done
=
1
;
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
if
(
!
done
)
return
0
;
...
...
@@ -494,9 +484,7 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
/*
* Wait until the ODB wakes up
*/
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
done
=
0
;
timeout_val
=
5
*
HZ
;
while
(
!
done
&&
timeout_val
--
>
0
)
...
...
@@ -513,14 +501,13 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
}
sscape_write
(
devc
,
GA_CDCFG_REG
,
codec_dma_bits
);
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
if
(
!
done
)
{
printk
(
KERN_ERR
"soundscape: The OBP didn't respond after code download
\n
"
);
return
0
;
}
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
done
=
0
;
timeout_val
=
5
*
HZ
;
while
(
!
done
&&
timeout_val
--
>
0
)
...
...
@@ -529,7 +516,7 @@ static int sscape_download_boot(struct sscape_info *devc, unsigned char *block,
if
(
inb
(
PORT
(
HOST_DATA
))
==
0xfe
)
/* Host startup acknowledge */
done
=
1
;
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
if
(
!
done
)
{
printk
(
KERN_ERR
"soundscape: OBP Initialization failed.
\n
"
);
...
...
@@ -675,8 +662,7 @@ void __init attach_sscape(struct address_info *hw_config)
if
(
!
sscape_is_pnp
)
{
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
for
(
i
=
1
;
i
<
10
;
i
++
)
{
switch
(
i
)
...
...
@@ -710,7 +696,7 @@ void __init attach_sscape(struct address_info *hw_config)
sscape_write
(
devc
,
i
,
regs
[
i
]);
}
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
}
#ifdef SSCAPE_DEBUG2
/*
...
...
@@ -960,8 +946,7 @@ static int sscape_pnp_upload_file(sscape_info* devc, char* fn)
return
0
;
}
dt
=
data
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
devc
->
lock
,
flags
);
while
(
len
>
0
)
{
if
(
len
>
devc
->
buffsize
)
l
=
devc
->
buffsize
;
else
l
=
len
;
...
...
@@ -970,12 +955,12 @@ static int sscape_pnp_upload_file(sscape_info* devc, char* fn)
sscape_start_dma
(
devc
->
dma
,
devc
->
raw_buf_phys
,
l
,
0x48
);
sscape_pnp_start_dma
(
devc
,
0
);
if
(
sscape_pnp_wait_dma
(
devc
,
0
)
==
0
)
{
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
return
0
;
}
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
devc
->
lock
,
flags
);
vfree
(
data
);
outb
(
0
,
devc
->
base
+
2
);
...
...
@@ -1469,6 +1454,7 @@ static int __init init_sscape(void)
devc
->
codec_type
=
0
;
devc
->
ic_type
=
0
;
devc
->
raw_buf
=
NULL
;
spin_lock_init
(
&
devc
->
lock
);
if
(
cfg
.
dma
==
-
1
||
cfg
.
irq
==
-
1
||
cfg
.
io_base
==
-
1
)
{
printk
(
KERN_ERR
"DMA, IRQ, and IO port must be specified.
\n
"
);
...
...
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