Skip to content

Commit e589c0e

Browse files
shentokphilmd
authored andcommitted
hw/i2c/imx_i2c: Convert DPRINTF() to trace events
Also print the QOM canonical path when tracing which allows for distinguishing the many instances a typical i.MX SoC has. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Bernhard Beschow <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 1bada3c commit e589c0e

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

hw/i2c/imx_i2c.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,7 @@
2525
#include "hw/i2c/i2c.h"
2626
#include "qemu/log.h"
2727
#include "qemu/module.h"
28-
29-
#ifndef DEBUG_IMX_I2C
30-
#define DEBUG_IMX_I2C 0
31-
#endif
32-
33-
#define DPRINTF(fmt, args...) \
34-
do { \
35-
if (DEBUG_IMX_I2C) { \
36-
fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_I2C, \
37-
__func__, ##args); \
38-
} \
39-
} while (0)
28+
#include "trace.h"
4029

4130
static const char *imx_i2c_get_regname(unsigned offset)
4231
{
@@ -152,8 +141,8 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset,
152141
break;
153142
}
154143

155-
DPRINTF("read %s [0x%" HWADDR_PRIx "] -> 0x%02x\n",
156-
imx_i2c_get_regname(offset), offset, value);
144+
trace_imx_i2c_read(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
145+
offset, value);
157146

158147
return (uint64_t)value;
159148
}
@@ -163,8 +152,8 @@ static void imx_i2c_write(void *opaque, hwaddr offset,
163152
{
164153
IMXI2CState *s = IMX_I2C(opaque);
165154

166-
DPRINTF("write %s [0x%" HWADDR_PRIx "] <- 0x%02x\n",
167-
imx_i2c_get_regname(offset), offset, (int)value);
155+
trace_imx_i2c_read(DEVICE(s)->canonical_path, imx_i2c_get_regname(offset),
156+
offset, value);
168157

169158
value &= 0xff;
170159

hw/i2c/trace-events

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ npcm7xx_smbus_recv_fifo(const char *id, uint8_t received, uint8_t expected) "%s
5656

5757
pca954x_write_bytes(uint8_t value) "PCA954X write data: 0x%02x"
5858
pca954x_read_data(uint8_t value) "PCA954X read data: 0x%02x"
59+
60+
# imx_i2c.c
61+
62+
imx_i2c_read(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] -> 0x%02" PRIx64
63+
imx_i2c_write(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] <- 0x%02" PRIx64

0 commit comments

Comments
 (0)