Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Titus Rwantare <titusr@google.com>
---
hw/i2c/core.c | 8 +++++---
hw/i2c/trace-events | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index 4cf30b2c86..d238311776 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -161,7 +161,8 @@ static int i2c_do_start_transfer(I2CBus *bus, uint8_t address,
start condition. */
if (sc->event) {
- trace_i2c_event(event == I2C_START_SEND ? "start" : "start_async",
+ trace_i2c_event(DEVICE(s)->canonical_path,
+ event == I2C_START_SEND ? "start" : "start_async",
s->address);
rv = sc->event(s, event);
if (rv && !bus->broadcast) {
@@ -244,7 +245,7 @@ void i2c_end_transfer(I2CBus *bus)
I2CSlave *s = node->elt;
sc = I2C_SLAVE_GET_CLASS(s);
if (sc->event) {
- trace_i2c_event("finish", s->address);
+ trace_i2c_event(DEVICE(s)->canonical_path, "finish", s->address);
sc->event(s, I2C_FINISH);
}
QLIST_REMOVE(node, next);
@@ -321,7 +322,8 @@ void i2c_nack(I2CBus *bus)
QLIST_FOREACH(node, &bus->current_devs, next) {
sc = I2C_SLAVE_GET_CLASS(node->elt);
if (sc->event) {
- trace_i2c_event("nack", node->elt->address);
+ trace_i2c_event(DEVICE(node->elt)->canonical_path,
+ "nack", node->elt->address);
sc->event(node->elt, I2C_NACK);
}
}
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index f708a7ace1..e5f2dc643e 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -9,7 +9,7 @@ bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out)
# core.c
-i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)"
+i2c_event(const char *id, const char *event, uint8_t address) "%s: %s(addr:0x%02x)"
i2c_send(uint8_t address, uint8_t data) "send(addr:0x%02x) data:0x%02x"
i2c_send_async(uint8_t address, uint8_t data) "send_async(addr:0x%02x) data:0x%02x"
i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x"
--
2.47.0.277.g8800431eea-goog
On Thu, Nov 07, 2024 at 07:54:51PM +0000, Titus Rwantare wrote:
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Titus Rwantare <titusr@google.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
> ---
> hw/i2c/core.c | 8 +++++---
> hw/i2c/trace-events | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/hw/i2c/core.c b/hw/i2c/core.c
> index 4cf30b2c86..d238311776 100644
> --- a/hw/i2c/core.c
> +++ b/hw/i2c/core.c
> @@ -161,7 +161,8 @@ static int i2c_do_start_transfer(I2CBus *bus, uint8_t address,
> start condition. */
>
> if (sc->event) {
> - trace_i2c_event(event == I2C_START_SEND ? "start" : "start_async",
> + trace_i2c_event(DEVICE(s)->canonical_path,
> + event == I2C_START_SEND ? "start" : "start_async",
> s->address);
> rv = sc->event(s, event);
> if (rv && !bus->broadcast) {
> @@ -244,7 +245,7 @@ void i2c_end_transfer(I2CBus *bus)
> I2CSlave *s = node->elt;
> sc = I2C_SLAVE_GET_CLASS(s);
> if (sc->event) {
> - trace_i2c_event("finish", s->address);
> + trace_i2c_event(DEVICE(s)->canonical_path, "finish", s->address);
> sc->event(s, I2C_FINISH);
> }
> QLIST_REMOVE(node, next);
> @@ -321,7 +322,8 @@ void i2c_nack(I2CBus *bus)
> QLIST_FOREACH(node, &bus->current_devs, next) {
> sc = I2C_SLAVE_GET_CLASS(node->elt);
> if (sc->event) {
> - trace_i2c_event("nack", node->elt->address);
> + trace_i2c_event(DEVICE(node->elt)->canonical_path,
> + "nack", node->elt->address);
> sc->event(node->elt, I2C_NACK);
> }
> }
> diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
> index f708a7ace1..e5f2dc643e 100644
> --- a/hw/i2c/trace-events
> +++ b/hw/i2c/trace-events
> @@ -9,7 +9,7 @@ bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out)
>
> # core.c
>
> -i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)"
> +i2c_event(const char *id, const char *event, uint8_t address) "%s: %s(addr:0x%02x)"
> i2c_send(uint8_t address, uint8_t data) "send(addr:0x%02x) data:0x%02x"
> i2c_send_async(uint8_t address, uint8_t data) "send_async(addr:0x%02x) data:0x%02x"
> i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x"
> --
> 2.47.0.277.g8800431eea-goog
>
© 2016 - 2026 Red Hat, Inc.