linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Chandrabhanu Mahapatra <cmahapatra@ti.com>
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function
Date: Fri, 28 Sep 2012 11:22:38 +0000	[thread overview]
Message-ID: <1348831358.2437.14.camel@deskari> (raw)
In-Reply-To: <2fc91980de4af940ac59b26fd49da6498865db8b.1348826106.git.cmahapatra@ti.com>

[-- Attachment #1: Type: text/plain, Size: 3746 bytes --]

On Fri, 2012-09-28 at 15:53 +0530, Chandrabhanu Mahapatra wrote:
> The printk in DSSDBG function definition is replaced with dynamic debug enabled
> pr_debug(). The use of dynamic debugging provides more flexibility as each debug
> statement can be enabled or disabled dynamically on basis of source filename,
> line number, module name etc. by writing to a control file in debugfs
> filesystem. For better understanding please refer to
> Documentation/dynamic-debug-howto.txt.
> 
> The DSSDBGF() differs from DSSDBG() by providing function name. However,
> function name, line number, module name and thread ID can be printed through
> dynamic debug by setting appropriate flags 'f','l','m' and 't' in the debugfs
> control file. So, DSSDBGF instances are replaced with DSSDBG.
> 
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
> ---
>  drivers/video/omap2/dss/apply.c |    8 ++++----
>  drivers/video/omap2/dss/dsi.c   |   12 ++++++------
>  drivers/video/omap2/dss/dss.h   |   34 ++++++++--------------------------
>  3 files changed, 18 insertions(+), 36 deletions(-)
> 

> -	DSSDBGF("%d", channel);
> +	DSSDBG("Initial Config of Virtual Channel %d", channel);

A Bit Too Much Capital Letters here for my taste =). Use just one at the
beginning of the print, or none at all. 

>  
>  	r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel));
>  
> @@ -2814,7 +2814,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
>  	if (dsi->vc[channel].source == source)
>  		return 0;
>  
> -	DSSDBGF("%d", channel);
> +	DSSDBG("Source Config of Virtual Channel %d", channel);

Here also.

>  
>  	dsi_sync_vc(dsidev, channel);
>  
> @@ -3572,7 +3572,7 @@ static int dsi_enter_ulps(struct platform_device *dsidev)
>  	int r, i;
>  	unsigned mask;
>  
> -	DSSDBGF();
> +	DSSDBG("Entering ULPS");
>  
>  	WARN_ON(!dsi_bus_is_locked(dsidev));
>  
> @@ -4276,7 +4276,7 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
>  	unsigned long pck;
>  	int r;
>  
> -	DSSDBGF("ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
> +	DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
>  
>  	mutex_lock(&dsi->lock);
>  
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index ffbba7e..5ef4e17 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -25,38 +25,20 @@
>  
>  #ifdef DEBUG
>  extern bool dss_debug;
> -#ifdef DSS_SUBSYS_NAME
> -#define DSSDBG(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME ": " format, \
> -		## __VA_ARGS__)
> -#else
> -#define DSSDBG(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss: " format, ## __VA_ARGS__)
>  #endif
>  
> -#ifdef DSS_SUBSYS_NAME
> -#define DSSDBGF(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME \
> -				": %s(" format ")\n", \
> -				__func__, \
> -				## __VA_ARGS__)
> -#else
> -#define DSSDBGF(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss: " \
> -				": %s(" format ")\n", \
> -				__func__, \
> -				## __VA_ARGS__)
> +#ifdef pr_fmt
> +#undef pr_fmt
>  #endif
>  
> -#else /* DEBUG */
> -#define DSSDBG(format, ...)
> -#define DSSDBGF(format, ...)
> +#ifdef DSS_SUBSYS_NAME
> +#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
> +#else
> +#define pr_fmt(fmt) fmt
>  #endif

I think you could just do:

#ifdef DSS_SUBSYS_NAME
#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
#endif 

For the case where there's no DSS_SUBSYS_NAME, there's no need to undef
pr_fmt, only to redefine it again back to the original.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-09-28 11:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25  6:15 [PATCH] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function Chandrabhanu Mahapatra
2012-09-25  6:24 ` Tomi Valkeinen
2012-09-25  9:42   ` Mahapatra, Chandrabhanu
2012-09-25  9:57     ` Tomi Valkeinen
2012-09-26  5:27 ` [PATCH V2 0/2] OMAPDSS: Enable dynamic debug printing Chandrabhanu Mahapatra
2012-09-26  5:27   ` [PATCH V2 1/2] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function Chandrabhanu Mahapatra
2012-09-26  5:28   ` [PATCH V2 2/2] OMAPDSS: Remove dss_debug variable Chandrabhanu Mahapatra
2012-09-26 14:29   ` [PATCH V2 0/2] OMAPDSS: Enable dynamic debug printing Tomi Valkeinen
2012-09-27 10:50     ` Mahapatra, Chandrabhanu
2012-09-27 11:01       ` Tomi Valkeinen
2012-09-28 10:35   ` [PATCH V3 0/3] " Chandrabhanu Mahapatra
2012-09-28 10:35     ` [PATCH V3 1/3] OMAPDSS: Move definition of DEBUG flag to Makefile Chandrabhanu Mahapatra
2012-09-28 10:35     ` [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function Chandrabhanu Mahapatra
2012-09-28 11:22       ` Tomi Valkeinen [this message]
2012-09-28 11:42         ` Mahapatra, Chandrabhanu
2012-09-28 11:37           ` Tomi Valkeinen
2012-09-28 10:35     ` [PATCH V3 3/3] OMAPDSS: Remove dss_debug variable Chandrabhanu Mahapatra
2012-09-28 11:34     ` [PATCH V3 0/3] OMAPDSS: Enable dynamic debug printing Tomi Valkeinen
2012-09-28 12:23       ` Mahapatra, Chandrabhanu
2012-09-29 10:51     ` [PATCH V4 0/5] " Chandrabhanu Mahapatra
2012-09-29 10:51       ` [PATCH V4 1/5] OMAPDSS: Move definition of DEBUG flag to Makefile Chandrabhanu Mahapatra
2012-09-29 10:52       ` [PATCH V4 2/5] OMAPDSS: Create new debug config options Chandrabhanu Mahapatra
2012-09-29 15:27         ` Sumit Semwal
2012-10-01  7:51         ` [PATCH V5 " Chandrabhanu Mahapatra
2012-09-29 10:52       ` [PATCH V4 3/5] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function Chandrabhanu Mahapatra
2012-09-29 10:52       ` [PATCH V4 4/5] OMAPDSS: Replace multi part debug prints with pr_debug Chandrabhanu Mahapatra
2012-10-05 12:33         ` Tomi Valkeinen
2012-10-10  9:34         ` [PATCH V5 " Chandrabhanu Mahapatra
2012-09-29 10:52       ` [PATCH V4 5/5] OMAPDSS: Remove dss_debug variable Chandrabhanu Mahapatra
2012-10-05 12:46       ` [PATCH V4 0/5] OMAPDSS: Enable dynamic debug printing Tomi Valkeinen
2012-10-10 10:38         ` Sumit Semwal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348831358.2437.14.camel@deskari \
    --to=tomi.valkeinen@ti.com \
    --cc=cmahapatra@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).