[OPW,kernel,v2,0/4] Compile out printks below a certain priority level.
diff mbox

Message ID 20141029213946.GC4280@jtriplet-mobl1
State New, archived
Headers show

Commit Message

Josh Triplett Oct. 29, 2014, 9:39 p.m. UTC
On Wed, Oct 22, 2014 at 01:00:35AM +0530, Kumari Radha wrote:
> This patch set compiles out all printk messages(including pr_*_once
> and pr_*_ratelimited) below a certain priority level.
> 
> -- define a config symbol in init/Kconfig
> -- compile out printk() based on priority
> -- compile out printk_once() based on priority
> -- compile out printk_ratelimited() based on priority
> 
> Kumari Radha (4):
>   init: Added a Kconfig symbol to define printk log priority.
>   printk: Compile out all printk messages below a certain priority
>     level.
>   printk: Compile out all pr_*_once messages below a certain priority
>     level.
>   printk: Compile out all pr_*_ratelimited messages below a certain
>     priority level.
> 
> Changes in v2:
>     - In Patch 2/4 changed subject line, removed #ifdef CONFIG_PRINTK and
>     repharesed comment.
>     - In Patch 3/4 changed subject line and description, removed #ifdef
>     CONFIG_PRINT and rephrased comment.
>     - In Patch 4/4 changed subject line and description, removed #ifdef
>     CONFIG_PRINTK and rephrased comment.

When I attempted to apply and test-compile this, I discovered an issue: with
CONFIG_PRINTK disabled, Kconfig doesn't define CONFIG_PRINTK_LOG_PRIORITY at
all, so GCC produces numerous warnings like these:

include/linux/printk.h:237:6: warning: "CONFIG_PRINTK_LOG_PRIORITY" is not defined [-Wundef]
 #if (CONFIG_PRINTK_LOG_PRIORITY < 1)
      ^
include/linux/printk.h:245:6: warning: "CONFIG_PRINTK_LOG_PRIORITY" is not defined [-Wundef]
 #if (CONFIG_PRINTK_LOG_PRIORITY < 2)
      ^

To fix this, you can change the Kconfig code to always define the
symbol, but only make it user-visible if both EXPERT && PRINTK, like
this:



Can you make that change to patch 1, please?

Thanks,
Josh Triplett

Patch
diff mbox

--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1432,10 +1432,9 @@  config PRINTK
 	  strongly discouraged.
 
 config PRINTK_LOG_PRIORITY
-	int "Kernel printk loglevel priority" if EXPERT
+	int "Kernel printk loglevel priority" if EXPERT && PRINTK
 	range 0 7
 	default 7
-	depends on PRINTK
 	help
 	  Set this option to a printk priority level from 0-7, to compile
 	  out all printk messages with lower priority (numerically higher)