Implement sbc_lockassert() and sb_lockassert() functions to allow
proper locking to be checked at runtime. Remove sb_lock() and sb_unlock() calls from sb_reset_dsp() because the latter is called from sb_setup() with the lock already held. Add a call to sb_lockassert(). Surround the call to sb_reset_dsp() in sb16_attach() with sb_lock() and sb_unlock() calls. Tested by: Bartek Marcinkiewicz <junior AT p233.if.pwr.wroc.pl>
This commit is contained in:
parent
ea4ac135ff
commit
9d2820eaac
@ -8,6 +8,7 @@
|
||||
|
||||
struct sbc_softc;
|
||||
void sbc_lock(struct sbc_softc *);
|
||||
void sbc_lockassert(struct sbc_softc *);
|
||||
void sbc_unlock(struct sbc_softc *);
|
||||
|
||||
/*
|
||||
|
@ -123,6 +123,12 @@ sb_lock(struct sb_info *sb) {
|
||||
sbc_lock(device_get_softc(sb->parent_dev));
|
||||
}
|
||||
|
||||
static void
|
||||
sb_lockassert(struct sb_info *sb) {
|
||||
|
||||
sbc_lockassert(device_get_softc(sb->parent_dev));
|
||||
}
|
||||
|
||||
static void
|
||||
sb_unlock(struct sb_info *sb) {
|
||||
|
||||
@ -266,12 +272,11 @@ sb_reset_dsp(struct sb_info *sb)
|
||||
{
|
||||
u_char b;
|
||||
|
||||
sb_lock(sb);
|
||||
sb_lockassert(sb);
|
||||
sb_wr(sb, SBDSP_RST, 3);
|
||||
DELAY(100);
|
||||
sb_wr(sb, SBDSP_RST, 0);
|
||||
b = sb_get_byte(sb);
|
||||
sb_unlock(sb);
|
||||
if (b != 0xAA) {
|
||||
DEB(printf("sb_reset_dsp 0x%lx failed\n",
|
||||
rman_get_start(sb->io_base)));
|
||||
@ -799,8 +804,12 @@ sb16_attach(device_t dev)
|
||||
|
||||
if (sb16_alloc_resources(sb, dev))
|
||||
goto no;
|
||||
if (sb_reset_dsp(sb))
|
||||
sb_lock(sb);
|
||||
if (sb_reset_dsp(sb)) {
|
||||
sb_unlock(sb);
|
||||
goto no;
|
||||
}
|
||||
sb_unlock(sb);
|
||||
if (mixer_init(dev, &sb16mix_mixer_class, sb))
|
||||
goto no;
|
||||
if (snd_setup_intr(dev, sb->irq, 0, sb_intr, sb, &sb->ih))
|
||||
|
@ -131,6 +131,12 @@ sbc_lock(struct sbc_softc *scp)
|
||||
snd_mtxlock(scp->lock);
|
||||
}
|
||||
|
||||
void
|
||||
sbc_lockassert(struct sbc_softc *scp)
|
||||
{
|
||||
snd_mtxassert(scp->lock);
|
||||
}
|
||||
|
||||
void
|
||||
sbc_unlock(struct sbc_softc *scp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user