Debian Codegraph @

drivers/dahdi/dahdi-sysfs.h

raw
1 #ifndef DAHDI_SYSFS_H
2 #define DAHDI_SYSFS_H
3
4 #define DEVICE_ATTR_READER(name, dev, buf) \
5 ssize_t name(struct device *dev, \
6 struct device_attribute *attr, \
7 char *buf)
8 #define DEVICE_ATTR_WRITER(name, dev, buf, count) \
9 ssize_t name(struct device *dev, \
10 struct device_attribute *attr, \
11 const char *buf, size_t count)
12 #define BUS_ATTR_READER(name, dev, buf) \
13 ssize_t name(struct device *dev, \
14 struct device_attribute *attr, \
15 char *buf)
16 #define BUS_ATTR_WRITER(name, dev, buf, count) \
17 ssize_t name(struct device *dev, \
18 struct device_attribute *attr, \
19 const char *buf, size_t count)
20
21 #define DRIVER_ATTR_READER(name, drv, buf) \
22 ssize_t name(struct device_driver *drv, char * buf)
23
24 /* Device file creation macros */
25
26 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
27 #define CLASS_DEV_CREATE(class, devt, device, name) \
28 device_create(class, device, devt, NULL, "%s", name)
29 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
30 #define CLASS_DEV_CREATE(class, devt, device, name) \
31 device_create(class, device, devt, name)
32 #else
33 #define CLASS_DEV_CREATE(class, devt, device, name) \
34 class_device_create(class, NULL, devt, device, name)
35 #endif
36
37 /* Device file destruction macros */
38
39 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
40 #define CLASS_DEV_DESTROY(class, devt) \
41 device_destroy(class, devt)
42 #else
43 #define CLASS_DEV_DESTROY(class, devt) \
44 class_device_destroy(class, devt)
45 #endif
46
47 /* Global */
48 int __init dahdi_sysfs_chan_init(const struct file_operations *fops);
49 void dahdi_sysfs_chan_exit(void);
50
51 /* Channel Handling */
52 int chan_sysfs_create(struct dahdi_chan *chan);
53 void chan_sysfs_remove(struct dahdi_chan *chan);
54
55 #endif /* DAHDI_SYSFS_H */