new usb2 stack : -current patch with mpsafe tty layer available
?
Hans Petter Selasky
hselasky at c2i.net
Sat Sep 13 20:43:31 UTC 2008
On Saturday 13 September 2008, Olivier SMEDTS wrote:
> 2008/9/13 Hans Petter Selasky <hselasky at c2i.net>:
> > BTW: If you do a SVN update now on my tree, it should be up to date with
> > mpsafe TTY so usb2_serial should build fine.
>
> What are the needed patchs in order to build usb2_sound ?
> I use latest HDA patchs from ariff.
Hi,
You need the following three additional patches:
==== src/sys/dev/sound/pcm/channel.c
@@ -570,13 +570,26 @@
void
chn_intr(struct pcm_channel *c)
{
- CHN_LOCK(c);
+ uint8_t do_unlock;
+ if (CHN_LOCK_OWNED(c)) {
+ /*
+ * Allow sound drivers to call this function with
+ * "CHN_LOCK()" locked:
+ */
+ do_unlock = 0;
+ } else {
+ do_unlock = 1;
+ CHN_LOCK(c);
+ }
c->interrupts++;
if (c->direction == PCMDIR_PLAY)
chn_wrintr(c);
else
chn_rdintr(c);
- CHN_UNLOCK(c);
+ if (do_unlock) {
+ CHN_UNLOCK(c);
+ }
+ return;
}
u_int32_t
==== src/sys/dev/sound/pcm/channel.h
@@ -258,11 +258,13 @@
#endif
#ifdef USING_MUTEX
+#define CHN_LOCK_OWNED(c) mtx_owned((struct mtx *)((c)->lock))
#define CHN_LOCK(c) mtx_lock((struct mtx *)((c)->lock))
#define CHN_UNLOCK(c) mtx_unlock((struct mtx *)((c)->lock))
#define CHN_TRYLOCK(c) mtx_trylock((struct mtx *)((c)->lock))
#define CHN_LOCKASSERT(c) mtx_assert((struct mtx *)((c)->lock), MA_OWNED)
#else
+#define CHN_LOCK_OWNED(c) 0
#define CHN_LOCK(c)
#define CHN_UNLOCK(c)
#define CHN_TRYLOCK(c)
==== //depot/vendor/freebsd/src/sys/dev/sound/pcm/mixer.c#41 (text+ko) - //depot/projects/usb/src/sys/dev/sound/pcm/mixer.c#11 (text+ko) ==== content
@@ -589,7 +589,7 @@
KASSERT(m->type == MIXER_TYPE_SECONDARY,
("%s(): illegal mixer type=%d", __func__, m->type));
- snd_mtxlock(m->lock);
+ /* mixer uninit can sleep --hps */
MIXER_UNINIT(m);
@@ -704,14 +704,24 @@
return EBUSY;
}
+ /* destroy dev can sleep --hps */
+
+ snd_mtxunlock(m->lock);
+
pdev->si_drv1 = NULL;
destroy_dev(pdev);
+ snd_mtxlock(m->lock);
+
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
mixer_set(m, i, 0);
mixer_setrecsrc(m, SOUND_MASK_MIC);
+ snd_mtxunlock(m->lock);
+
+ /* mixer uninit can sleep --hps */
+
MIXER_UNINIT(m);
snd_mtxfree(m->lock);
@@ -1280,3 +1290,16 @@
return (EINVAL);
}
+
+/*
+ * Allow the sound driver to use the mixer lock to protect its mixer
+ * data:
+ */
+struct mtx *
+mixer_get_lock(struct snd_mixer *m)
+{
+ if (m->lock == NULL) {
+ return (&Giant);
+ }
+ return (m->lock);
+}
==== src/sys/dev/sound/pcm/mixer.h
@@ -56,6 +56,7 @@
u_int32_t mix_getparent(struct snd_mixer *m, u_int32_t dev);
u_int32_t mix_getchild(struct snd_mixer *m, u_int32_t dev);
void *mix_getdevinfo(struct snd_mixer *m);
+struct mtx *mixer_get_lock(struct snd_mixer *m);
extern int mixer_count;
--HPS
More information about the freebsd-usb
mailing list