linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dynamic_debug: only add header when used
@ 2016-07-13 22:10 Luis de Bethencourt
  2016-07-13 22:10 ` [PATCH v2 2/2] drbd: include dynamic_debug.h in drb_int.h Luis de Bethencourt
  0 siblings, 1 reply; 2+ messages in thread
From: Luis de Bethencourt @ 2016-07-13 22:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, rusty, hidehiro.kawai.ez, bp, mina86, linux, joe,
	philipp.reisner, lars.ellenberg, drbd-dev, Luis de Bethencourt

kernel.h header doesn't directly use dynamic debug, instead we can include
it in module.c (which used it via kernel.h). printk.h only uses it if
CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen in that
case.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
v2:
 * Adding a second patch to update DRDB which used to get dynamic_debug.h
   via kernel.h. This isn't available anymore and it needs to include it
   directly.

Hi,

While studying the problem that surfaced when adding #include <linux/kernel.h>
in include/linux/string.h to have access to the MAX_SIZE macro [0]. I noticed
that dynamic_debug.h is included in kernel.h even though it isn't necessary.
Which in the case of adding kernel.h to string.h would mean a circular
dependency.

Not entirely sure if there is a reason for this beyond making dynamic debug
available to module.c. Which is why I am sending this patch as an RFC.

Thanks for the feedback,
Luis

 include/linux/kernel.h | 1 -
 include/linux/printk.h | 3 ++-
 kernel/module.c        | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index c420821..d96a611 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -11,7 +11,6 @@
 #include <linux/log2.h>
 #include <linux/typecheck.h>
 #include <linux/printk.h>
-#include <linux/dynamic_debug.h>
 #include <asm/byteorder.h>
 #include <uapi/linux/kernel.h>
 
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 41ac0fc..c2158f0 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -307,10 +307,11 @@ asmlinkage __printf(1, 2) __cold void __pr_info(const char *fmt, ...);
 	no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #endif
 
-#include <linux/dynamic_debug.h>
 
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(CONFIG_DYNAMIC_DEBUG)
+#include <linux/dynamic_debug.h>
+
 /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
 #define pr_debug(fmt, ...) \
 	dynamic_pr_debug(fmt, ##__VA_ARGS__)
diff --git a/kernel/module.c b/kernel/module.c
index beaebea..e70a2fa 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -60,6 +60,7 @@
 #include <linux/jump_label.h>
 #include <linux/pfn.h>
 #include <linux/bsearch.h>
+#include <linux/dynamic_debug.h>
 #include <uapi/linux/module.h>
 #include "module-internal.h"
 
-- 
2.5.3

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

* [PATCH v2 2/2] drbd: include dynamic_debug.h in drb_int.h
  2016-07-13 22:10 [PATCH v2 1/2] dynamic_debug: only add header when used Luis de Bethencourt
@ 2016-07-13 22:10 ` Luis de Bethencourt
  0 siblings, 0 replies; 2+ messages in thread
From: Luis de Bethencourt @ 2016-07-13 22:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, rusty, hidehiro.kawai.ez, bp, mina86, linux, joe,
	philipp.reisner, lars.ellenberg, drbd-dev, Luis de Bethencourt

dynamic_debug.h isn't included via kernel.h anymore. Since drbd_int.h needs
it to access dynamic_dev_dbg for dynamic_drbd_dbg, include the header
directly.
Removing inclusion of dynamic_debug.h from drbd_actlog.c since it is
already included via drbd_int.h.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
Hi,

Thanks to kbuild test robot for pointing this out [0]

It only happened if CONFIG_DYNAMIC_DEBUG was not set, which is why I
accidentaly missed in my testing.

Luis


[0] https://lists.01.org/pipermail/kbuild-all/2016-July/021902.html

 drivers/block/drbd/drbd_actlog.c | 1 -
 drivers/block/drbd/drbd_int.h    | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 0a1aaf8..2d3d50a 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -27,7 +27,6 @@
 #include <linux/crc32c.h>
 #include <linux/drbd.h>
 #include <linux/drbd_limits.h>
-#include <linux/dynamic_debug.h>
 #include "drbd_int.h"
 
 
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 7b54354..4cb8f21 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -41,6 +41,7 @@
 #include <linux/backing-dev.h>
 #include <linux/genhd.h>
 #include <linux/idr.h>
+#include <linux/dynamic_debug.h>
 #include <net/tcp.h>
 #include <linux/lru_cache.h>
 #include <linux/prefetch.h>
-- 
2.5.3

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

end of thread, other threads:[~2016-07-13 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13 22:10 [PATCH v2 1/2] dynamic_debug: only add header when used Luis de Bethencourt
2016-07-13 22:10 ` [PATCH v2 2/2] drbd: include dynamic_debug.h in drb_int.h Luis de Bethencourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).