Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2008 18:02:47 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Stefan Lambrev <stefan.lambrev@moneybookers.com>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: [SOLVED] Re: Problem with usb4bsd rev566
Message-ID:  <200801161802.48506.hselasky@c2i.net>
In-Reply-To: <478D17E2.5000908@moneybookers.com>
References:  <477BC1A3.5080406@moneybookers.com> <200801152048.54719.hselasky@c2i.net> <478D17E2.5000908@moneybookers.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

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 ?

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801161802.48506.hselasky>