From 5289c76e6c7bd1125173caf86a4fa39e83891dc5 Mon Sep 17 00:00:00 2001
From: Saleem Abdulrasool <compnerd@compnerd.org>
Date: Mon, 4 May 2009 14:49:26 -0700
Subject: [PATCH] fix compiling with linux kernel >= 2.6.30

fix setting of device name
fix irqreturn_t redeclaration
---
 linux-core/drm_os_linux.h |    2 ++
 linux-core/drm_sysfs.c    |   10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h
index f58296b..450b2b3 100644
--- a/linux-core/drm_os_linux.h
+++ b/linux-core/drm_os_linux.h
@@ -31,12 +31,14 @@
 
 /** IRQ handler arguments and return type and values */
 #define DRM_IRQ_ARGS		int irq, void *arg
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
 /** backwards compatibility with old irq return values */
 #ifndef IRQ_HANDLED
 typedef void irqreturn_t;
 #define IRQ_HANDLED		/* nothing */
 #define IRQ_NONE		/* nothing */
 #endif
+#endif
 
 /** AGP types */
 #if __OS_HAS_AGP
diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c
index 6de9367..fcf1daa 100644
--- a/linux-core/drm_sysfs.c
+++ b/linux-core/drm_sysfs.c
@@ -162,14 +162,22 @@ int drm_sysfs_device_add(struct drm_minor *minor)
 	int err;
 	int i, j;
 	char *minor_str;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30))
+	char buffer[BUS_ID_SIZE];
+#endif
 
 	minor->kdev.parent = &minor->dev->pdev->dev;
 	minor->kdev.class = drm_class;
 	minor->kdev.release = drm_sysfs_device_release;
 	minor->kdev.devt = minor->device;
 	minor_str = "card%d";
-	
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30))
+	snprintf(buffer, sizeof(buffer), minor_str, minor->index);
+	dev_set_name(&minor->kdev, buffer);
+#else
 	snprintf(minor->kdev.bus_id, BUS_ID_SIZE, minor_str, minor->index);
+#endif
 
 	err = device_register(&minor->kdev);
 	if (err) {
-- 
1.6.2.4

