All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dev-core: fix build break when DEBUG is enabled
@ 2013-08-15 16:04 Dmitry Kasatkin
  2013-08-15 16:04 ` [PATCH 2/2] xhci:prevent "callbacks suppressed" when debug is not enabled Dmitry Kasatkin
  2013-08-15 16:37 ` [PATCH 1/2] dev-core: fix build break when DEBUG is enabled Greg KH
  0 siblings, 2 replies; 18+ messages in thread
From: Dmitry Kasatkin @ 2013-08-15 16:04 UTC (permalink / raw)
  To: linux-kernel, gregkh, sarah.a.sharp; +Cc: dmitry.kasatkin, stable

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.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Cc: stable@vger.kernel.org
---
 include/linux/device.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 22b546a..d336beb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1099,17 +1099,28 @@ do {									\
 	dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
 #define dev_info_ratelimited(dev, fmt, ...)				\
 	dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
-#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
 #define dev_dbg_ratelimited(dev, fmt, ...)				\
 do {									\
 	static DEFINE_RATELIMIT_STATE(_rs,				\
 				      DEFAULT_RATELIMIT_INTERVAL,	\
 				      DEFAULT_RATELIMIT_BURST);		\
 	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);			\
+	/* descriptor check is first to prevent flooding with		\
+	   "callbacks suppressed" */					\
 	if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&	\
 	    __ratelimit(&_rs))						\
-		__dynamic_pr_debug(&descriptor, pr_fmt(fmt),		\
-				   ##__VA_ARGS__);			\
+		__dynamic_dev_dbg(&descriptor, dev, fmt,		\
+				  ##__VA_ARGS__);			\
+} while (0)
+#elif defined(DEBUG)
+#define dev_dbg_ratelimited(dev, fmt, ...)				\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);	\
 } while (0)
 #else
 #define dev_dbg_ratelimited(dev, fmt, ...)			\
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-08-27 17:40 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 16:04 [PATCH 1/2] dev-core: fix build break when DEBUG is enabled Dmitry Kasatkin
2013-08-15 16:04 ` [PATCH 2/2] xhci:prevent "callbacks suppressed" when debug is not enabled Dmitry Kasatkin
2013-08-16  0:17   ` Greg KH
2013-08-16 17:26     ` Sarah Sharp
2013-08-16 17:30       ` Sarah Sharp
2013-08-16 17:37         ` Greg KH
2013-08-16 17:38         ` Dmitry Kasatkin
2013-08-16 17:45           ` Greg KH
2013-08-16 17:50             ` Sarah Sharp
2013-08-27 14:16             ` Dmitry Kasatkin
2013-08-27 17:39               ` Greg KH
2013-08-27 17:40                 ` Dmitry Kasatkin
2013-08-16 17:30       ` Greg KH
2013-08-16 17:38         ` Sarah Sharp
2013-08-16 17:42           ` Dmitry Kasatkin
2013-08-15 16:37 ` [PATCH 1/2] dev-core: fix build break when DEBUG is enabled Greg KH
2013-08-15 16:53   ` Dmitry Kasatkin
2013-08-15 17:11     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.