From owner-freebsd-usb@FreeBSD.ORG Thu Apr 5 14:52:57 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B12FF16A404 for ; Thu, 5 Apr 2007 14:52:57 +0000 (UTC) (envelope-from gofdu-freebsd-usb@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 47EB813C458 for ; Thu, 5 Apr 2007 14:52:57 +0000 (UTC) (envelope-from gofdu-freebsd-usb@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HZTIl-0008FL-VP for freebsd-usb@freebsd.org; Thu, 05 Apr 2007 16:51:04 +0200 Received: from mulderlab.f5.com ([205.229.151.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Apr 2007 16:51:03 +0200 Received: from atkin901 by mulderlab.f5.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Apr 2007 16:51:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-usb@freebsd.org From: Mark Atkinson Date: Thu, 05 Apr 2007 07:47:56 -0700 Lines: 75 Message-ID: References: <200704042037.32793.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: mulderlab.f5.com User-Agent: KNode/0.10.4 Sender: news Subject: Re: msleep redefined error in hselasky/usb4bsd/ svn patch against -current 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: Thu, 05 Apr 2007 14:52:57 -0000 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 I tried to get by with make CWARNFLAGS=-Wall buildkernel although it took me a while to remember/find where that was. However getting rid of the 'implicit' warning might require a bit more than changing some compile flags. -- Mark Atkinson atkin901@yahoo.com (!wired)?(coffee++):(wired);