Re: [PATCH V2 0/2] OMAPDSS: Enable dynamic debug printing
From: Tomi Valkeinen <hidden>
Date: 2012-09-27 11:01:12
Also in:
linux-omap
On Thu, 2012-09-27 at 16:20 +0530, Mahapatra, Chandrabhanu wrote:
On Wed, Sep 26, 2012 at 7:59 PM, Tomi Valkeinen [off-list ref] wrote:quoted
This doesn't work quite correctly. The problem is in dss.h, where we define DEBUG if CONFIG_OMAP2_DSS_DEBUG_SUPPORT is set. The thing is, DEBUG should be defined before including the kernel headers where the pr_debug etc are defined. So if you try the patches without dynamic debugging enabled, you won't get any debug outputs at all, even if CONFIG_OMAP2_DSS_DEBUG_SUPPORT is set. And for dynamic debug, the Kconfig help says: If a source file is compiled with DEBUG flag set, any pr_debug() calls in it are enabled by default, but can be disabled at runtime as below. Note that DEBUG flag is turned on by many CONFIG_*DEBUG* options. So if we have CONFIG_OMAP2_DSS_DEBUG_SUPPORT set, all the pr_debugs should be enabled by default, which is not the case, again because DEBUG is defined too late. I think setting DEBUG in dss.h should be removed, and instead DEBUG should be set in the makefile if CONFIG_OMAP2_DSS_DEBUG_SUPPORT is set. TomiWell the documentation lags in describing about the DEBUG flag. I should have checked DYNAMIC_DEBUG in Kconfig and pr_debug definition in printk.h file. #if defined(CONFIG_DYNAMIC_DEBUG) /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ #define pr_debug(fmt, ...) \ dynamic_pr_debug(fmt, ##__VA_ARGS__) #elif defined(DEBUG) #define pr_debug(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_debug(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif As per the definition above pr_debug is dynamic with CONFIG_DYNAMIC_DEBUG set or else with DEBUG set it is just a normal kernel debug printk as you have mentioned. I still don't get how even if DEBUG is set before DSSDBG() is defined in dss.c pr_debug() fails to enable.
Because printk.h is included without DEBUG, thus pr_debug is defined as no_printk.
Well anyways, how to do the same in the Makefile? I tried adding ccflags-$(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) += -DEBUG to makefile in dss directory but of no use.
-D option for the compiler is used to set defines. So it should be -DDEBUG Tomi
Attachments
- signature.asc [application/pgp-signature] 836 bytes