* [PATCH v1 1/1] hwmon: (sht21) Use %*ph to print small buffer
@ 2024-09-11 19:46 Andy Shevchenko
2024-09-12 21:17 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2024-09-11 19:46 UTC (permalink / raw)
To: Andy Shevchenko, linux-hwmon, linux-kernel; +Cc: Jean Delvare, Guenter Roeck
Use %*ph format to print small buffer as hex string.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/hwmon/sht21.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c
index ad1b827ea782..97327313529b 100644
--- a/drivers/hwmon/sht21.c
+++ b/drivers/hwmon/sht21.c
@@ -199,10 +199,7 @@ static ssize_t eic_read(struct sht21 *sht21)
eic[6] = rx[0];
eic[7] = rx[1];
- ret = snprintf(sht21->eic, sizeof(sht21->eic),
- "%02x%02x%02x%02x%02x%02x%02x%02x\n",
- eic[0], eic[1], eic[2], eic[3],
- eic[4], eic[5], eic[6], eic[7]);
+ ret = snprintf(sht21->eic, sizeof(sht21->eic), "%8phN\n", eic);
out:
if (ret < 0)
sht21->eic[0] = 0;
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] hwmon: (sht21) Use %*ph to print small buffer
2024-09-11 19:46 [PATCH v1 1/1] hwmon: (sht21) Use %*ph to print small buffer Andy Shevchenko
@ 2024-09-12 21:17 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2024-09-12 21:17 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-hwmon, linux-kernel, Jean Delvare
On Wed, Sep 11, 2024 at 10:46:27PM +0300, Andy Shevchenko wrote:
> Use %*ph format to print small buffer as hex string.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-12 21:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 19:46 [PATCH v1 1/1] hwmon: (sht21) Use %*ph to print small buffer Andy Shevchenko
2024-09-12 21:17 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox