mtd/drivers/mtd mtdchar.c,1.76,1.77

Artem Bityutskiy dedekind at infradead.org
Wed Dec 14 11:41:57 EST 2005


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv13033

Modified Files:
	mtdchar.c 
Log Message:
[MTD] Hotfix for 2.6.13/2.6.14 kernels

mtd_class_device_create() changed its prototype in 2.6.15 kernel series.
It is not obvious how to handle this gracefully in compatmac.h, so this
patch teporary introduces #ifdef-s to fix the problem.


Index: mtdchar.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdchar.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- mtdchar.c	7 Nov 2005 11:14:20 -0000	1.76
+++ mtdchar.c	14 Dec 2005 16:41:54 -0000	1.77
@@ -26,12 +26,25 @@
 	if (!mtd)
 		return;
 
-	class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && \
+    LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+	/* 
+	 * In 2.6.13 and 2.6.14 kernels class_device_create() had different prototype.
+	 * No idea how to fix it in compatmac.h, so this is a hotfix. Must go sometime.
+	 */
+	mtd_class_device_create(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
 			    NULL, "mtd%d", mtd->index);
 
-	class_device_create(mtd_class, NULL,
+	mtd_class_device_create(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
+			    NULL, "mtd%dro", mtd->index);
+#else
+	mtd_class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
+			    NULL, "mtd%d", mtd->index);
+
+	mtd_class_device_create(mtd_class, NULL,
 			    MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
 			    NULL, "mtd%dro", mtd->index);
+#endif
 }
 
 static void mtd_notify_remove(struct mtd_info* mtd)





More information about the linux-mtd-cvs mailing list