From c59fef5153642fd169165df16a1ca07d4cfde817 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sun, 15 Jan 2006 20:34:09 +0000 Subject: [PATCH] Added CLASS_DEVICE_CREATE compaitibility macro, based on patch from abbotti@mev.co.uk (Ian Abbott). --- include/linux/device.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/include/linux/device.h b/include/linux/device.h index 47da6ddd..c908b603 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -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 #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_ -- 2.26.2