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

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to