From owner-freebsd-usb@FreeBSD.ORG Sat Sep 13 23:47:02 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E2A106566B for ; Sat, 13 Sep 2008 23:47:02 +0000 (UTC) (envelope-from olivier@gid0.org) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.154]) by mx1.freebsd.org (Postfix) with ESMTP id AEB918FC17 for ; Sat, 13 Sep 2008 23:47:01 +0000 (UTC) (envelope-from olivier@gid0.org) Received: by fg-out-1718.google.com with SMTP id l26so891108fgb.35 for ; Sat, 13 Sep 2008 16:47:00 -0700 (PDT) Received: by 10.181.2.2 with SMTP id e2mr4201819bki.49.1221349619057; Sat, 13 Sep 2008 16:46:59 -0700 (PDT) Received: by 10.180.207.17 with HTTP; Sat, 13 Sep 2008 16:46:59 -0700 (PDT) Message-ID: <367b2c980809131646n2b5bd8e9gc44a22147dacbd5@mail.gmail.com> Date: Sun, 14 Sep 2008 01:46:59 +0200 From: "Olivier SMEDTS" To: "Hans Petter Selasky" In-Reply-To: <200809132245.14748.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <367b2c980809121246j16fba781s29c0da806f555ebe@mail.gmail.com> <200809132016.10604.hselasky@c2i.net> <367b2c980809131332l1d07ff8ah7072f912e357782@mail.gmail.com> <200809132245.14748.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: new usb2 stack : -current patch with mpsafe tty layer available ? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2008 23:47:02 -0000 Thanks for the patchs. I've got it working, no problem with my usb mouse and FAT32 formatted usb flash key. One glitch though : a warning in usb2_serial with latest CURRENT, which made gcc fail with -Werror : cc -O2 -pipe -march=native -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c /work/src/sys/modules/usb2/serial/../../../dev/usb2/serial/usb2_serial.c cc1: warnings being treated as errors /work/src/sys/modules/usb2/serial/../../../dev/usb2/serial/usb2_serial.c: In function 'usb2_com_put_data': /work/src/sys/modules/usb2/serial/../../../dev/usb2/serial/usb2_serial.c:1043: warning: 'cnt' may be used uninitialized in this function I had to compile it without -Werror. Olivier 2008/9/13 Hans Petter Selasky : > On Saturday 13 September 2008, Olivier SMEDTS wrote: >> 2008/9/13 Hans Petter Selasky : >> > 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 > -- Olivier Smedts _ ASCII ribbon campaign ( ) e-mail: olivier@gid0.org - against HTML email & vCards X www: http://www.gid0.org - against proprietary attachments / \ "Il y a seulement 10 sortes de gens dans le monde : ceux qui comprennent le binaire, et ceux qui ne le comprennent pas."