[PATCH 3/7] debug: use printk() instead pr_debug()

Eugene Krasnikov k.eugene.e at gmail.com
Mon May 20 09:58:20 EDT 2013


It is not only about line numbers in the source code but also about
whole files and flexibility that dynamic debug provides. I am not sure
why Atheros/QCA is not using pr_debug but other vendors like
TI(http://lxr.free-electrons.com/source/drivers/net/wireless/ti/wlcore/debug.h?a=blackfin#L78),
Broadcom(http://lxr.free-electrons.com/source/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h#L58),
Marvel(http://lxr.free-electrons.com/source/drivers/net/wireless/mwifiex/main.c#L768)
are using it rather spread.

What if we hide it behind CONFIG_DYNAMIC_DEBUG like this :

#if defined(CONFIG_DYNAMIC_DEBUG)

#define wcn36xx_dbg(mask, fmt, arg...) \
if (debug_mask & mask) \
pr_debug(DRIVER_PREFIX fmt "\n", ##arg)
#else

#define wcn36xx_dbg(mask, fmt, arg...) \
if (debug_mask & mask) \
printk(DRIVER_PREFIX fmt "\n", ##arg)

#endif

How about this?:)

2013/5/20 Kalle Valo <kvalo at qca.qualcomm.com>:
> Eugene Krasnikov <k.eugene.e at gmail.com> writes:
>
>> But if let's say problem is on the border of WCN36XX_DBG_SMD and
>> WCN36XX_DBG_DXE. To enable both will spam the log a lot but using
>> dynamic debug it is possible to disable certain functions that are not
>> needed for problem investigation. That's why dynamic debug is really
>> flexible.
>
> If enabling two log levels spams too much when our debug messages are
> too verbose. That's why I started to make our debug messages more
> compact, it's easier to read them when they are compact.
>
> Dynamic debugging is a nice idea but it's not really practical for
> wireless driver development due to lack of grouping. Using just line
> numbers won't work as line numbers change all the time and there's just
> too many of them. And AFAIK none of the other Atheros/QCA upstream
> drivers use dynamic debug either.
>
> But if we still preserve dynamic debug support maybe we could implement
> something like this:
>
> if debug_mask set
>    printk()
> else
>    pr_debug()
>
> That way if debug_mask is set dynamic debug is bypassed and debug
> messages are printed only according to debug_mask. But if debug_mask is
> not set, dynamic debug feature is used as earlier. How does that sound?
>
> --
> Kalle Valo



-- 
Best regards,
Eugene



More information about the wcn36xx mailing list