From f8dc37dca0dc4ff9ffd2ab01e3cb105b4378c832 Mon Sep 17 00:00:00 2001 From: Gilles DOFFE Date: Mon, 20 Oct 2025 19:10:36 +0200 Subject: [PATCH] drivers/sht2x: fix printf format for native Signed-off-by: Gilles DOFFE --- drivers/l3gxxxx/l3gxxxx.c | 12 +++++++----- drivers/sht2x/sht2x.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/l3gxxxx/l3gxxxx.c b/drivers/l3gxxxx/l3gxxxx.c index 266beb3321..5281ead415 100644 --- a/drivers/l3gxxxx/l3gxxxx.c +++ b/drivers/l3gxxxx/l3gxxxx.c @@ -14,6 +14,8 @@ * @{ */ +#include +#include #include #include @@ -37,7 +39,7 @@ #define DEBUG_DEV(m, d, ...) \ DEBUG("[l3gxxxx] %s dev=%" PRIxPTR ": " m "\n", \ - __func__, (unsigned int)d, ## __VA_ARGS__) + __func__, (uintptr_t)d, ## __VA_ARGS__) #else /* ENABLE_DEBUG */ @@ -1032,7 +1034,7 @@ static int _read(const l3gxxxx_t *dev, uint8_t reg, uint8_t *data, uint8_t len) if (ENABLE_DEBUG) { printf("[l3gxxxx] %s dev=%" PRIxPTR ": read following bytes: ", - __func__, (unsigned int)dev); + __func__, (uintptr_t)dev); for (uint8_t i = 0; i < len; i++) { printf("%02x ", data[i]); } @@ -1059,7 +1061,7 @@ static int _read(const l3gxxxx_t *dev, uint8_t reg, uint8_t *data, uint8_t len) if (ENABLE_DEBUG) { printf("[l3gxxxx] %s dev=%" PRIxPTR ": read following bytes: ", - __func__, (unsigned int)dev); + __func__, (uintptr_t)dev); for (uint8_t i = 0; i < len; i++) { printf("%02x ", data[i]); } @@ -1090,7 +1092,7 @@ static int _write(const l3gxxxx_t *dev, if (ENABLE_DEBUG) { printf("[l3gxxxx] %s dev=%" PRIxPTR ": write following bytes: ", - __func__, (unsigned int)dev); + __func__, (uintptr_t)dev); for (uint8_t i = 0; i < len; i++) { printf("%02x ", data[i]); } @@ -1112,7 +1114,7 @@ static int _write(const l3gxxxx_t *dev, if (ENABLE_DEBUG) { printf("[l3gxxxx] %s dev=%" PRIxPTR ": write following bytes: ", - __func__, (unsigned int)dev); + __func__, (uintptr_t)dev); for (uint8_t i = 0; i < len; i++) { printf("%02x ", data[i]); } diff --git a/drivers/sht2x/sht2x.c b/drivers/sht2x/sht2x.c index 090a353c8c..b57d191317 100644 --- a/drivers/sht2x/sht2x.c +++ b/drivers/sht2x/sht2x.c @@ -209,7 +209,7 @@ int sht2x_read_ident(const sht2x_t *dev, uint8_t * buffer, size_t buflen) DEBUG("[SHT2x] ident (1): %02x %02x %02x %02x\n", data1[4], data1[5], data1[6], data1[7]); for (size_t ix = 0; ix < sizeof(data1); ix += 2) { if (sht2x_checkcrc(&data1[ix], 1, data1[ix + 1]) != 0) { - DEBUG("[SHT2x] checksum error first (ix=%d)\n", ix); + DEBUG("[SHT2x] checksum error first (ix=%zu)\n", ix); return SHT2X_ERR_CRC; } } @@ -225,7 +225,7 @@ int sht2x_read_ident(const sht2x_t *dev, uint8_t * buffer, size_t buflen) DEBUG("[SHT2x] ident (2): %02x %02x %02x\n", data2[3], data2[4], data2[5]); for (size_t ix = 0; ix < sizeof(data2); ix += 3) { if (sht2x_checkcrc(&data2[ix], 2, data2[ix + 2]) != 0) { - DEBUG("[SHT2x] checksum error, second (ix=%d)\n", ix); + DEBUG("[SHT2x] checksum error, second (ix=%zu)\n", ix); return SHT2X_ERR_CRC; } }