Hi,

I tried compiling nouveau/linux-2.6 and Dave Airlie's git tree on kernel 
2.6.32-rc5 and received on both the same error.

This patch fixes the error and let the code also compatible to kernels < 
2.6.32.

I "robbed" some code from http://lwn.net/Articles/353496/ and added only 
IF-loops...

I tried compiling on kernels 2.6.32-rc5 and 2.6.31.3 - both works fine...

But I do not know whether it is wished that code which will be merged into 
mainline kernel (someday) contains code that is only needed for older 
kernel versions.

Johannes



--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -15,6 +15,7 @@
 #include <linux/device.h>
 #include <linux/kdev_t.h>
 #include <linux/err.h>
+#include <linux/version.h>
 
 #include "drm_sysfs.h"
 #include "drm_core.h"
@@ -77,7 +78,11 @@
 		       CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
 }
 
-static char *drm_nodename(struct device *dev)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
+  static char *drm_nodename(struct device *dev)
+#else
+  static char *drm_devnode(struct device *dev, mode_t *mode)
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
 {
 	return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
 }
@@ -113,8 +118,12 @@
 	if (err)
 		goto err_out_class;
 
-	class->nodename = drm_nodename;
-
+	#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
+	  class->nodename = drm_nodename;
+	#else
+	  class->devnode = drm_devnode;
+	#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
+	
 	return class;
 
 err_out_class:
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to