hw/gpio: Replace printf() calls by qemu_log_mask()
cover hw/gpio: Replace printf() calls by qemu_log_mask()
Trivial patches logging via qemu_log_mask() instead of using stdio directly.
Philippe Mathieu-Daudé (2):
hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
hw/gpio/max7310.c | 11 +++++------ hw/gpio/omap_gpio.c | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
Replace fprintf() by qemu_log_mask(LOG_GUEST_ERROR).
--- hw/gpio/omap_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/gpio/omap_gpio.c +4 -2
@@ -392,8 +392,10 @@ static void omap2_gpio_module_write(void *opaque, hwaddr addr,break ;case 0x10 :/* GPIO_SYSCONFIG */ -if (((value >>3 ) &3 ) ==3 ) -fprintf (stderr,"%s: bad IDLEMODE value\n" , __func__); +if (((value >>3 ) &3 ) ==3 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Illegal IDLEMODE value: 3\n" , __func__); + }if (value &2 )omap2_gpio_module_reset (s); s->config[0 ] = value &0x1d ;
Signature · 1 line
2.26.2
Re: [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
Quoted 15 lines
Replace
fprintf()byqemu_log_mask(LOG_GUEST_ERROR).Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/gpio/omap_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/gpio/omap_gpio.c +0
-0@@ -392,8 +392,10 @@ static void omap2_gpio_module_write(void *opaque, hwaddr addr,break ;
hw/gpio/omap_gpio.c static void omap2_gpio_module_write(void *opaque, hwaddr addr, · line 401
Quoted 10 lines
hw/gpio/omap_gpio.c +4
-2case 0x10 :/* GPIO_SYSCONFIG */ -if (((value >>3 ) &3 ) ==3 ) -fprintf (stderr,"%s: bad IDLEMODE value\n" , __func__); +if (((value >>3 ) &3 ) ==3 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Illegal IDLEMODE value: 3\n" , __func__); + }if (value &2 )omap2_gpio_module_reset (s); s->config[0 ] = value &0x1d ;
Laurent Vivier
AppliedRe: [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
In reply to Philippe Mathieu-DaudéLe 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
Quoted 15 lines
Replace
fprintf()byqemu_log_mask(LOG_GUEST_ERROR).Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/gpio/omap_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/gpio/omap_gpio.c +0
-0@@ -392,8 +392,10 @@ static void omap2_gpio_module_write(void *opaque, hwaddr addr,break ;
hw/gpio/omap_gpio.c static void omap2_gpio_module_write(void *opaque, hwaddr addr, · line 401
Quoted 10 lines
hw/gpio/omap_gpio.c +4
-2case 0x10 :/* GPIO_SYSCONFIG */ -if (((value >>3 ) &3 ) ==3 ) -fprintf (stderr,"%s: bad IDLEMODE value\n" , __func__); +if (((value >>3 ) &3 ) ==3 ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: Illegal IDLEMODE value: 3\n" , __func__); + }if (value &2 )omap2_gpio_module_reset (s); s->config[0 ] = value &0x1d ;
Applied to my trivial-patches branch.
Thanks,
Laurent
PATCH 2/2 hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
In reply to Philippe Mathieu-DaudéReplace disabled printf() by qemu_log_mask(UNIMP).
--- hw/gpio/max7310.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
hw/gpio/max7310.c +5 -6
@@ -11,6 +11,7 @@#include "hw/i2c/i2c.h" #include "hw/irq.h" #include "migration/vmstate.h" +#include "qemu/log.h" #include "qemu/module.h" #define TYPE_MAX7310 "max7310"
@@ -69,9 +70,8 @@ static uint8_t max7310_rx(I2CSlave *i2c)return 0xff ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);break ; }return 0xff ;
@@ -123,9 +123,8 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data)case 0x00 :/* Input port - ignore writes */ break ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);return 1 ; }
Signature · 1 line
2.26.2
Re: [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
Quoted 34 lines
Replace disabled
printf()byqemu_log_mask(UNIMP).Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/gpio/max7310.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)hw/gpio/max7310.c +3
-3@@ -11,6 +11,7 @@#include "hw/i2c/i2c.h" #include "hw/irq.h" #include "migration/vmstate.h" +#include "qemu/log.h" #include "qemu/module.h" #define TYPE_MAX7310 "max7310"@@ -69,9 +70,8 @@ static uint8_t max7310_rx(I2CSlave *i2c)return 0xff ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);break ; }return 0xff ;@@ -123,9 +123,8 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data)case 0x00 :/* Input port - ignore writes */
hw/gpio/max7310.c static int max7310_tx(I2CSlave *i2c, uint8_t data) · line 130
Quoted 10 lines
hw/gpio/max7310.c +2
-3break ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);return 1 ; }
Laurent Vivier
AppliedRe: [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
In reply to Philippe Mathieu-DaudéLe 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
Quoted 34 lines
Replace disabled
printf()byqemu_log_mask(UNIMP).Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/gpio/max7310.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)hw/gpio/max7310.c +3
-3@@ -11,6 +11,7 @@#include "hw/i2c/i2c.h" #include "hw/irq.h" #include "migration/vmstate.h" +#include "qemu/log.h" #include "qemu/module.h" #define TYPE_MAX7310 "max7310"@@ -69,9 +70,8 @@ static uint8_t max7310_rx(I2CSlave *i2c)return 0xff ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);break ; }return 0xff ;@@ -123,9 +123,8 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data)case 0x00 :/* Input port - ignore writes */
hw/gpio/max7310.c static int max7310_tx(I2CSlave *i2c, uint8_t data) · line 130
Quoted 10 lines
hw/gpio/max7310.c +2
-3break ;default : -#ifdef VERBOSE -printf ("%s: unknown register %02x\n" , __func__, s->command); -#endif +qemu_log_mask (LOG_UNIMP ,"%s: Unsupported register 0x02%" PRIx8"\n" , + __func__, s->command);return 1 ; }
Applied to my trivial-patches branch.
Thanks,
Laurent