diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 5ca1cdba563a..26e4692f2d1a 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -354,6 +354,41 @@ extern int __must_check device_create_bin_file(struct device *dev, | |||
354 | struct bin_attribute *attr); | 354 | struct bin_attribute *attr); |
355 | extern void device_remove_bin_file(struct device *dev, | 355 | extern void device_remove_bin_file(struct device *dev, |
356 | 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 | |||
357 | struct device { | 392 | struct device { |
358 | struct klist klist_children; | 393 | struct klist klist_children; |
359 | struct klist_node knode_parent; /* node in sibling list */ | 394 | struct klist_node knode_parent; /* node in sibling list */ |
@@ -397,6 +432,9 @@ struct device { | |||
397 | /* arch specific additions */ | 432 | /* arch specific additions */ |
398 | struct dev_archdata archdata; | 433 | struct dev_archdata archdata; |
399 | 434 | ||
435 | spinlock_t devres_lock; | ||
436 | struct list_head devres_head; | ||
437 | |||
400 | /* class_device migration path */ | 438 | /* class_device migration path */ |
401 | struct list_head node; | 439 | struct list_head node; |
402 | struct class *class; | 440 | struct class *class; |