aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-06-23 21:49:28 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-06-26 10:13:51 +0100
commitd2288b75845d86d4a9486e72f966676ce5c3ed1e (patch)
treed8c511010b91014722a146ebd6771e55caa69a5e /hw
parent3fe02cc8b3a5b50fad6d5e7cc3a65fd52d1fad36 (diff)
downloadqemu-d2288b75845d86d4a9486e72f966676ce5c3ed1e.zip
qemu-d2288b75845d86d4a9486e72f966676ce5c3ed1e.tar.gz
qemu-d2288b75845d86d4a9486e72f966676ce5c3ed1e.tar.bz2
adb: use adb_request() only for explicit requests
Currently adb_request() is called both for explicit ADB requests and internal autopoll requests via adb_poll(). Move the current functionality into do_adb_request() to be used internally and add a simple adb_request() wrapper for explicit requests. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Finn Thain <fthain@telegraphics.com.au> Acked-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200623204936.24064-15-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw')
-rw-r--r--hw/input/adb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/input/adb.c b/hw/input/adb.c
index a7a482f..b3ad7c5 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -38,7 +38,8 @@ static void adb_device_reset(ADBDevice *d)
qdev_reset_all(DEVICE(d));
}
-int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
+static int do_adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf,
+ int len)
{
ADBDevice *d;
ADBDeviceClass *adc;
@@ -83,6 +84,11 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
return ADB_RET_NOTPRESENT;
}
+int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
+{
+ return do_adb_request(s, obuf, buf, len);
+}
+
/* XXX: move that to cuda ? */
int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
{
@@ -98,7 +104,7 @@ int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
d = s->devices[s->poll_index];
if ((1 << d->devaddr) & poll_mask) {
buf[0] = ADB_READREG | (d->devaddr << 4);
- olen = adb_request(s, obuf + 1, buf, 1);
+ olen = do_adb_request(s, obuf + 1, buf, 1);
/* if there is data, we poll again the same device */
if (olen > 0) {
s->status |= ADB_STATUS_POLLREPLY;