]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
hw/net/can: Make CanBusClientInfo::can_receive() return a boolean
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 5 Mar 2020 17:56:50 +0000 (18:56 +0100)
committerJason Wang <jasowang@redhat.com>
Tue, 31 Mar 2020 13:14:35 +0000 (21:14 +0800)
The CanBusClientInfo::can_receive handler return whether the
device can or can not receive new frames. Make it obvious by
returning a boolean type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
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>
hw/net/allwinner-sun8i-emac.c
hw/net/can/can_sja1000.c
hw/net/can/can_sja1000.h
include/net/can_emu.h
net/can/can_socketcan.c

index 3fc5e3464013750fc2849b2182b64f10ba605c9b..033eaa85bf51ef2044791f88b78b81bec1650031 100644 (file)
@@ -395,7 +395,7 @@ static void allwinner_sun8i_emac_flush_desc(FrameDescriptor *desc,
     cpu_physical_memory_write(phys_addr, desc, sizeof(*desc));
 }
 
-static int allwinner_sun8i_emac_can_receive(NetClientState *nc)
+static bool allwinner_sun8i_emac_can_receive(NetClientState *nc)
 {
     AwSun8iEmacState *s = qemu_get_nic_opaque(nc);
     FrameDescriptor desc;
index 39c78faf9b2955a674b5b3f8ed16c74a019d4fc3..ea915a023a510231ca94933aba95f1434e89ebcc 100644 (file)
@@ -733,21 +733,21 @@ uint64_t can_sja_mem_read(CanSJA1000State *s, hwaddr addr, unsigned size)
     return temp;
 }
 
-int can_sja_can_receive(CanBusClientState *client)
+bool can_sja_can_receive(CanBusClientState *client)
 {
     CanSJA1000State *s = container_of(client, CanSJA1000State, bus_client);
 
     if (s->clock & 0x80) { /* PeliCAN Mode */
         if (s->mode & 0x01) { /* reset mode. */
-            return 0;
+            return false;
         }
     } else { /* BasicCAN mode */
         if (s->control & 0x01) {
-            return 0;
+            return false;
         }
     }
 
-    return 1; /* always return 1, when operation mode */
+    return true; /* always return true, when operation mode */
 }
 
 ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames,
index 220a622087fbc95c8fbce2b5014f089fe40bae38..7ca9cd681ed183317f8074ccdbc99861291c5cfa 100644 (file)
@@ -137,7 +137,7 @@ void can_sja_disconnect(CanSJA1000State *s);
 
 int can_sja_init(CanSJA1000State *s, qemu_irq irq);
 
-int can_sja_can_receive(CanBusClientState *client);
+bool can_sja_can_receive(CanBusClientState *client);
 
 ssize_t can_sja_receive(CanBusClientState *client,
                         const qemu_can_frame *frames, size_t frames_cnt);
index d4fc51b57d51d62e7020d4b1b7f5e90094c29bad..fce97709287ecf112a6eaf58183f422f775d7225 100644 (file)
@@ -83,7 +83,7 @@ typedef struct CanBusClientState CanBusClientState;
 typedef struct CanBusState CanBusState;
 
 typedef struct CanBusClientInfo {
-    int (*can_receive)(CanBusClientState *);
+    bool (*can_receive)(CanBusClientState *);
     ssize_t (*receive)(CanBusClientState *,
         const struct qemu_can_frame *frames, size_t frames_cnt);
 } CanBusClientInfo;
index 29bfacd4f8a0d968a8155f6b669014c989181802..807f31fcde0c16809da0f80f45eb014d063c48cd 100644 (file)
@@ -110,9 +110,9 @@ static void can_host_socketcan_read(void *opaque)
     }
 }
 
-static int can_host_socketcan_can_receive(CanBusClientState *client)
+static bool can_host_socketcan_can_receive(CanBusClientState *client)
 {
-    return 1;
+    return true;
 }
 
 static ssize_t can_host_socketcan_receive(CanBusClientState *client,