aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiroshi Doyu <hdoyu@nvidia.com>2012-09-04 00:40:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-10 23:28:11 -0400
commit6f586e663e3b3674cadad0d5329424b006a0a289 (patch)
tree410cdc4d25578e0b4eb33661929276b25453358f
parent44c8b25fb3b4b67442426abdc2371e750f7a393e (diff)
driver-core: Shut up dev_dbg_reatelimited() without DEBUG
dev_dbg_reatelimited() without DEBUG printed "217078 callbacks suppressed". This shouldn't print anything without DEBUG. With CONFIG_DYNAMIC_DEBUG, the print should be configured as expected. Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net> Tested-by: Antti Palosaari <crope@iki.fi> Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net> Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/linux/device.h62
1 files changed, 38 insertions, 24 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index ecd900663726..378a27c1d1af 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -950,6 +950,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
950 950
951#endif 951#endif
952 952
953/*
954 * Stupid hackaround for existing uses of non-printk uses dev_info
955 *
956 * Note that the definition of dev_info below is actually _dev_info
957 * and a macro is used to avoid redefining dev_info
958 */
959
960#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
961
962#if defined(CONFIG_DYNAMIC_DEBUG)
963#define dev_dbg(dev, format, ...) \
964do { \
965 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
966} while (0)
967#elif defined(DEBUG)
968#define dev_dbg(dev, format, arg...) \
969 dev_printk(KERN_DEBUG, dev, format, ##arg)
970#else
971#define dev_dbg(dev, format, arg...) \
972({ \
973 if (0) \
974 dev_printk(KERN_DEBUG, dev, format, ##arg); \
975 0; \
976})
977#endif
978
953#define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 979#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
954do { \ 980do { \
955 static DEFINE_RATELIMIT_STATE(_rs, \ 981 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -973,33 +999,21 @@ do { \
973 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 999 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
974#define dev_info_ratelimited(dev, fmt, ...) \ 1000#define dev_info_ratelimited(dev, fmt, ...) \
975 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1001 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1002#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
976#define dev_dbg_ratelimited(dev, fmt, ...) \ 1003#define dev_dbg_ratelimited(dev, fmt, ...) \
977 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__) 1004do { \
978 1005 static DEFINE_RATELIMIT_STATE(_rs, \
979/* 1006 DEFAULT_RATELIMIT_INTERVAL, \
980 * Stupid hackaround for existing uses of non-printk uses dev_info 1007 DEFAULT_RATELIMIT_BURST); \
981 * 1008 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
982 * Note that the definition of dev_info below is actually _dev_info 1009 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
983 * and a macro is used to avoid redefining dev_info 1010 __ratelimit(&_rs)) \
984 */ 1011 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
985 1012 ##__VA_ARGS__); \
986#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
987
988#if defined(CONFIG_DYNAMIC_DEBUG)
989#define dev_dbg(dev, format, ...) \
990do { \
991 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
992} while (0) 1013} while (0)
993#elif defined(DEBUG)
994#define dev_dbg(dev, format, arg...) \
995 dev_printk(KERN_DEBUG, dev, format, ##arg)
996#else 1014#else
997#define dev_dbg(dev, format, arg...) \ 1015#define dev_dbg_ratelimited(dev, fmt, ...) \
998({ \ 1016 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
999 if (0) \
1000 dev_printk(KERN_DEBUG, dev, format, ##arg); \
1001 0; \
1002})
1003#endif 1017#endif
1004 1018
1005#ifdef VERBOSE_DEBUG 1019#ifdef VERBOSE_DEBUG