hw/i2c/smbus_slave: Add object path on error prints

The current logging doesn't tell us which specific smbus device is an
error state.

Signed-off-by: Joe Komlodi <komlodi@google.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240202204847.2062798-3-komlodi@google.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Joe Komlodi 2024-02-02 20:48:46 +00:00 committed by Philippe Mathieu-Daudé
parent 61f406f377
commit fcc8299e29

View File

@ -25,11 +25,15 @@
#define DPRINTF(fmt, ...) \
do { printf("smbus(%02x): " fmt , dev->i2c.address, ## __VA_ARGS__); } while (0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__); exit(1);} while (0)
do { g_autofree char *qom_path = object_get_canonical_path(OBJECT(dev)); \
fprintf(stderr, "%s: smbus: error: " fmt , qom_path, ## __VA_ARGS__); \
exit(1); } while (0)
#else
#define DPRINTF(fmt, ...) do {} while(0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__);} while (0)
do { g_autofree char *qom_path = object_get_canonical_path(OBJECT(dev)); \
fprintf(stderr, "%s: smbus: error: " fmt , qom_path, ## __VA_ARGS__); \
} while (0)
#endif
enum {