[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgHpWpivQHcS+Eh1@mail.google.com>
Date: Tue, 8 Feb 2022 16:54:02 +1300
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
gregkh@...uxfoundation.org, realwakka@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: pi433: remove need to recompile code to debug
fifo content
On Mon, Feb 07, 2022 at 02:15:47AM -0800, Joe Perches wrote:
> > > -#ifdef DEBUG_FIFO_ACCESS
> > > + /* print content read from fifo for debugging purposes */
> > > for (i = 0; i < size; i++)
> > > dev_dbg(&spi->dev, "%d - 0x%x\n", i, local_buffer[i + 1]);
> > > -#endif
>
> If you use
>
> print_hex_dump_debug
>
> perhaps the DEBUG_FIFO_ACCESS could be removed.
>
Hi Joe, thanks for taking the time to review my patch.
print_hex_dump_debug is pretty convenient and straight to the point
which I do like. The only thing that I "didn't like" is the fact that
when configuring dynamic debugging, print_hex_dump_debug only cares
about 'p' flag and ignores all of the other flags that can be helpful
for tracking things down.
So essentially I lose track of which function and device instance
the message belongs to (users can have more than 1 at the same time).
But, because of your suggestion, I came across hex_dump_to_buffer()
which bridged the gap. thanks a lot :)
Would you be comfortable with the following implementation? (Dan, feel
free to chip in)
char linebuf[FIFO_SIZE * 3] = {0};
hex_dump_to_buffer(local_buffer + 1, size, 16, 1, linebuf,
ARRAY_SIZE(linebuf), false);
dev_dbg(&spi->dev, "%s\n", linebuf);
thanks,
Paulo Almeida
Powered by blists - more mailing lists