public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer
@ 2023-06-12 21:20 Andy Shevchenko
  2023-06-21 17:10 ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-12 21:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Jones, Andy Shevchenko

The kernel already has a helper to print a hexdump of a small
buffer via pointer extension. Use that instead of open coded
variant.

In long term it helps to kill pr_cont() or at least narrow down
its use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/ipaq-micro.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index 6d3968458e81..57fb7874fc91 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -131,10 +131,8 @@ static void micro_rx_msg(struct ipaq_micro *micro, u8 id, int len, u8 *data)
 		break;
 	default:
 		dev_err(micro->dev,
-			"unknown msg %d [%d] ", id, len);
-		for (i = 0; i < len; ++i)
-			pr_cont("0x%02x ", data[i]);
-		pr_cont("\n");
+			"unknown msg %d [%d] %*ph\n", id, len, len, data);
+		break;
 	}
 	spin_unlock(&micro->lock);
 }
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer
  2023-06-12 21:20 [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer Andy Shevchenko
@ 2023-06-21 17:10 ` Lee Jones
  2023-06-22 12:31   ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2023-06-21 17:10 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

On Tue, 13 Jun 2023, Andy Shevchenko wrote:

> The kernel already has a helper to print a hexdump of a small
> buffer via pointer extension. Use that instead of open coded
> variant.

That's not all you're doing is it?

Nice try.  2 patches please.

> In long term it helps to kill pr_cont() or at least narrow down
> its use.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/mfd/ipaq-micro.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
> index 6d3968458e81..57fb7874fc91 100644
> --- a/drivers/mfd/ipaq-micro.c
> +++ b/drivers/mfd/ipaq-micro.c
> @@ -131,10 +131,8 @@ static void micro_rx_msg(struct ipaq_micro *micro, u8 id, int len, u8 *data)
>  		break;
>  	default:
>  		dev_err(micro->dev,
> -			"unknown msg %d [%d] ", id, len);
> -		for (i = 0; i < len; ++i)
> -			pr_cont("0x%02x ", data[i]);
> -		pr_cont("\n");
> +			"unknown msg %d [%d] %*ph\n", id, len, len, data);
> +		break;
>  	}
>  	spin_unlock(&micro->lock);
>  }
> -- 
> 2.40.0.1.gaa8946217a0b
> 

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer
  2023-06-21 17:10 ` Lee Jones
@ 2023-06-22 12:31   ` Andy Shevchenko
  2023-06-22 14:00     ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-22 12:31 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel

On Wed, Jun 21, 2023 at 06:10:40PM +0100, Lee Jones wrote:
> On Tue, 13 Jun 2023, Andy Shevchenko wrote:
> 
> > The kernel already has a helper to print a hexdump of a small
> > buffer via pointer extension. Use that instead of open coded
> > variant.
> 
> That's not all you're doing is it?
> 
> Nice try.  2 patches please.

I'm not sure it's possible to split to two clean patches that don't overlap
each other like by 70%. Can you elaborate a bit more on your vision on this?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer
  2023-06-22 12:31   ` Andy Shevchenko
@ 2023-06-22 14:00     ` Lee Jones
  2023-06-22 14:56       ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2023-06-22 14:00 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

On Thu, 22 Jun 2023, Andy Shevchenko wrote:

> On Wed, Jun 21, 2023 at 06:10:40PM +0100, Lee Jones wrote:
> > On Tue, 13 Jun 2023, Andy Shevchenko wrote:
> > 
> > > The kernel already has a helper to print a hexdump of a small
> > > buffer via pointer extension. Use that instead of open coded
> > > variant.
> > 
> > That's not all you're doing is it?
> > 
> > Nice try.  2 patches please.
> 
> I'm not sure it's possible to split to two clean patches that don't overlap
> each other like by 70%. Can you elaborate a bit more on your vision on this?

What does the 'break' have to do with changing print format?

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer
  2023-06-22 14:00     ` Lee Jones
@ 2023-06-22 14:56       ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-06-22 14:56 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel

On Thu, Jun 22, 2023 at 03:00:58PM +0100, Lee Jones wrote:
> On Thu, 22 Jun 2023, Andy Shevchenko wrote:
> > On Wed, Jun 21, 2023 at 06:10:40PM +0100, Lee Jones wrote:
> > > On Tue, 13 Jun 2023, Andy Shevchenko wrote:
> > > > The kernel already has a helper to print a hexdump of a small
> > > > buffer via pointer extension. Use that instead of open coded
> > > > variant.
> > > 
> > > That's not all you're doing is it?
> > > 
> > > Nice try.  2 patches please.
> > 
> > I'm not sure it's possible to split to two clean patches that don't overlap
> > each other like by 70%. Can you elaborate a bit more on your vision on this?
> 
> What does the 'break' have to do with changing print format?

Ah, indeed! Thank you for spotting this. Yes, 2 patches.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-22 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 21:20 [PATCH v1 1/1] mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer Andy Shevchenko
2023-06-21 17:10 ` Lee Jones
2023-06-22 12:31   ` Andy Shevchenko
2023-06-22 14:00     ` Lee Jones
2023-06-22 14:56       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox