From: "Henri Häkkinen" <henrih81@gmail.com>
To: Joe Perches <joe@perches.com>, Mark Rankilor <reodge@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@suse.de,
andrea.gelmini@gelma.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging:comedi: Fixed coding convention issues.
Date: Sun, 13 Jun 2010 14:27:45 +0300 [thread overview]
Message-ID: <EC683E5B-0C90-4C16-B493-7BFAEC675BDA@gmail.com> (raw)
In-Reply-To: <1276407050.1449.28.camel@Joe-Laptop.home>
Hello
There are several printk statements without the "comedi:" prefix. Such as:
printk(KERN_WARNING "BUG: dev->driver=NULL in comedi_device_detach()\n");
Do you think it is better to leave these as they are, or should they be changed to use comedi_xxx macros (which will print the "comedi:" prefix)?
Also even with logging macros, there will be few lines which go beyond the 80 character boundary.
On 13.6.2010, at 8.30, Joe Perches wrote:
> On Sat, 2010-06-12 at 22:07 -0700, Joe Perches wrote:
>> 2: Create some comedi logging functions or macros like:
>> comedi_<level>(fmt, arg...) (ie: comedi_info, comedi_err, etc)
>> where "comedi:" is always prefixed and an
>> optional #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>> could be used.
>
> Maybe this is a start:
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/staging/comedi/comedidev.h | 54 ++++++++++++++++++++++++++++++++++--
> 1 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
> index 4eb2b77..6c2bdde 100644
> --- a/drivers/staging/comedi/comedidev.h
> +++ b/drivers/staging/comedi/comedidev.h
> @@ -43,11 +43,59 @@
>
> #include "comedi.h"
>
> -#define DPRINTK(format, args...) do { \
> - if (comedi_debug) \
> - printk(KERN_DEBUG "comedi: " format , ## args); \
> +#define comedi_printk(level, fmt, args...) \
> + printk(level "comedi: " pr_fmt(fmt), ##args)
> +
> +#define DPRINTK(format, args...) \
> +do { \
> + if (comedi_debug) \
> + comedi_printk(KERN_DEBUG, fmt, ##args); \
> } while (0)
>
> +#define comedi_emerg(fmt, ...) \
> + comedi_printk(KERN_EMERG, fmt, ##__VA_ARGS__)
> +#define comedi_alert(fmt, ...) \
> + comedi_printk(KERN_ALERT, fmt, ##__VA_ARGS__)
> +#define comedi_crit(fmt, ...) \
> + comedi_printk(KERN_CRIT, fmt, ##__VA_ARGS__)
> +#define comedi_err(fmt, ...) \
> + comedi_printk(KERN_ERR, fmt, ##__VA_ARGS__)
> +#define comedi_warn(fmt, ...) \
> + comedi_printk(KERN_WARNING, fmt, ##__VA_ARGS__)
> +#define comedi_notice(fmt, ...) \
> + comedi_printk(KERN_NOTICE, fmt, ##__VA_ARGS__)
> +#define comedi_info(fmt, ...) \
> + comedi_printk(KERN_INFO, fmt, ##__VA_ARGS__)
> +
> +/* comedi_devel() should produce zero code unless DEBUG is defined */
> +#ifdef DEBUG
> +#define comedi_devel(fmt, ...) \
> + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__)
> +#else
> +#define comedi_devel(fmt, ...) \
> +({ \
> + if (0) \
> + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__); \
> + 0; \
> +})
> +#endif
> +
> +#if defined(DEBUG)
> +#define comedi_debug(fmt, ...) \
> + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__)
> +#elif defined(CONFIG_DYNAMIC_DEBUG)
> +/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
> +#define comedi_debug(fmt, ...) \
> + dynamic_pr_debug(fmt, ##__VA_ARGS__)
> +#else
> +#define comedi_debug(fmt, ...) \
> +({ \
> + if (0) \
> + comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__); \
> + 0; \
> +})
> +#endif
> +
> #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
> #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \
> COMEDI_MINORVERSION, COMEDI_MICROVERSION)
>
>
next prev parent reply other threads:[~2010-06-13 11:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-12 10:14 Henri Häkkinen
2010-06-13 2:14 ` Mark Rankilor
2010-06-13 5:07 ` Joe Perches
2010-06-13 5:30 ` Joe Perches
2010-06-13 11:27 ` Henri Häkkinen [this message]
2010-06-13 18:11 ` Joe Perches
2010-06-17 22:51 ` Greg KH
2010-06-17 23:15 ` Joe Perches
2010-06-17 23:28 ` Greg KH
2010-06-17 23:47 ` Joe Perches
2010-06-18 12:16 ` Ian Abbott
2010-06-12 11:04 Henri Häkkinen
2010-06-14 6:34 Henri Häkkinen
2010-06-17 23:02 ` Greg KH
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=EC683E5B-0C90-4C16-B493-7BFAEC675BDA@gmail.com \
--to=henrih81@gmail.com \
--cc=andrea.gelmini@gelma.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reodge@gmail.com \
/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
all inboxes | Powered by JetHome®