summary refs log tree commit diff stats
path: root/hw/net/dp8393x.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-03-05 18:56:49 +0100
committerJason Wang <jasowang@redhat.com>2020-03-31 21:14:35 +0800
commitb8c4b67e3ec3918a40234e5c56221f780c7856fc (patch)
tree1ca475ca3fe280e0f857cfe1160b52753b53bd72 /hw/net/dp8393x.c
parent3317db743972f665e2753c75703538d51241350a (diff)
downloadfocaccia-qemu-b8c4b67e3ec3918a40234e5c56221f780c7856fc.tar.gz
focaccia-qemu-b8c4b67e3ec3918a40234e5c56221f780c7856fc.zip
hw/net: Make NetCanReceive() return a boolean
The NetCanReceive handler return whether the device can or
can not receive new packets. Make it obvious by returning
a boolean type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/dp8393x.c')
-rw-r--r--hw/net/dp8393x.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 1563c11b9e..c54db0d62d 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -414,7 +414,7 @@ static void dp8393x_do_stop_timer(dp8393xState *s)
     dp8393x_update_wt_regs(s);
 }
 
-static int dp8393x_can_receive(NetClientState *nc);
+static bool dp8393x_can_receive(NetClientState *nc);
 
 static void dp8393x_do_receiver_enable(dp8393xState *s)
 {
@@ -718,13 +718,11 @@ static void dp8393x_watchdog(void *opaque)
     dp8393x_update_irq(s);
 }
 
-static int dp8393x_can_receive(NetClientState *nc)
+static bool dp8393x_can_receive(NetClientState *nc)
 {
     dp8393xState *s = qemu_get_nic_opaque(nc);
 
-    if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))
-        return 0;
-    return 1;
+    return !!(s->regs[SONIC_CR] & SONIC_CR_RXEN);
 }
 
 static int dp8393x_receive_filter(dp8393xState *s, const uint8_t * buf,