From: Tim Bird <tim.bird@am.sony.com>
To: Constantine Shulyupin <const@makelinux.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
"celinux-dev@lists.celinuxforum.org"
<celinux-dev@lists.celinuxforum.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Celinux-dev] [PATCH] LDT - Linux Driver Template
Date: Tue, 13 Nov 2012 16:59:07 -0800 [thread overview]
Message-ID: <50A2ECDB.7030901@am.sony.com> (raw)
In-Reply-To: <CAE7jHC_bTi7bNwTyPh=wsstGUFegisDUtt2QvDeAwh94AMoUAQ@mail.gmail.com>
My apologies. As celinux-dev list administrator, I messed up my
moderation and this response from Greg got discarded instead of
sent to the list.
Here it is, sent by me on Greg's behalf...
-- Tim
On Wed, Nov 14, 2012 at 02:14:58AM +0200, Constantine Shulyupin wrote:
> On Tue, Nov 13, 2012 at 9:01 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>> +#define pr_debug_hex(h) pr_debug("%s:%d %s %s = 0x%lX\n", \
>>> + __file__, __LINE__, __func__, #h, (long int)h)
>>
>> This is not needed at all, just use the proper printk() attribute.
>
> Macro above allows tidy tracing code:
>
> pr_debug_hex(ioread8(port_ptr + UART_IER));
> pr_debug_hex(ioread8(port_ptr + UART_IIR));
> pr_debug_hex(ioread8(port_ptr + UART_FCR));
> pr_debug_hex(ioread8(port_ptr + UART_LCR));
> pr_debug_hex(ioread8(port_ptr + UART_MCR));
> pr_debug_hex(ioread8(port_ptr + UART_LSR));
> pr_debug_hex(ioread8(port_ptr + UART_MSR));
>
> Without that macro, code above should be rewritten with pr_debug (or printk) as:
>
> pr_debug("UART_IER=0x%02X\n", ioread8(port_ptr + UART_IER));
> pr_debug("UART_IIR=0x%02X\n", ioread8(port_ptr + UART_IIR));
> pr_debug("UART_FCR=0x%02X\n", ioread8(port_ptr + UART_FCR));
> pr_debug("UART_LCR=0x%02X\n", ioread8(port_ptr + UART_LCR));
> pr_debug("UART_MCR=0x%02X\n", ioread8(port_ptr + UART_MCR));
> pr_debug("UART_LSR=0x%02X\n", ioread8(port_ptr + UART_LSR));
> pr_debug("UART_MSR=0x%02X\n", ioread8(port_ptr + UART_MSR));
>
> That is less readable and less supportable.
What better is to not do foolish stuff like this at all
If you need tracing, use the in-kernel tracing framework, don't roll
your own.
> I prefer the fist case.
I prefer the flower case :)
> Actually I use a lot shorter macro:
> #define traceh(h) printk("%s = 0x%lX\n", #h, (long int)h)
>
> What is you opinion? Which method is better?
Again, neither, don't clutter your code up with unneeded things like
this.
greg k-h
next prev parent reply other threads:[~2012-11-14 0:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 18:46 [PATCH] LDT - Linux Driver Template Constantine Shulyupin
2012-11-13 19:01 ` Greg KH
2012-11-13 22:31 ` Constantine Shulyupin
2012-11-13 23:02 ` Greg KH
2012-11-13 23:19 ` Constantine Shulyupin
2012-11-13 23:32 ` Greg KH
2012-11-13 23:51 ` Constantine Shulyupin
2012-11-14 0:14 ` Constantine Shulyupin
2012-11-14 0:48 ` Greg KH
2012-11-14 0:59 ` Tim Bird [this message]
2012-11-14 3:42 ` Ryan Mallon
2012-11-14 13:04 ` Constantine Shulyupin
2012-11-14 11:13 ` Alan Cox
2012-11-16 9:57 ` Jean-Christophe PLAGNIOL-VILLARD
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=50A2ECDB.7030901@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=celinux-dev@lists.celinuxforum.org \
--cc=const@makelinux.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.