diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index a53a822c4d16..e86a580b72e1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -190,6 +190,18 @@ struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) | |||
190 | extern int class_create_file(struct class *, const struct class_attribute *); | 190 | extern int class_create_file(struct class *, const struct class_attribute *); |
191 | extern void class_remove_file(struct class *, const struct class_attribute *); | 191 | extern void class_remove_file(struct class *, const struct class_attribute *); |
192 | 192 | ||
193 | struct class_device_attribute { | ||
194 | struct attribute attr; | ||
195 | ssize_t (*show)(struct class_device *, char * buf); | ||
196 | ssize_t (*store)(struct class_device *, const char * buf, size_t count); | ||
197 | }; | ||
198 | |||
199 | #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ | ||
200 | struct class_device_attribute class_device_attr_##_name = \ | ||
201 | __ATTR(_name,_mode,_show,_store) | ||
202 | |||
203 | extern int class_device_create_file(struct class_device *, | ||
204 | const struct class_device_attribute *); | ||
193 | 205 | ||
194 | struct class_device { | 206 | struct class_device { |
195 | struct list_head node; | 207 | struct list_head node; |
@@ -198,6 +210,7 @@ struct class_device { | |||
198 | struct class * class; /* required */ | 210 | struct class * class; /* required */ |
199 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 211 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
200 | struct class_device_attribute *devt_attr; | 212 | struct class_device_attribute *devt_attr; |
213 | struct class_device_attribute uevent_attr; | ||
201 | struct device * dev; /* not necessary, but nice to have */ | 214 | struct device * dev; /* not necessary, but nice to have */ |
202 | void * class_data; /* class-specific data */ | 215 | void * class_data; /* class-specific data */ |
203 | 216 | ||
@@ -228,18 +241,6 @@ extern int class_device_rename(struct class_device *, char *); | |||
228 | extern struct class_device * class_device_get(struct class_device *); | 241 | extern struct class_device * class_device_get(struct class_device *); |
229 | extern void class_device_put(struct class_device *); | 242 | extern void class_device_put(struct class_device *); |
230 | 243 | ||
231 | struct class_device_attribute { | ||
232 | struct attribute attr; | ||
233 | ssize_t (*show)(struct class_device *, char * buf); | ||
234 | ssize_t (*store)(struct class_device *, const char * buf, size_t count); | ||
235 | }; | ||
236 | |||
237 | #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ | ||
238 | struct class_device_attribute class_device_attr_##_name = \ | ||
239 | __ATTR(_name,_mode,_show,_store) | ||
240 | |||
241 | extern int class_device_create_file(struct class_device *, | ||
242 | const struct class_device_attribute *); | ||
243 | extern void class_device_remove_file(struct class_device *, | 244 | extern void class_device_remove_file(struct class_device *, |
244 | const struct class_device_attribute *); | 245 | const struct class_device_attribute *); |
245 | extern int class_device_create_bin_file(struct class_device *, | 246 | extern int class_device_create_bin_file(struct class_device *, |
@@ -266,6 +267,20 @@ extern struct class_device *class_device_create(struct class *cls, dev_t devt, | |||
266 | extern void class_device_destroy(struct class *cls, dev_t devt); | 267 | extern void class_device_destroy(struct class *cls, dev_t devt); |
267 | 268 | ||
268 | 269 | ||
270 | /* interface for exporting device attributes */ | ||
271 | struct device_attribute { | ||
272 | struct attribute attr; | ||
273 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, | ||
274 | char *buf); | ||
275 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
276 | const char *buf, size_t count); | ||
277 | }; | ||
278 | |||
279 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | ||
280 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
281 | |||
282 | extern int device_create_file(struct device *device, struct device_attribute * entry); | ||
283 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | ||
269 | struct device { | 284 | struct device { |
270 | struct klist klist_children; | 285 | struct klist klist_children; |
271 | struct klist_node knode_parent; /* node in sibling list */ | 286 | struct klist_node knode_parent; /* node in sibling list */ |
@@ -275,6 +290,7 @@ struct device { | |||
275 | 290 | ||
276 | struct kobject kobj; | 291 | struct kobject kobj; |
277 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 292 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
293 | struct device_attribute uevent_attr; | ||
278 | 294 | ||
279 | struct semaphore sem; /* semaphore to synchronize calls to | 295 | struct semaphore sem; /* semaphore to synchronize calls to |
280 | * its driver. | 296 | * its driver. |
@@ -343,23 +359,6 @@ extern int device_attach(struct device * dev); | |||
343 | extern void driver_attach(struct device_driver * drv); | 359 | extern void driver_attach(struct device_driver * drv); |
344 | 360 | ||
345 | 361 | ||
346 | /* driverfs interface for exporting device attributes */ | ||
347 | |||
348 | struct device_attribute { | ||
349 | struct attribute attr; | ||
350 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, | ||
351 | char *buf); | ||
352 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
353 | const char *buf, size_t count); | ||
354 | }; | ||
355 | |||
356 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | ||
357 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
358 | |||
359 | |||
360 | extern int device_create_file(struct device *device, struct device_attribute * entry); | ||
361 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | ||
362 | |||
363 | /* | 362 | /* |
364 | * Platform "fixup" functions - allow the platform to have their say | 363 | * Platform "fixup" functions - allow the platform to have their say |
365 | * about devices and actions that the general device layer doesn't | 364 | * about devices and actions that the general device layer doesn't |