From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Jason Wang" <jasowang@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Joel Stanley" <joel@jms.id.au>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
qemu-arm@nongnu.org, "Peter Chubb" <peter.chubb@nicta.com.au>,
"Cédric Le Goater" <clg@kaod.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH 6/6] hw/net/can: Make CanBusClientInfo::can_receive() return a boolean
Date: Thu, 5 Mar 2020 18:56:50 +0100 [thread overview]
Message-ID: <20200305175651.4563-7-philmd@redhat.com> (raw)
In-Reply-To: <20200305175651.4563-1-philmd@redhat.com>
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>
---
hw/net/can/can_sja1000.h | 2 +-
include/net/can_emu.h | 2 +-
hw/net/can/can_sja1000.c | 8 ++++----
net/can/can_socketcan.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/net/can/can_sja1000.h b/hw/net/can/can_sja1000.h
index 220a622087..7ca9cd681e 100644
--- a/hw/net/can/can_sja1000.h
+++ b/hw/net/can/can_sja1000.h
@@ -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);
diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index d4fc51b57d..fce9770928 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -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;
diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index 39c78faf9b..ea915a023a 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -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,
diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
index 29bfacd4f8..807f31fcde 100644
--- a/net/can/can_socketcan.c
+++ b/net/can/can_socketcan.c
@@ -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,
--
2.21.1
next prev parent reply other threads:[~2020-03-05 17:59 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 17:56 [PATCH 0/6] hw/net: Make Net/CanBus can_receive() handlers return a boolean Philippe Mathieu-Daudé
2020-03-05 17:56 ` Philippe Mathieu-Daudé
2020-03-05 17:56 ` [PATCH 1/6] hw/net/e1000e_core: Let e1000e_can_receive() " Philippe Mathieu-Daudé
2020-03-05 17:56 ` Philippe Mathieu-Daudé
2020-03-05 18:46 ` Alistair Francis
2020-03-05 18:46 ` Alistair Francis
2020-03-06 8:37 ` Paolo Bonzini
2020-03-06 8:37 ` Paolo Bonzini
2020-03-06 15:25 ` Cédric Le Goater
2020-03-05 17:56 ` [PATCH 2/6] hw/net/smc91c111: Let smc91c111_can_receive() " Philippe Mathieu-Daudé
2020-03-05 17:56 ` Philippe Mathieu-Daudé
2020-03-05 18:46 ` Alistair Francis
2020-03-06 15:26 ` Cédric Le Goater
2020-03-06 15:26 ` Cédric Le Goater
2020-03-05 17:56 ` [PATCH 3/6] hw/net/rtl8139: Simplify if/else statement Philippe Mathieu-Daudé
2020-03-05 17:56 ` Philippe Mathieu-Daudé
2020-03-05 18:49 ` Alistair Francis
2020-03-05 18:49 ` Alistair Francis
2020-03-06 15:26 ` Cédric Le Goater
2020-03-06 15:26 ` Cédric Le Goater
2020-03-05 17:56 ` [PATCH 4/6] hw/net/rtl8139: Update coding style to make checkpatch.pl happy Philippe Mathieu-Daudé
2020-03-05 17:56 ` Philippe Mathieu-Daudé
2020-03-05 18:51 ` Alistair Francis
2020-03-05 18:51 ` Alistair Francis
2020-03-06 15:26 ` Cédric Le Goater
2020-03-06 15:26 ` Cédric Le Goater
2020-03-05 17:56 ` [PATCH 5/6] hw/net: Make NetCanReceive() return a boolean Philippe Mathieu-Daudé
2020-03-05 22:54 ` David Gibson
2020-03-05 22:54 ` David Gibson
2020-03-05 23:10 ` Alistair Francis
2020-03-06 15:09 ` Cédric Le Goater
2020-03-06 15:09 ` Cédric Le Goater
2020-03-05 17:56 ` Philippe Mathieu-Daudé [this message]
2020-03-05 23:10 ` [PATCH 6/6] hw/net/can: Make CanBusClientInfo::can_receive() " Alistair Francis
2020-03-06 15:27 ` Cédric Le Goater
2020-03-17 10:47 ` [PATCH 0/6] hw/net: Make Net/CanBus can_receive() handlers " Philippe Mathieu-Daudé
2020-03-17 10:47 ` Philippe Mathieu-Daudé
2020-03-18 2:31 ` Jason Wang
2020-03-18 2:31 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200305175651.4563-7-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alistair@alistair23.me \
--cc=andrew@aj.id.au \
--cc=b.galvani@gmail.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=dmitry.fleytman@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=joel@jms.id.au \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.chubb@nicta.com.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.