Skip to contentSkip to conversation

mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer

PATCH In review Andy Shevchenko 2 participants 5 messages Jun 12, 2023 – Jun 22, 2023 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: ipaq-micro: Use %*ph for printing hexdump of a small buffer

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.

---
 drivers/mfd/ipaq-micro.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/ipaq-micro.c +2 -4
index 6d3968458e81..57fb7874fc91 100644
@@ -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);
 }
Signature · 1 line
2.40.0.1.gaa8946217a0b
maintainer
#1 lore raw
Quoted 3 lines · 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.

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

Nice try. 2 patches please.

Quoted 28 lines

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

---
 drivers/mfd/ipaq-micro.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/ipaq-micro.c +2 -4
index 6d3968458e81..57fb7874fc91 100644
@@ -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);
 }
Signature · 1 line
2.40.0.1.gaa8946217a0b
Signature · 1 line
Lee Jones [李琼斯]
#2 lore raw
Quoted 9 lines · Lee Jones
Quoted 3 lines · 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.

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Lee Jones
Quoted 3 lines · 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.

Quoted 6 lines
Quoted 3 lines

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?

Signature · 1 line
Lee Jones [李琼斯]
#4 lore raw
Quoted 7 lines · Lee Jones
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Lee Jones
Quoted 3 lines · 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.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko