OSDN Git Service

drm: Fix compilation on 2.6.30
authorMichael Buesch <mb@bu3sch.de>
Sun, 10 May 2009 22:21:14 +0000 (00:21 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 28 May 2009 07:26:37 +0000 (17:26 +1000)
This fixes DRM compilation of nouveau.ko on kernel 2.6.30.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
linux-core/drm_os_linux.h
linux-core/drm_sysfs.c

index f58296b..be5e099 100644 (file)
 /** IRQ handler arguments and return type and values */
 #define DRM_IRQ_ARGS           int irq, void *arg
 /** backwards compatibility with old irq return values */
-#ifndef IRQ_HANDLED
+#if !defined(IRQ_HANDLED) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,29)
 typedef void irqreturn_t;
 #define IRQ_HANDLED            /* nothing */
 #define IRQ_NONE               /* nothing */
 #endif
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
+static inline const char *dev_name(const struct device *dev)
+{
+       return dev->bus_id;
+}
+static inline int dev_set_name(struct device *dev, const char *name, ...)
+{
+       va_list vargs;
+
+       va_start(vargs, name);
+       vsnprintf(dev->bus_id, sizeof(dev->bus_id), name, vargs);
+       va_end(vargs);
+
+       return 0;
+}
+#endif
+
 /** AGP types */
 #if __OS_HAS_AGP
 #define DRM_AGP_MEM            struct agp_memory
index 6de9367..e9e7a31 100644 (file)
@@ -168,8 +168,12 @@ int drm_sysfs_device_add(struct drm_minor *minor)
        minor->kdev.release = drm_sysfs_device_release;
        minor->kdev.devt = minor->device;
        minor_str = "card%d";
-       
-       snprintf(minor->kdev.bus_id, BUS_ID_SIZE, minor_str, minor->index);
+
+       err = dev_set_name(&minor->kdev, minor_str, minor->index);
+       if (err) {
+               DRM_ERROR("device set name failed: %d\n", err);
+               goto err_out;
+       }
 
        err = device_register(&minor->kdev);
        if (err) {