qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hw/gpio: Replace printf() calls by qemu_log_mask()
@ 2020-09-01 10:42 Philippe Mathieu-Daudé
  2020-09-01 10:42 ` [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) Philippe Mathieu-Daudé
  2020-09-01 10:42 ` [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP) Philippe Mathieu-Daudé
  0 siblings, 2 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-01 10:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm,
	Philippe Mathieu-Daudé

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(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
  2020-09-01 10:42 [PATCH 0/2] hw/gpio: Replace printf() calls by qemu_log_mask() Philippe Mathieu-Daudé
@ 2020-09-01 10:42 ` Philippe Mathieu-Daudé
  2020-09-02  9:15   ` Laurent Vivier
  2020-09-09 13:27   ` Laurent Vivier
  2020-09-01 10:42 ` [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP) Philippe Mathieu-Daudé
  1 sibling, 2 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-01 10:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm,
	Philippe Mathieu-Daudé

Replace fprintf() by qemu_log_mask(LOG_GUEST_ERROR).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/gpio/omap_gpio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c
index f662c4cb958..e25084b40c9 100644
--- a/hw/gpio/omap_gpio.c
+++ b/hw/gpio/omap_gpio.c
@@ -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;
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
  2020-09-01 10:42 [PATCH 0/2] hw/gpio: Replace printf() calls by qemu_log_mask() Philippe Mathieu-Daudé
  2020-09-01 10:42 ` [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) Philippe Mathieu-Daudé
@ 2020-09-01 10:42 ` Philippe Mathieu-Daudé
  2020-09-02  9:17   ` Laurent Vivier
  2020-09-09 13:30   ` Laurent Vivier
  1 sibling, 2 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-01 10:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm,
	Philippe Mathieu-Daudé

Replace disabled printf() by qemu_log_mask(UNIMP).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/gpio/max7310.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index 7f5de189acf..c58a1996418 100644
--- a/hw/gpio/max7310.c
+++ b/hw/gpio/max7310.c
@@ -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;
     }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
  2020-09-01 10:42 ` [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) Philippe Mathieu-Daudé
@ 2020-09-02  9:15   ` Laurent Vivier
  2020-09-09 13:27   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-09-02  9:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm

Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
> Replace fprintf() by qemu_log_mask(LOG_GUEST_ERROR).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/gpio/omap_gpio.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c
> index f662c4cb958..e25084b40c9 100644
> --- a/hw/gpio/omap_gpio.c
> +++ b/hw/gpio/omap_gpio.c
> @@ -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;
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
  2020-09-01 10:42 ` [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP) Philippe Mathieu-Daudé
@ 2020-09-02  9:17   ` Laurent Vivier
  2020-09-09 13:30   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-09-02  9:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm

Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
> Replace disabled printf() by qemu_log_mask(UNIMP).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/gpio/max7310.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
> index 7f5de189acf..c58a1996418 100644
> --- a/hw/gpio/max7310.c
> +++ b/hw/gpio/max7310.c
> @@ -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;
>      }
>  
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
  2020-09-01 10:42 ` [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) Philippe Mathieu-Daudé
  2020-09-02  9:15   ` Laurent Vivier
@ 2020-09-09 13:27   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-09-09 13:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm

Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
> Replace fprintf() by qemu_log_mask(LOG_GUEST_ERROR).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/gpio/omap_gpio.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c
> index f662c4cb958..e25084b40c9 100644
> --- a/hw/gpio/omap_gpio.c
> +++ b/hw/gpio/omap_gpio.c
> @@ -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;
> 

Applied to my trivial-patches branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
  2020-09-01 10:42 ` [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP) Philippe Mathieu-Daudé
  2020-09-02  9:17   ` Laurent Vivier
@ 2020-09-09 13:30   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-09-09 13:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Peter Maydell, qemu-arm

Le 01/09/2020 à 12:42, Philippe Mathieu-Daudé a écrit :
> Replace disabled printf() by qemu_log_mask(UNIMP).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/gpio/max7310.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
> index 7f5de189acf..c58a1996418 100644
> --- a/hw/gpio/max7310.c
> +++ b/hw/gpio/max7310.c
> @@ -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;
>      }
>  
> 

Applied to my trivial-patches branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-09 13:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-01 10:42 [PATCH 0/2] hw/gpio: Replace printf() calls by qemu_log_mask() Philippe Mathieu-Daudé
2020-09-01 10:42 ` [PATCH 1/2] hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR) Philippe Mathieu-Daudé
2020-09-02  9:15   ` Laurent Vivier
2020-09-09 13:27   ` Laurent Vivier
2020-09-01 10:42 ` [PATCH 2/2] hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP) Philippe Mathieu-Daudé
2020-09-02  9:17   ` Laurent Vivier
2020-09-09 13:30   ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).