[PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean

Philippe Mathieu-Daudé posted 6 patches 5 years, 8 months ago
Maintainers: Max Filippov <jcmvbkbc@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Cédric Le Goater" <clg@kaod.org>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Alistair Francis <alistair@alistair23.me>, Beniamino Galvani <b.galvani@gmail.com>, Peter Chubb <peter.chubb@nicta.com.au>, David Gibson <david@gibson.dropbear.id.au>, Andrew Jeffery <andrew@aj.id.au>, Jason Wang <jasowang@redhat.com>, Joel Stanley <joel@jms.id.au>, Richard Henderson <rth@twiddle.net>, Peter Maydell <peter.maydell@linaro.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
[PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean
Posted by Philippe Mathieu-Daudé 5 years, 8 months ago
The smc91c111_can_receive() function simply returns a boolean value.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/net/smc91c111.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
index e9eb6f6c05..02be60c955 100644
--- a/hw/net/smc91c111.c
+++ b/hw/net/smc91c111.c
@@ -130,16 +130,16 @@ static void smc91c111_update(smc91c111_state *s)
     qemu_set_irq(s->irq, level);
 }
 
-static int smc91c111_can_receive(smc91c111_state *s)
+static bool smc91c111_can_receive(smc91c111_state *s)
 {
     if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) {
-        return 1;
+        return true;
     }
     if (s->allocated == (1 << NUM_PACKETS) - 1 ||
         s->rx_fifo_len == NUM_PACKETS) {
-        return 0;
+        return false;
     }
-    return 1;
+    return true;
 }
 
 static inline void smc91c111_flush_queued_packets(smc91c111_state *s)
-- 
2.21.1


Re: [PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean
Posted by Alistair Francis 5 years, 8 months ago
On Thu, Mar 5, 2020 at 9:57 AM Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> The smc91c111_can_receive() function simply returns a boolean value.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/net/smc91c111.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
> index e9eb6f6c05..02be60c955 100644
> --- a/hw/net/smc91c111.c
> +++ b/hw/net/smc91c111.c
> @@ -130,16 +130,16 @@ static void smc91c111_update(smc91c111_state *s)
>      qemu_set_irq(s->irq, level);
>  }
>
> -static int smc91c111_can_receive(smc91c111_state *s)
> +static bool smc91c111_can_receive(smc91c111_state *s)
>  {
>      if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) {
> -        return 1;
> +        return true;
>      }
>      if (s->allocated == (1 << NUM_PACKETS) - 1 ||
>          s->rx_fifo_len == NUM_PACKETS) {
> -        return 0;
> +        return false;
>      }
> -    return 1;
> +    return true;
>  }
>
>  static inline void smc91c111_flush_queued_packets(smc91c111_state *s)
> --
> 2.21.1
>
>

Re: [PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean
Posted by Cédric Le Goater 5 years, 8 months ago
On 3/5/20 6:56 PM, Philippe Mathieu-Daudé wrote:
> The smc91c111_can_receive() function simply returns a boolean value.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

> ---
>  hw/net/smc91c111.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
> index e9eb6f6c05..02be60c955 100644
> --- a/hw/net/smc91c111.c
> +++ b/hw/net/smc91c111.c
> @@ -130,16 +130,16 @@ static void smc91c111_update(smc91c111_state *s)
>      qemu_set_irq(s->irq, level);
>  }
>  
> -static int smc91c111_can_receive(smc91c111_state *s)
> +static bool smc91c111_can_receive(smc91c111_state *s)
>  {
>      if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) {
> -        return 1;
> +        return true;
>      }
>      if (s->allocated == (1 << NUM_PACKETS) - 1 ||
>          s->rx_fifo_len == NUM_PACKETS) {
> -        return 0;
> +        return false;
>      }
> -    return 1;
> +    return true;
>  }
>  
>  static inline void smc91c111_flush_queued_packets(smc91c111_state *s)
>