Date: Tue, 9 Nov 2004 17:46:15 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: Julian Elischer <julian@elischer.org> Cc: freebsd-usb@freebsd.org Subject: Re: new USB driver Message-ID: <20041109174615.A280@curly.tele2.no> In-Reply-To: <418FDB40.6090209@elischer.org>; from julian@elischer.org on Mon, Nov 08, 2004 at 12:46:56PM -0800 References: <20041107194658.B466@curly.tele2.no> <20041107.130436.91313722.imp@bsdimp.com> <20041108174425.A283@curly.tele2.no> <418FDB40.6090209@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041109174615.A280>