aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorDmitry Kasatkin <d.kasatkin@samsung.com>2013-08-27 10:47:34 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-08-28 13:55:28 -0400
commit8ef2d6511f7eba89ef5fe41cc83008ae63368aa2 (patch)
treef82a5cab6baca6a2970cb46e934ccfad23070602 /include/linux/device.h
parent752e69555d107853043cb9405250c9387b26e708 (diff)
dev-core: fix build break when DEBUG is enabled
When DEBUG is defined, dev_dbg_ratelimited uses dynamic debug data structures even when CONFIG_DYNAMIC_DEBUG is not defined. It leads to build break. For example, when I try to use dev_dbg_ratelimited in USB code and CONFIG_USB_DEBUG is enabled, but CONFIG_DYNAMIC_DEBUG is not, I get: CC [M] drivers/usb/host/xhci-ring.o drivers/usb/host/xhci-ring.c: In function ‘xhci_queue_intr_tx’: drivers/usb/host/xhci-ring.c:3059:3: error: implicit declaration of function ‘DEFINE_DYNAMIC_DEBUG_METADATA’ [-Werror=implicit-function-declaration] drivers/usb/host/xhci-ring.c:3059:3: error: ‘descriptor’ undeclared (first use in this function) drivers/usb/host/xhci-ring.c:3059:3: note: each undeclared identifier is reported only once for each function it appears in drivers/usb/host/xhci-ring.c:3059:3: error: implicit declaration of function ‘__dynamic_pr_debug’ [-Werror=implicit-function-declaration] drivers/usb/host/xhci-ring.c: In function ‘xhci_queue_isoc_tx_prepare’: drivers/usb/host/xhci-ring.c:3847:3: error: ‘descriptor’ undeclared (first use in this function) cc1: some warnings being treated as errors make[2]: *** [drivers/usb/host/xhci-ring.o] Error 1 make[1]: *** [drivers/usb/host] Error 2 make: *** [drivers/usb/] Error 2 This patch separates definition for CONFIG_DYNAMIC_DEBUG and DEBUG cases. [Note, Sarah moved the comment above the macro to avoid checkpatch warnings.] Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 22b546a58591..7d960d581e9c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1099,7 +1099,8 @@ do { \
1099 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1099 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
1100#define dev_info_ratelimited(dev, fmt, ...) \ 1100#define dev_info_ratelimited(dev, fmt, ...) \
1101 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1101 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1102#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) 1102#if defined(CONFIG_DYNAMIC_DEBUG)
1103/* descriptor check is first to prevent flooding with "callbacks suppressed" */
1103#define dev_dbg_ratelimited(dev, fmt, ...) \ 1104#define dev_dbg_ratelimited(dev, fmt, ...) \
1104do { \ 1105do { \
1105 static DEFINE_RATELIMIT_STATE(_rs, \ 1106 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -1108,8 +1109,17 @@ do { \
1108 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1109 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1109 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1110 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1110 __ratelimit(&_rs)) \ 1111 __ratelimit(&_rs)) \
1111 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 1112 __dynamic_dev_dbg(&descriptor, dev, fmt, \
1112 ##__VA_ARGS__); \ 1113 ##__VA_ARGS__); \
1114} while (0)
1115#elif defined(DEBUG)
1116#define dev_dbg_ratelimited(dev, fmt, ...) \
1117do { \
1118 static DEFINE_RATELIMIT_STATE(_rs, \
1119 DEFAULT_RATELIMIT_INTERVAL, \
1120 DEFAULT_RATELIMIT_BURST); \
1121 if (__ratelimit(&_rs)) \
1122 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1113} while (0) 1123} while (0)
1114#else 1124#else
1115#define dev_dbg_ratelimited(dev, fmt, ...) \ 1125#define dev_dbg_ratelimited(dev, fmt, ...) \