Added CLASS_DEVICE_CREATE compaitibility macro, based on patch from
authorFrank Mori Hess <fmhess@speakeasy.net>
Sun, 15 Jan 2006 20:34:09 +0000 (20:34 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sun, 15 Jan 2006 20:34:09 +0000 (20:34 +0000)
abbotti@mev.co.uk (Ian Abbott).

include/linux/device.h

index 47da6ddd46de10e324f94b6ab1513aef7239e97e..c908b60390ef006e6d32b77b14f1642b6833c708 100644 (file)
@@ -27,31 +27,49 @@ static inline struct class *class_create(struct module *owner, char *name)
 static inline void class_destroy(struct class *cs)
 {};
 
-static inline struct class_device *class_device_create(struct class *cs, 
-       dev_t dev, struct device *device, const char *fmt, ...)
+static inline struct class_device *CLASS_DEVICE_CREATE(struct class *cls,
+       struct class_device *parent, dev_t devt, struct device *device,
+       char *fmt, ...)
 {
        return NULL;
 };
-
 static inline void class_device_destroy(struct class *cs, dev_t dev)
 {};
 
 #else
+
 #include_next <linux/device.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
+
 #define class_create(owner, name) \
        (struct class *)class_simple_create(owner, name)
 #define class_destroy(cs) \
        class_simple_destroy((struct class_simple *)(cs))
-#define class_device_create(cs, dev, device, fmt...) \
+#define CLASS_DEVICE_CREATE(cs, parent, dev, device, fmt...) \
        class_simple_device_add((struct class_simple *)(cs), \
                dev, device, fmt)
 #define class_device_destroy(cs, dev) \
        class_simple_device_remove(dev)
-#endif
 
-#endif
+#else
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
+
+#define CLASS_DEVICE_CREATE(cs, parent, dev, device, fmt...) \
+       class_device_create(cs, dev, device, fmt)
+
+#else
+
+#define CLASS_DEVICE_CREATE(cs, parent, dev, device, fmt...) \
+       class_device_create(cs, parent, dev, device, fmt)
+
+#endif // LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
+
+#endif // LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
+
+#endif // LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 
 #endif // __COMPAT_LINUX_DEVICE_H_