Date: Wed, 16 Jan 2008 20:06:45 +0200 From: Stefan Lambrev <stefan.lambrev@moneybookers.com> To: Hans Petter Selasky <hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: [SOLVED] Re: Problem with usb4bsd rev566 Message-ID: <478E47B5.9010104@moneybookers.com> In-Reply-To: <200801161802.48506.hselasky@c2i.net> References: <477BC1A3.5080406@moneybookers.com> <200801152048.54719.hselasky@c2i.net> <478D17E2.5000908@moneybookers.com> <200801161802.48506.hselasky@c2i.net>
index | next in thread | previous in thread | raw e-mail
Hi Hans,
Hans Petter Selasky wrote:
> On Tuesday 15 January 2008, Stefan Lambrev wrote:
>
>> Hi Hans,
>>
>> Thanks for your response.
>> I'm little puzzled right now :)
>>
>
> Hi Stefan,
>
> The order in which the callbacks are called is not that important.
>
> "dropcount" == number of callbacks to call. The xfer[] array is filled
> starting at index 0 up to and including index 3.
>
> If dropcount == 1 then
> call callback on xfer[0] only
>
> If dropcount == 2 then
> call callback on xfer[1]
> call callback on xfer[0]
>
> If dropcount == 3 then
> call callback on xfer[2]
> call callback on xfer[1]
> call callback on xfer[0]
>
> This I optimized into a switch statement:
>
> switch(dropcount) {
> ...
> }
>
> Looking at your patch I think you have the old files! Try "svn revert
> usb_transfer.c" and "svn revert usb_port.h" or something similar. I'm at
> revision 568.
>
Yes you are completely right.
I understand the beauty of this switch now ;)
Btw do we need this part:
default:
break;
The only way for dropcount to not be defined is if xfer[0] == NULL, but
we will never reach to the switch if it is.
> Regarding thread_lock and thread_unlock already being defined, you are right.
>
> I've done like this now:
>
> #if (__FreeBSD_version >= 800000)
> #define usb_thread_create(f, s, p, ...) \
> kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
> #define usb_thread_exit(err) kproc_exit(err)
> #else
> #define usb_thread_create(f, s, p, ...) \
> kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
> #define usb_thread_exit(err) kthread_exit(err)
> #endif
>
> #if (__FreeBSD_version < 700000)
> #define thread_lock(td) mtx_lock_spin(&sched_lock)
> #define thread_unlock(td) mtx_unlock_spin(&sched_lock)
> #endif
>
> Is this Ok ?
>
I'll build new kernel and will let you know.
But yes it seems OK :)
> --HPS
>
--
Best Wishes,
Stefan Lambrev
ICQ# 24134177
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?478E47B5.9010104>
