]>
Commit | Line | Data |
---|---|---|
46c685d0 | 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; | |
25557fd8 | 12 | typedef struct device spl_device; |
46c685d0 | 13 | |
14 | #define spl_class_create(mod, name) class_create(mod, name) | |
15 | #define spl_class_destroy(cls) class_destroy(cls) | |
8123ac4f BB |
16 | |
17 | # ifdef HAVE_5ARGS_DEVICE_CREATE | |
18 | # define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \ | |
19 | device_create(cls, parent, devt, drvdata, fmt, ## args) | |
20 | # else | |
21 | # define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \ | |
46c685d0 | 22 | device_create(cls, parent, devt, fmt, ## args) |
8123ac4f BB |
23 | # endif |
24 | ||
25557fd8 | 25 | #define spl_device_destroy(cls, cls_dev, devt) \ |
26 | device_destroy(cls, devt) | |
46c685d0 | 27 | |
28 | /* | |
29 | * Preferred API from 2.6.13 to 2.6.17 | |
30 | * Depricated in 2.6.18 | |
31 | * Removed in 2.6.26 | |
32 | */ | |
33 | #else | |
34 | #ifdef HAVE_CLASS_DEVICE_CREATE | |
35 | ||
36 | typedef struct class spl_class; | |
25557fd8 | 37 | typedef struct class_device spl_device; |
46c685d0 | 38 | |
39 | #define spl_class_create(mod, name) class_create(mod, name) | |
40 | #define spl_class_destroy(cls) class_destroy(cls) | |
25557fd8 | 41 | #define spl_device_create(cls, parent, devt, device, fmt, args...) \ |
fe457392 | 42 | class_device_create(cls, parent, devt, device, fmt, ## args) |
25557fd8 | 43 | #define spl_device_destroy(cls, cls_dev, devt) \ |
44 | class_device_unregister(cls_dev) | |
46c685d0 | 45 | |
46 | /* | |
47 | * Prefered API from 2.6.0 to 2.6.12 | |
48 | * Depricated in 2.6.13 | |
49 | * Removed in 2.6.13 | |
50 | */ | |
51 | #else /* Legacy API */ | |
52 | ||
53 | typedef struct class_simple spl_class; | |
25557fd8 | 54 | typedef struct class_device spl_class_device; |
46c685d0 | 55 | |
56 | #define spl_class_create(mod, name) class_simple_create(mod, name) | |
57 | #define spl_class_destroy(cls) class_simple_destroy(cls) | |
25557fd8 | 58 | #define spl_device_create(cls, parent, devt, device, fmt, args...) \ |
46c685d0 | 59 | class_simple_device_add(cls, devt, device, fmt, ## args) |
25557fd8 | 60 | #define spl_device_destroy(cls, cls_dev, devt) \ |
61 | class_simple_device_remove(devt) | |
46c685d0 | 62 | |
fe457392 BB |
63 | #endif /* HAVE_CLASS_DEVICE_CREATE */ |
64 | #endif /* HAVE_DEVICE_CREATE */ | |
46c685d0 | 65 | |
66 | #endif /* _SPL_DEVICE_H */ |