From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbcGMRKQ (ORCPT ); Wed, 13 Jul 2016 13:10:16 -0400 Received: from lists.s-osg.org ([54.187.51.154]:43034 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbcGMRKL (ORCPT ); Wed, 13 Jul 2016 13:10:11 -0400 From: Luis de Bethencourt To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, rusty@rustcorp.com.au, hidehiro.kawai.ez@hitachi.com, bp@suse.de, mina86@mina86.com, linux@rasmusvillemoes.dk, joe@perches.com, Luis de Bethencourt Subject: [RFC PATCH] dynamic_debug: only add header when used Date: Wed, 13 Jul 2016 18:09:53 +0100 Message-Id: <1468429793-16917-1-git-send-email-luisbg@osg.samsung.com> X-Mailer: git-send-email 2.5.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Hi, While studying the problem that surfaced when adding #include 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 [0] https://lkml.org/lkml/2016/7/11/753 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 #include #include -#include #include #include 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 /* If you are writing a driver, please use dev_dbg instead */ #if defined(CONFIG_DYNAMIC_DEBUG) +#include + /* 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 #include #include +#include #include #include "module-internal.h" -- 2.5.1