aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 5ad17cccdd71..161d96241b1b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <linux/ratelimit.h>
26#include <asm/device.h> 27#include <asm/device.h>
27 28
28struct device; 29struct device;
@@ -502,7 +503,10 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 503 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
503#define DEVICE_INT_ATTR(_name, _mode, _var) \ 504#define DEVICE_INT_ATTR(_name, _mode, _var) \
504 struct dev_ext_attribute dev_attr_##_name = \ 505 struct dev_ext_attribute dev_attr_##_name = \
505 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 506 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
507#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
508 struct device_attribute dev_attr_##_name = \
509 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
506 510
507extern int device_create_file(struct device *device, 511extern int device_create_file(struct device *device,
508 const struct device_attribute *entry); 512 const struct device_attribute *entry);
@@ -541,6 +545,8 @@ extern void *devres_remove(struct device *dev, dr_release_t release,
541 dr_match_t match, void *match_data); 545 dr_match_t match, void *match_data);
542extern int devres_destroy(struct device *dev, dr_release_t release, 546extern int devres_destroy(struct device *dev, dr_release_t release,
543 dr_match_t match, void *match_data); 547 dr_match_t match, void *match_data);
548extern int devres_release(struct device *dev, dr_release_t release,
549 dr_match_t match, void *match_data);
544 550
545/* devres group */ 551/* devres group */
546extern void * __must_check devres_open_group(struct device *dev, void *id, 552extern void * __must_check devres_open_group(struct device *dev, void *id,
@@ -661,6 +667,10 @@ struct device {
661 667
662 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 668 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
663 override */ 669 override */
670#ifdef CONFIG_CMA
671 struct cma *cma_area; /* contiguous memory area for dma
672 allocations */
673#endif
664 /* arch specific additions */ 674 /* arch specific additions */
665 struct dev_archdata archdata; 675 struct dev_archdata archdata;
666 676
@@ -931,6 +941,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
931 941
932#endif 942#endif
933 943
944#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
945do { \
946 static DEFINE_RATELIMIT_STATE(_rs, \
947 DEFAULT_RATELIMIT_INTERVAL, \
948 DEFAULT_RATELIMIT_BURST); \
949 if (__ratelimit(&_rs)) \
950 dev_level(dev, fmt, ##__VA_ARGS__); \
951} while (0)
952
953#define dev_emerg_ratelimited(dev, fmt, ...) \
954 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
955#define dev_alert_ratelimited(dev, fmt, ...) \
956 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
957#define dev_crit_ratelimited(dev, fmt, ...) \
958 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
959#define dev_err_ratelimited(dev, fmt, ...) \
960 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
961#define dev_warn_ratelimited(dev, fmt, ...) \
962 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
963#define dev_notice_ratelimited(dev, fmt, ...) \
964 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
965#define dev_info_ratelimited(dev, fmt, ...) \
966 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
967#define dev_dbg_ratelimited(dev, fmt, ...) \
968 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
969
934/* 970/*
935 * Stupid hackaround for existing uses of non-printk uses dev_info 971 * Stupid hackaround for existing uses of non-printk uses dev_info
936 * 972 *