On Mon, Nov 25, 2002, Randy.Dunlap <[EMAIL PROTECTED]> wrote:
> On Mon, 25 Nov 2002, Josh Myer wrote:
> 
> | This is probably a stupid question. Any hints on how to elegantly deal
> | with 2.4 vs 2.5 usb_submit_urb arguments? For the moment (hack hack hack)
> | i've got[1]:
> |
> | #ifdef EV_SYN
> |   if(usb_submit_urb(kbtab->irq, GFP_KERNEL))
> |     return -EIO;
> | #else
> |   if(usb_submit_urb(kbtab->irq))
> |     return -EIO;
> | #endif
> |
> | But i'm guessing there's some official way to tell between the two? Or
> | should i just give up hope and do two .c's, one for 2.4 and the other for
> | 2.5?
> 
> Official way, huh?  Guess we'll see if any officials reply.
> 
> Option 1.  separate source files, as you mentioned, although
> for this one instance I don't think that's needed or worth it.
> 
> Option 2.  another obvious solution/workaround:
> use local u_submit_urb() function with the KERNEL_VERSION() macro
> 
> #include <linux/version.h>
> 
> #ifdef LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
> static inline int u_submit_urb(struct urb *urb, int gfp_type) {
>       return usb_submit_urb(urb);
> }
> #else
> static inline int u_submit_urb(struct urb *urb, int gfp_type) {
>       return usb_submit_urb(urb, gfp_type);
> }
> #endif
> 
> and use u_submit_urb() throughout the driver.
> However, a solution that retains usage of usb_submit_urb()
> throughout the driver would be more palatable.
> 
> Not compiled, not tested...

Why not just create a macro?

#ifdef LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define usb_submit_urb(urb, flags) usb_submit_urb(urb)
#endif

Of course, the usual macro gotchas are implied.

JE



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to