[RFC|PATCH] Compile time printk verbosity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series adds a configuration option to selectively compile out
printk message strings based on a verbosity level.

This works by wrapping printk with a macro which evaluates to a 
constant if condition which the compiler will be able to optimize 
out.

However because printk might be wrapped by a macro it no longer has
a return value. This means that constructs like the following ones
don't work: 

   ((void)(SOME_RANDOM_DEBUG_FLAG && printk(...));

   some_random_variable = printk(...);

Therefore printk_unfiltered is introduced which is just an alias
to the standard printk function but not wrapped by a macro.

Patches 4-6 make existing kernel code aware of this fact.

The series was compile tested with make allyesconfig for x86 and 
arm (with a cross compiler) but I might have missed something.

All kinds of comments are welcome.

Marc Andre Tanner (7):
      printk: introduce CONFIG_PRINTK_VERBOSITY
      printk: move printk to the end of the file
      printk: introduce printk_unfiltered as an alias to printk
      drivers: replace printk with printk_unfiltered
      drivers: make macro independent of printk's return value
      video/stk-webcam: change use of STK_ERROR
      printk: provide a filtering macro for printk


 drivers/char/mem.c                 |    2 +-
 drivers/md/md.c                    |    2 +-
 drivers/md/raid5.c                 |    2 +-
 drivers/media/video/stk-webcam.c   |   16 +++---
 drivers/net/e100.c                 |    2 +-
 drivers/net/ixgb/ixgb.h            |    2 +-
 drivers/net/ixgbe/ixgbe.h          |    2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.h |    2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.h |    2 +-
 include/linux/kernel.h             |   29 +++++++++++
 include/net/sctp/sctp.h            |    2 +-
 init/Kconfig                       |   28 ++++++++++
 kernel/lockdep.c                   |    4 +-
 kernel/printk.c                    |   96 +++++++++++++++++++++++-------------
 14 files changed, 137 insertions(+), 54 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Gstreamer Embedded]     [Linux MMC Devel]     [U-Boot V2]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux ARM Kernel]     [Linux OMAP]     [Linux SCSI]

  Powered by Linux