On Mon, Nov 25, 2002, Randy.Dunlap <[EMAIL PROTECTED]> wrote:
> On Mon, 25 Nov 2002, Johannes Erdfelt wrote:
>
> | > 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.
>
> I like it. Will it work, using the same macro name,
> or does a new macro name need to be used?
It'll work.
% cpp << EOF
heredoc> #define usb_submit_urb(urb, flags) usb_submit_urb(urb)
heredoc>
heredoc> usb_submit_urb(urb, GFP_KERNEL)
heredoc> EOF
# 3 ""
usb_submit_urb(urb)
%
It's a feature of cpp :)
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