diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index f44247fe8135..26e4692f2d1a 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -126,6 +126,7 @@ struct device_driver { | |||
126 | struct klist_node knode_bus; | 126 | struct klist_node knode_bus; |
127 | 127 | ||
128 | struct module * owner; | 128 | struct module * owner; |
129 | const char * mod_name; /* used for built-in modules */ | ||
129 | 130 | ||
130 | int (*probe) (struct device * dev); | 131 | int (*probe) (struct device * dev); |
131 | int (*remove) (struct device * dev); | 132 | int (*remove) (struct device * dev); |
@@ -327,6 +328,13 @@ extern struct class_device *class_device_create(struct class *cls, | |||
327 | __attribute__((format(printf,5,6))); | 328 | __attribute__((format(printf,5,6))); |
328 | extern void class_device_destroy(struct class *cls, dev_t devt); | 329 | extern void class_device_destroy(struct class *cls, dev_t devt); |
329 | 330 | ||
331 | struct device_type { | ||
332 | struct device_attribute *attrs; | ||
333 | int (*uevent)(struct device *dev, char **envp, int num_envp, | ||
334 | char *buffer, int buffer_size); | ||
335 | void (*release)(struct device *dev); | ||
336 | }; | ||
337 | |||
330 | /* interface for exporting device attributes */ | 338 | /* interface for exporting device attributes */ |
331 | struct device_attribute { | 339 | struct device_attribute { |
332 | struct attribute attr; | 340 | struct attribute attr; |
@@ -346,6 +354,41 @@ extern int __must_check device_create_bin_file(struct device *dev, | |||
346 | struct bin_attribute *attr); | 354 | struct bin_attribute *attr); |
347 | extern void device_remove_bin_file(struct device *dev, | 355 | extern void device_remove_bin_file(struct device *dev, |
348 | struct bin_attribute *attr); | 356 | struct bin_attribute *attr); |
357 | |||
358 | /* device resource management */ | ||
359 | typedef void (*dr_release_t)(struct device *dev, void *res); | ||
360 | typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); | ||
361 | |||
362 | #ifdef CONFIG_DEBUG_DEVRES | ||
363 | extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, | ||
364 | const char *name); | ||
365 | #define devres_alloc(release, size, gfp) \ | ||
366 | __devres_alloc(release, size, gfp, #release) | ||
367 | #else | ||
368 | extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp); | ||
369 | #endif | ||
370 | extern void devres_free(void *res); | ||
371 | extern void devres_add(struct device *dev, void *res); | ||
372 | extern void * devres_find(struct device *dev, dr_release_t release, | ||
373 | dr_match_t match, void *match_data); | ||
374 | extern void * devres_get(struct device *dev, void *new_res, | ||
375 | dr_match_t match, void *match_data); | ||
376 | extern void * devres_remove(struct device *dev, dr_release_t release, | ||
377 | dr_match_t match, void *match_data); | ||
378 | extern int devres_destroy(struct device *dev, dr_release_t release, | ||
379 | dr_match_t match, void *match_data); | ||
380 | |||
381 | /* devres group */ | ||
382 | extern void * __must_check devres_open_group(struct device *dev, void *id, | ||
383 | gfp_t gfp); | ||
384 | extern void devres_close_group(struct device *dev, void *id); | ||
385 | extern void devres_remove_group(struct device *dev, void *id); | ||
386 | extern int devres_release_group(struct device *dev, void *id); | ||
387 | |||
388 | /* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */ | ||
389 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); | ||
390 | extern void devm_kfree(struct device *dev, void *p); | ||
391 | |||
349 | struct device { | 392 | struct device { |
350 | struct klist klist_children; | 393 | struct klist klist_children; |
351 | struct klist_node knode_parent; /* node in sibling list */ | 394 | struct klist_node knode_parent; /* node in sibling list */ |
@@ -355,6 +398,7 @@ struct device { | |||
355 | 398 | ||
356 | struct kobject kobj; | 399 | struct kobject kobj; |
357 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 400 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
401 | struct device_type *type; | ||
358 | unsigned is_registered:1; | 402 | unsigned is_registered:1; |
359 | struct device_attribute uevent_attr; | 403 | struct device_attribute uevent_attr; |
360 | struct device_attribute *devt_attr; | 404 | struct device_attribute *devt_attr; |
@@ -388,11 +432,15 @@ struct device { | |||
388 | /* arch specific additions */ | 432 | /* arch specific additions */ |
389 | struct dev_archdata archdata; | 433 | struct dev_archdata archdata; |
390 | 434 | ||
435 | spinlock_t devres_lock; | ||
436 | struct list_head devres_head; | ||
437 | |||
391 | /* class_device migration path */ | 438 | /* class_device migration path */ |
392 | struct list_head node; | 439 | struct list_head node; |
393 | struct class *class; /* optional*/ | 440 | struct class *class; |
394 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 441 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
395 | struct attribute_group **groups; /* optional groups */ | 442 | struct attribute_group **groups; /* optional groups */ |
443 | int uevent_suppress; | ||
396 | 444 | ||
397 | void (*release)(struct device * dev); | 445 | void (*release)(struct device * dev); |
398 | }; | 446 | }; |