]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/spl-device.h
Sigh more compat fixes, this is almost right for 2.6.9 - 2.6.26 kernels.
[FreeBSD/FreeBSD.git] / include / spl-device.h
1 #ifndef _SPL_DEVICE_H
2 #define _SPL_DEVICE_H
3
4 #include <linux/device.h>
5
6 /*
7  * Preferred API from 2.6.18 to 2.6.26+
8  */
9 #ifdef HAVE_DEVICE_CREATE
10
11 typedef struct class                    spl_class;
12 typedef struct device                   spl_device;
13
14 #define spl_class_create(mod, name)     class_create(mod, name)
15 #define spl_class_destroy(cls)          class_destroy(cls)
16 #define spl_device_create(cls, parent, devt, device, fmt, args...)            \
17         device_create(cls, parent, devt, fmt, ## args)
18 #define spl_device_destroy(cls, cls_dev, devt)                                \
19         device_destroy(cls, devt)
20
21 /*
22  * Preferred API from 2.6.13 to 2.6.17
23  * Depricated in 2.6.18
24  * Removed in 2.6.26
25  */
26 #else
27 #ifdef HAVE_CLASS_DEVICE_CREATE
28
29 typedef struct class                    spl_class;
30 typedef struct class_device             spl_device;
31
32 #define spl_class_create(mod, name)     class_create(mod, name)
33 #define spl_class_destroy(cls)          class_destroy(cls)
34 #define spl_device_create(cls, parent, devt, device, fmt, args...)            \
35         class_device_create(cls, devt, device, fmt, ## args)
36 #define spl_device_destroy(cls, cls_dev, devt)                                \
37         class_device_unregister(cls_dev)
38
39 /*
40  * Prefered API from 2.6.0 to 2.6.12
41  * Depricated in 2.6.13
42  * Removed in 2.6.13
43  */
44 #else /* Legacy API */
45
46 typedef struct class_simple             spl_class;
47 typedef struct class_device             spl_class_device;
48
49 #define spl_class_create(mod, name)     class_simple_create(mod, name)
50 #define spl_class_destroy(cls)          class_simple_destroy(cls)
51 #define spl_device_create(cls, parent, devt, device, fmt, args...)            \
52         class_simple_device_add(cls, devt, device, fmt, ## args)
53 #define spl_device_destroy(cls, cls_dev, devt)                                \
54         class_simple_device_remove(devt)
55
56 #endif
57 #endif
58
59 #endif /* _SPL_DEVICE_H */