RFC: [PATCH 2/3] usb: cdc_ncm: patch for multi kernel versions
This patch allows to have a single source for many kernel versions. As the NCM driver at jambit runs on a wide range of embedded linux (from 2.6.35 to 3.4.x) we devised this convenient patch.
This patch applies to longterm kernel version 3.4.35.
Signed-off-by Loic Domaigne <[email protected]>
drivers/net/usb/cdc_ncm.c renamed from drivers/net/usb/cdc_ncm.c.patch1 +23 -1
@@ -38,6 +38,7 @@* SUCH DAMAGE. */ +#include <linux/version.h> /* LINUX_VERSION_CODE and KERNEL_VERSION macro */ #include <linux/module.h> #include <linux/init.h> #include <linux/netdevice.h>
@@ -48,7 +49,6 @@#include <linux/crc32.h> #include <linux/usb.h> #include <linux/hrtimer.h> -#include <linux/atomic.h> #include <linux/usb/usbnet.h> #include <linux/usb/cdc.h>
@@ -1244,8 +1244,30 @@ static const struct ethtool_ops cdc_ncm_ .nway_reset = usbnet_nway_reset, }; +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,3 ,0 )) +module_usb_driver (cdc_ncm_driver); +#else + +static int __init cdc_ncm_init (void ) +{ +pr_info (KBUILD_MODNAME ": " DRIVER_VERSION "\n" ); +pr_info (KBUILD_MODNAME ": MirrorLink booster by Jambit\n" ); +return usb_register (&cdc_ncm_driver); +} + +module_init (cdc_ncm_init); + +static void __exit cdc_ncm_exit(void) +{ +usb_deregister (&cdc_ncm_driver); +} + +module_exit (cdc_ncm_exit); + +#endif +MODULE_AUTHOR ("Hans Petter Selasky" );MODULE_DESCRIPTION ("USB CDC NCM host driver" );MODULE_LICENSE ("Dual BSD/GPL" );
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html