On Mon, 15 Dec 2003, AAZ wrote: > > It looks like the macro version of usb_settoggle() is correct. We see > > > > printk(KERN_WARNING "Mio: %x %x {%x} %x {%x}\n" > > ,ep > > , (ps->dev)->toggle[!(ep & USB_DIR_IN)] > > ,((ps->dev)->toggle[!(ep & USB_DIR_IN)] & ~( 1 << ep & 0xf > > )) | ((0) << ep & 0xf) > > ,((ps->dev)->toggle[!(ep & USB_DIR_IN)] & ~( 1 << ( ep & > > 0xf ) )) | ((0) << ep & 0xf) > > ,((ps->dev)->toggle[!(ep & USB_DIR_IN)] & ~((1 << ep )& 0xf > > )) | ((0) << ep & 0xf) > > ); > > > > And the output in amload: > > > > Mio: 5 0 {0} 0 {0} > > Mio: 85 0 {0} 0 {0} > > Mio: 5 20 {20} 0 {20} <====== Differents result as macro > > and as function. usb_resetep(adsl_handle, USB_OUT_FIRM ); > > Mio: 85 0 {0} 0 {0} > > > > > > In "Mio: 5 20 {20} 0 {20}", the 0 value is what the result should be, and > > that's what you would get using the macro. > > > > I don't speak/read english very good, sorry. > > The macro that work good for us , from kernel 2.4.20 and change in > 2.4.21-pre5, is: > > #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = > ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep)) > > The expansion for "usb_settoggle(ps->dev, ep & 0xf, !(ep & USB_DIR_IN), 0" > is : > > (dev)->toggle[!(ep & USB_DIR_IN)] = ((dev)->toggle[!(ep & USB_DIR_IN)] & ~(1 > << ep & 0xf)) | ((0) << ep & 0xf) > > You say "> It looks like the macro version of usb_settoggle() is correct." > but "the 0 value is what the result should be" too. > But macro version get 0x20 not 0x00. Function version get 0x00.
You're right -- I used the wrong word! I meant the function version is correct. Sorry... The old macro worked for you because there were two errors. The first error was in the macro; the expansion was wrong. But that was okay because of the second error: The macro should not have been called to begin with! Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel