Message ID | 20200614142840.10245-2-mark.cave-ayland@ilande.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ADB: fix autopoll issues and rework mac_via state machine | expand |
On 6/14/20 4:28 PM, Mark Cave-Ayland wrote: > This will help ensure that style guidelines are being maintained during > subsequent changes. > > Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/input/adb.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/hw/input/adb.c b/hw/input/adb.c > index b1ac4a3852..bf1bc30d19 100644 > --- a/hw/input/adb.c > +++ b/hw/input/adb.c > @@ -44,14 +44,14 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) > > cmd = buf[0] & 0xf; > if (cmd == ADB_BUSRESET) { > - for(i = 0; i < s->nb_devices; i++) { > + for (i = 0; i < s->nb_devices; i++) { > d = s->devices[i]; > adb_device_reset(d); > } > return 0; > } > devaddr = buf[0] >> 4; > - for(i = 0; i < s->nb_devices; i++) { > + for (i = 0; i < s->nb_devices; i++) { > d = s->devices[i]; > if (d->devaddr == devaddr) { > ADBDeviceClass *adc = ADB_DEVICE_GET_CLASS(d); > @@ -69,9 +69,10 @@ int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask) > uint8_t buf[1]; > > olen = 0; > - for(i = 0; i < s->nb_devices; i++) { > - if (s->poll_index >= s->nb_devices) > + for (i = 0; i < s->nb_devices; i++) { > + if (s->poll_index >= s->nb_devices) { > s->poll_index = 0; > + } > d = s->devices[s->poll_index]; > if ((1 << d->devaddr) & poll_mask) { > buf[0] = ADB_READREG | (d->devaddr << 4); >
diff --git a/hw/input/adb.c b/hw/input/adb.c index b1ac4a3852..bf1bc30d19 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -44,14 +44,14 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) cmd = buf[0] & 0xf; if (cmd == ADB_BUSRESET) { - for(i = 0; i < s->nb_devices; i++) { + for (i = 0; i < s->nb_devices; i++) { d = s->devices[i]; adb_device_reset(d); } return 0; } devaddr = buf[0] >> 4; - for(i = 0; i < s->nb_devices; i++) { + for (i = 0; i < s->nb_devices; i++) { d = s->devices[i]; if (d->devaddr == devaddr) { ADBDeviceClass *adc = ADB_DEVICE_GET_CLASS(d); @@ -69,9 +69,10 @@ int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask) uint8_t buf[1]; olen = 0; - for(i = 0; i < s->nb_devices; i++) { - if (s->poll_index >= s->nb_devices) + for (i = 0; i < s->nb_devices; i++) { + if (s->poll_index >= s->nb_devices) { s->poll_index = 0; + } d = s->devices[s->poll_index]; if ((1 << d->devaddr) & poll_mask) { buf[0] = ADB_READREG | (d->devaddr << 4);
This will help ensure that style guidelines are being maintained during subsequent changes. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> --- hw/input/adb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)