RFC: [PATCH 2/3] usb: cdc_ncm: patch for multi kernel versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <loic.domaigne@xxxxxxxxxx>

--- linux-3.4.35/drivers/net/usb/cdc_ncm.c.patch1	2013-03-05 10:22:14.361091251 +0100
+++ linux-3.4.35/drivers/net/usb/cdc_ncm.c	2013-03-05 10:33:33.169861281 +0100
@@ -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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux