Date: Thu, 5 Apr 2007 19:13:58 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-usb@freebsd.org Cc: Mark Atkinson <atkin901@yahoo.com> Subject: Re: msleep redefined error in hselasky/usb4bsd/ svn patch against -current Message-ID: <200704051913.58653.hselasky@c2i.net> In-Reply-To: <ev326u$oqp$1@sea.gmane.org> References: <ev0nvi$di4$1@sea.gmane.org> <200704042037.32793.hselasky@c2i.net> <ev326u$oqp$1@sea.gmane.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 05 April 2007 16:47, Mark Atkinson wrote: > Hans Petter Selasky wrote: > > On Wednesday 04 April 2007 19:41, Mark Atkinson wrote: > >> I get the following error when trying to compile the proposed usb4bsd > >> stack against current. > >> > >> In file included from /usr/src/sys/dev/usb/ehci.c:67: > >> /usr/src/sys/dev/usb/usb_port.h:293:1: "msleep" redefined > >> In file included from /usr/src/sys/dev/usb/ehci.c:58: > >> /usr/src/sys/sys/systm.h:313:1: this is the location of the previous > >> definition > >> *** Error code 1 > >> > >> Sure enough, it is intentionally redefined: > >> > >> sys/dev/usb/usb_port.h:290-293 > >> > >> /* preliminary fix for a bug in msleep on FreeBSD, > >> * which cannot sleep with Giant: > >> */ > >> #define msleep(i,m,p,w,t) msleep(i,(((m) == &Giant) ? NULL : (m)),p,w,t) > > > > When I integrate my driver against FreeBSD-7 current, I will add some > > "#if" statements for those issues. Until further: > > > > In /sys/dev/usb/usb_port.h, use the following: > > > > /* preliminary fix for a bug in msleep on FreeBSD, > > * which cannot sleep with Giant: > > */ > > #undef msleep > > #define msleep(i,m,p,w,t) _sleep(i,(((m) == &Giant) ? \ > > NULL : &(m)->mtx_object),p,w,t) > > > > After this patch you have to insert a NULL argument, to all > > bus_setup_intr() functions you find in the files /sys/dev/usb/*pci.c like > > shown below ? > > > > error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_TTY, > > - si_intr, sc, &ih); > > + NULL, si_intr, sc, &ih); > > > > Hope that is not too much patching. > > > > --HPS > > Not enough patching.. :-) Even with these changes, it still generates > warnings on this macro. Since kernel compiles are with -Werr > and -Wnested-externs, this kills the compile when dereferencing msleep() > > /usr/src/sys/dev/usb/ugen.c: In function `ugenwrite': > /usr/src/sys/dev/usb/ugen.c:1260: warning: nested extern declaration of > `msleep' > /usr/src/sys/dev/usb/ugen.c:562: warning: redundant redeclaration > of 'msleep' > /usr/src/sys/dev/usb/ugen.c:562: warning: previous implicit declaration > of 'msleep' was here > *** Error code 1 > Could you send me your /usr/src/sys/dev/usb/usb_port.h . Are you sure that you applied my patch correctly? "msleep()" should not be undefined. Rather msleep() should expand to _sleep() . --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704051913.58653.hselasky>