From owner-freebsd-usb@FreeBSD.ORG Tue Nov 9 16:41:33 2004 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1EFC516A4CE for ; Tue, 9 Nov 2004 16:41:33 +0000 (GMT) Received: from mailfe06.swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D0A943D41 for ; Tue, 9 Nov 2004 16:41:32 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: gwFng4r08SDC4wwCdj+wfg== Received: from [193.216.46.184] (HELO curly.tele2.no) by mailfe06.swip.net (CommuniGate Pro SMTP 4.2.5) with ESMTP id 211718930; Tue, 09 Nov 2004 17:41:29 +0100 Received: (from root@localhost) by curly.tele2.no (8.12.5/8.12.3) id iA9GkHoj000693; Tue, 9 Nov 2004 17:46:17 +0100 (CET) (envelope-from hselasky@c2i.net) Date: Tue, 9 Nov 2004 17:46:15 +0100 From: Hans Petter Selasky To: Julian Elischer Message-ID: <20041109174615.A280@curly.tele2.no> References: <20041107194658.B466@curly.tele2.no> <20041107.130436.91313722.imp@bsdimp.com> <20041108174425.A283@curly.tele2.no> <418FDB40.6090209@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <418FDB40.6090209@elischer.org>; from julian@elischer.org on Mon, Nov 08, 2004 at 12:46:56PM -0800 cc: freebsd-usb@freebsd.org Subject: Re: new USB driver X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2004 16:41:33 -0000 On Mon, Nov 08, 2004 at 12:46:56PM -0800, Julian Elischer wrote: > > > Hans Petter Selasky wrote: > > > > >There are some more differences, but that will be details. My new USB driver > >is built upon the FreeBSD-5-current USB driver, but it is not fully compatible > >with it. > > > >So is it a candidate for a new /sys/ directory? > > > > I would hope not.. > > If these are generally useful changes then maybe they might also be > useful to NetBSD and OpenBSD. > If so, then they could be adopted everywhere and we could "migrate" to > it in the same place rather than > get a new directory. > > Have you thought about how your changes would go in 4.x? > > I assume it would require some work as you have incorporated the mutex > into how you do things.. > I have thought that maybe usb_port.h could contain a set of defines mtx_init, mtx_lock and mtx_unlock that call splxxx() and store the value returned from splxxx() into struct mtx { int s; int mtx_recurse; }. So porting to 4.x should not be a big problem. msleep() could be defined { mtx_unlock(); tsleep(); mtx_lock(); }, though there will be a small gap between unlock and sleep where wakeup can be called, it will work, if tsleep does not exit the current spl level then. concerning callouts I suggest that the FreeBSD-5 way is used and that other incompatible platforms use something like: struct callout { void *func; void *arg; }; #define callout_init(args...) #define callout_reset(h, t, f, d) { (h)->func = (f); (h)->arg = (d); timeout((f), (d), (t)); } #define callout_stop(h) { if((h)->func) { untimeout((h)->func, (h)->arg); (h)->func = NULL; } } Yours --HPS