Re: [PATCH] staging: ozwpan: Convert printk to dev_dbg()

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

 



On 06/25/2013 01:29 PM, Joe Perches wrote:
> On Tue, 2013-06-25 at 10:02 -0700, Greg KH wrote:
>> On Tue, Jun 25, 2013 at 05:30:02PM +0100, Rupesh Gujare wrote:
>>> convert all debug messages from printk to dev_dbg() & add kernel config to
>>> enable/disable these messages during compilation.
>> No, just use the built-in dynamic debug code in the kernel, no need to
>> provide any new macros or functions or most importantly, no new Kconfig
>> options.
> I think the Kconfig option is pretty poor too but a
> long needed extension to dev_dbg is to enable classes
> of messages by level or mask.
>
> There are many existing macros like
>
> #define module_dbg(level, fmt, ...)
> do {
> 	if (level >= some_module_var)
> 		debug_something(...);
> } while (0)
>
> and
>
> #define module_dbg(mask, fmt, ...)
> do {
> 	if (mask & some_module_var)
> 		debug_something(...)
> } while (0)
>
> It'd be nice to consolidate those in dev_dbg
>
> I'll get 'round to it one day if Jason doesn't.
>

Hi,

I've been a bit reluctant to add these 'flag' and 'level' to dynamic
debug b/c the debug statements can already be controlled individually,
and thus one could implement something pretty similar in userspace.
Also, it keeps things simpler.

That said, this has come up several times and might be a nice extension
for both the dynamic debug and non-dynamic debug case.

I think the interface could look something like:

pr_debug_level(&control_var, level, fmt, ...);
pr_debug_mask(&control_var, mask, fmt, ...);

and then you could do something like:

echo "grouping control_var level N +p" > /debugfs/dynamic_debug/control

or

echo "grouping control_var mask 0xN +p" > /debugfs/dynamic_debug/control

So we can think of the 'control_var' as 'grouping' debug statements
together. So it would provide a nice way of associating statements
together other than the existing: module, func, file, format, and line
selectors.

Thanks,

-Jason

























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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux