Skip to content

Commit d2288b7

Browse files
committed
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 <[email protected]> Tested-by: Finn Thain <[email protected]> Acked-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]>
1 parent 3fe02cc commit d2288b7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hw/input/adb.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ static void adb_device_reset(ADBDevice *d)
3838
qdev_reset_all(DEVICE(d));
3939
}
4040

41-
int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
41+
static int do_adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf,
42+
int len)
4243
{
4344
ADBDevice *d;
4445
ADBDeviceClass *adc;
@@ -83,6 +84,11 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
8384
return ADB_RET_NOTPRESENT;
8485
}
8586

87+
int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
88+
{
89+
return do_adb_request(s, obuf, buf, len);
90+
}
91+
8692
/* XXX: move that to cuda ? */
8793
int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
8894
{
@@ -98,7 +104,7 @@ int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
98104
d = s->devices[s->poll_index];
99105
if ((1 << d->devaddr) & poll_mask) {
100106
buf[0] = ADB_READREG | (d->devaddr << 4);
101-
olen = adb_request(s, obuf + 1, buf, 1);
107+
olen = do_adb_request(s, obuf + 1, buf, 1);
102108
/* if there is data, we poll again the same device */
103109
if (olen > 0) {
104110
s->status |= ADB_STATUS_POLLREPLY;

0 commit comments

Comments
 (0)