1 /****************************************************************************
2 ****************************************************************************
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
10 ****************************************************************************
11 ****************************************************************************/
15 #include <linux/ioport.h>
16 #include <linux/kobject.h>
17 #include <linux/klist.h>
18 #include <linux/list.h>
19 #include <linux/types.h>
20 #include <linux/module.h>
22 #include <asm/semaphore.h>
23 #include <asm/atomic.h>
25 #define DEVICE_NAME_SIZE 50
26 #define DEVICE_NAME_HALF __stringify(20)
27 #define DEVICE_ID_SIZE 32
28 #define BUS_ID_SIZE KOBJ_NAME_LEN
38 struct subsystem subsys;
41 struct klist klist_devices;
42 struct klist klist_drivers;
44 struct bus_attribute * bus_attrs;
45 struct device_attribute * dev_attrs;
46 struct driver_attribute * drv_attrs;
48 int (*match)(struct device * dev, struct device_driver * drv);
49 int (*uevent)(struct device *dev, char **envp,
50 int num_envp, char *buffer, int buffer_size);
51 int (*probe)(struct device * dev);
52 int (*remove)(struct device * dev);
53 void (*shutdown)(struct device * dev);
54 int (*suspend)(struct device * dev, pm_message_t state);
55 int (*resume)(struct device * dev);
58 struct device * bus_find_device(struct bus_type *bus, struct device *start,
59 void *data, int (*match)(struct device *, void *));
61 struct bus_attribute {
62 struct attribute attr;
63 ssize_t (*show)(struct bus_type *, char * buf);
64 ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
67 #define BUS_ATTR(_name,_mode,_show,_store) struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
69 struct device_driver {
71 struct bus_type * bus;
73 struct completion unloaded;
75 struct klist klist_devices;
76 struct klist_node knode_bus;
78 struct module * owner;
80 int (*probe) (struct device * dev);
81 int (*remove) (struct device * dev);
82 void (*shutdown) (struct device * dev);
83 int (*suspend) (struct device * dev, pm_message_t state);
84 int (*resume) (struct device * dev);
87 struct driver_attribute {
88 struct attribute attr;
89 ssize_t (*show)(struct device_driver *, char * buf);
90 ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
93 #define DRIVER_ATTR(_name,_mode,_show,_store) struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
95 struct device * driver_find_device(struct device_driver *drv,
96 struct device *start, void *data,
97 int (*match)(struct device *, void *));
101 struct module * owner;
103 struct subsystem subsys;
104 struct list_head children;
105 struct list_head devices;
106 struct list_head interfaces;
107 struct semaphore sem;
109 struct class_attribute * class_attrs;
110 struct class_device_attribute * class_dev_attrs;
112 int (*uevent)(struct class_device *dev, char **envp,
113 int num_envp, char *buffer, int buffer_size);
115 void (*release)(struct class_device *dev);
116 void (*class_release)(struct class *class);
119 struct class_attribute {
120 struct attribute attr;
121 ssize_t (*show)(struct class *, char * buf);
122 ssize_t (*store)(struct class *, const char * buf, size_t count);
125 #define CLASS_ATTR(_name,_mode,_show,_store) struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
127 struct class_device_attribute {
128 struct attribute attr;
129 ssize_t (*show)(struct class_device *, char * buf);
130 ssize_t (*store)(struct class_device *, const char * buf, size_t count);
133 #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) struct class_device_attribute class_device_attr_##_name = __ATTR(_name,_mode,_show,_store)
135 struct class_device {
136 struct list_head node;
139 struct class * class;
141 struct class_device_attribute *devt_attr;
142 struct class_device_attribute uevent_attr;
145 struct class_device *parent;
146 struct attribute_group ** groups;
148 void (*release)(struct class_device *dev);
149 int (*uevent)(struct class_device *dev, char **envp,
150 int num_envp, char *buffer, int buffer_size);
151 char class_id[BUS_ID_SIZE];
154 struct class_interface {
155 struct list_head node;
158 int (*add) (struct class_device *, struct class_interface *);
159 void (*remove) (struct class_device *, struct class_interface *);
162 struct device_attribute {
163 struct attribute attr;
164 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
166 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
167 const char *buf, size_t count);
170 #define DEVICE_ATTR(_name,_mode,_show,_store) struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
173 struct klist klist_children;
174 struct klist_node knode_parent;
175 struct klist_node knode_driver;
176 struct klist_node knode_bus;
177 struct device * parent;
180 char bus_id[BUS_ID_SIZE];
181 struct device_attribute uevent_attr;
182 struct device_attribute *devt_attr;
184 struct semaphore sem;
186 struct bus_type * bus;
187 struct device_driver *driver;
191 struct dev_pm_info power;
194 u64 coherent_dma_mask;
196 struct list_head dma_pools;
198 struct dma_coherent_mem *dma_mem;
200 struct list_head node;
204 void (*release)(struct device * dev);
207 #define dev_printk(level, dev, format, arg...) printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
210 #define dev_dbg(dev, format, arg...) dev_printk(KERN_DEBUG , dev , format , ## arg)
212 #define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0)
215 #define dev_err(dev, format, arg...) dev_printk(KERN_ERR , dev , format , ## arg)
216 #define dev_info(dev, format, arg...) dev_printk(KERN_INFO , dev , format , ## arg)
217 #define dev_warn(dev, format, arg...) dev_printk(KERN_WARNING , dev , format , ## arg)
218 #define dev_notice(dev, format, arg...) dev_printk(KERN_NOTICE , dev , format , ## arg)
220 #define MODULE_ALIAS_CHARDEV(major,minor) MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
221 #define MODULE_ALIAS_CHARDEV_MAJOR(major) MODULE_ALIAS("char-major-" __stringify(major) "-*")