Re: 'continue' to appease style gods in i386,amd64 libsa
Hi > Two nits inline: Thanks for the feedback. Updated diff below. Tom >>>8-Jun-16 11:52 >>> > > Hi Tom, > > Two nits inline: > > On Tue, Jun 7, 2016 at 9:47 PM, Tom Cosgrove > wrote: > > Tom Cosgrove 6-Jun-16 21:07 >>> > >> > >> As per subject, a couple of empty loop bodies in the i396 and amd64 boot > >> blocks. > >> > >> Diff below. > >> > >> Tom > > > > Subsequently found a few more, and a handful of trailing whitespaces. > > > > Updated diff below. Index: sys/arch/amd64/stand/efiboot/efidev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/efiboot/efidev.c,v retrieving revision 1.18 diff -u -p -u -r1.18 efidev.c --- sys/arch/amd64/stand/efiboot/efidev.c 6 May 2016 03:13:52 - 1.18 +++ sys/arch/amd64/stand/efiboot/efidev.c 8 Jun 2016 11:32:52 - @@ -568,7 +568,8 @@ efiopen(struct open_file *f, ...) } #endif for (maj = 0; maj < nbdevs && - strncmp(dev, bdevs[maj], devlen); maj++); + strncmp(dev, bdevs[maj], devlen); maj++) + continue; if (maj >= nbdevs) { printf("Unknown device: "); for (cp = *file; *cp != ':'; cp++) Index: sys/arch/amd64/stand/libsa/bioscons.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/bioscons.c,v retrieving revision 1.11 diff -u -p -u -r1.11 bioscons.c --- sys/arch/amd64/stand/libsa/bioscons.c 27 May 2016 05:37:51 - 1.11 +++ sys/arch/amd64/stand/libsa/bioscons.c 8 Jun 2016 11:32:52 - @@ -155,7 +155,7 @@ com_init(struct consdev *cn) /* A few ms delay for the chip, using the getsecs() API */ while (!(i++ % 1000) && getsecs() < tt) - ; + continue; /* drain the input buffer */ while (inb(port + com_lsr) & LSR_RXRDY) @@ -171,7 +171,7 @@ com_getc(dev_t dev) return (inb(port + com_lsr) & LSR_RXRDY); while ((inb(port + com_lsr) & LSR_RXRDY) == 0) - ; + continue; return (inb(port + com_data) & 0xff); } @@ -237,7 +237,7 @@ com_putc(dev_t dev, int c) int port = (com_addr == -1) ? comports[minor(dev)] : com_addr; while ((inb(port + com_lsr) & LSR_TXRDY) == 0) - ; + continue; outb(port + com_data, c); } Index: sys/arch/amd64/stand/libsa/biosdev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v retrieving revision 1.27 diff -u -p -u -r1.27 biosdev.c --- sys/arch/amd64/stand/libsa/biosdev.c1 Oct 2015 20:28:12 - 1.27 +++ sys/arch/amd64/stand/libsa/biosdev.c8 Jun 2016 11:32:52 - @@ -560,7 +560,8 @@ biosopen(struct open_file *f, ...) #endif for (maj = 0; maj < nbdevs && - strncmp(dev, bdevs[maj], devlen); maj++); + strncmp(dev, bdevs[maj], devlen); maj++) + continue; if (maj >= nbdevs) { printf("Unknown device: "); for (cp = *file; *cp != ':'; cp++) @@ -671,7 +672,8 @@ biosdisk_err(u_int error) register const u_char *p = bidos_errs; while (*p && *p != error) - while (*p++); + while (*p++) + continue; return ++p; } @@ -703,7 +705,8 @@ biosdisk_errno(u_int error) if (error == 0) return 0; - for (p = tab; p->error && p->error != error; p++); + for (p = tab; p->error && p->error != error; p++) + continue; return p->errno; } Index: sys/arch/amd64/stand/libsa/diskprobe.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/diskprobe.c,v retrieving revision 1.16 diff -u -p -u -r1.16 diskprobe.c --- sys/arch/amd64/stand/libsa/diskprobe.c 2 Sep 2015 01:52:26 - 1.16 +++ sys/arch/amd64/stand/libsa/diskprobe.c 8 Jun 2016 11:32:52 - @@ -266,7 +266,7 @@ diskprobe(void) /* Checksumming of hard disks */ for (i = 0; disksum(i++) && i < MAX_CKSUMLEN; ) - ; + continue; bios_cksumlen = i; /* Get space for passing bios_diskinfo stuff to kernel */ Index: sys/arch/amd64/stand/libsa/gateA20.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/gateA20.c,v retrieving revision 1.2 diff -u -p -u -r1.2 gateA20.c --- sys/arch/amd64/stand/libsa/gateA20.c21 Mar 2004 21:37:41 - 1.2 +++ sys/arch/amd64/stand/libsa/gateA20.c8 Jun 2016 11:32:52 - @@ -74,19 +74,24 @@ gateA20(int on) } } else { - while (inb(IO_KBD + KBSTATP) & KBS_IBF); +
Re: 'continue' to appease style gods in i386,amd64 libsa
>>> Tom Cosgrove 6-Jun-16 21:07 >>> > > As per subject, a couple of empty loop bodies in the i396 and amd64 boot > blocks. > > Diff below. > > Tom Subsequently found a few more, and a handful of trailing whitespaces. Updated diff below. Thanks Tom Index: sys/arch/amd64/stand/efiboot/efidev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/efiboot/efidev.c,v retrieving revision 1.18 diff -u -p -u -r1.18 efidev.c --- sys/arch/amd64/stand/efiboot/efidev.c 6 May 2016 03:13:52 - 1.18 +++ sys/arch/amd64/stand/efiboot/efidev.c 7 Jun 2016 20:40:16 - @@ -568,7 +568,7 @@ efiopen(struct open_file *f, ...) } #endif for (maj = 0; maj < nbdevs && - strncmp(dev, bdevs[maj], devlen); maj++); + strncmp(dev, bdevs[maj], devlen); maj++) continue; if (maj >= nbdevs) { printf("Unknown device: "); for (cp = *file; *cp != ':'; cp++) Index: sys/arch/amd64/stand/libsa/bioscons.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/bioscons.c,v retrieving revision 1.11 diff -u -p -u -r1.11 bioscons.c --- sys/arch/amd64/stand/libsa/bioscons.c 27 May 2016 05:37:51 - 1.11 +++ sys/arch/amd64/stand/libsa/bioscons.c 7 Jun 2016 20:40:16 - @@ -155,7 +155,7 @@ com_init(struct consdev *cn) /* A few ms delay for the chip, using the getsecs() API */ while (!(i++ % 1000) && getsecs() < tt) - ; + continue; /* drain the input buffer */ while (inb(port + com_lsr) & LSR_RXRDY) @@ -171,7 +171,7 @@ com_getc(dev_t dev) return (inb(port + com_lsr) & LSR_RXRDY); while ((inb(port + com_lsr) & LSR_RXRDY) == 0) - ; + continue; return (inb(port + com_data) & 0xff); } @@ -237,7 +237,7 @@ com_putc(dev_t dev, int c) int port = (com_addr == -1) ? comports[minor(dev)] : com_addr; while ((inb(port + com_lsr) & LSR_TXRDY) == 0) - ; + continue; outb(port + com_data, c); } Index: sys/arch/amd64/stand/libsa/biosdev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v retrieving revision 1.27 diff -u -p -u -r1.27 biosdev.c --- sys/arch/amd64/stand/libsa/biosdev.c1 Oct 2015 20:28:12 - 1.27 +++ sys/arch/amd64/stand/libsa/biosdev.c7 Jun 2016 20:40:16 - @@ -560,7 +560,7 @@ biosopen(struct open_file *f, ...) #endif for (maj = 0; maj < nbdevs && - strncmp(dev, bdevs[maj], devlen); maj++); + strncmp(dev, bdevs[maj], devlen); maj++) continue; if (maj >= nbdevs) { printf("Unknown device: "); for (cp = *file; *cp != ':'; cp++) @@ -671,7 +671,8 @@ biosdisk_err(u_int error) register const u_char *p = bidos_errs; while (*p && *p != error) - while (*p++); + while (*p++) + continue; return ++p; } @@ -703,7 +704,8 @@ biosdisk_errno(u_int error) if (error == 0) return 0; - for (p = tab; p->error && p->error != error; p++); + for (p = tab; p->error && p->error != error; p++) + continue; return p->errno; } Index: sys/arch/amd64/stand/libsa/diskprobe.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/diskprobe.c,v retrieving revision 1.16 diff -u -p -u -r1.16 diskprobe.c --- sys/arch/amd64/stand/libsa/diskprobe.c 2 Sep 2015 01:52:26 - 1.16 +++ sys/arch/amd64/stand/libsa/diskprobe.c 7 Jun 2016 20:40:16 - @@ -266,7 +266,7 @@ diskprobe(void) /* Checksumming of hard disks */ for (i = 0; disksum(i++) && i < MAX_CKSUMLEN; ) - ; + continue; bios_cksumlen = i; /* Get space for passing bios_diskinfo stuff to kernel */ Index: sys/arch/amd64/stand/libsa/gateA20.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/gateA20.c,v retrieving revision 1.2 diff -u -p -u -r1.2 gateA20.c --- sys/arch/amd64/stand/libsa/gateA20.c21 Mar 2004 21:37:41 - 1.2 +++ sys/arch/amd64/stand/libsa/gateA20.c7 Jun 2016 20:40:16 - @@ -74,19 +74,19 @@ gateA20(int on) } } else { - while (inb(IO_KBD + KBSTATP) & KBS_IBF); + while (inb(IO_KBD + KBSTATP) & KBS_IBF) continue; while (inb(IO_KBD + KBSTATP) & KBS_DIB) (void)inb(IO_KBD + KBDATAP); outb(IO_KBD + KBCMDP, KBC_CMDWOUT); - while (inb(IO_KBD + KBSTATP) & KBS_IBF); + while
'continue' to appease style gods in i386,amd64 libsa
As per subject, a couple of empty loop bodies in the i396 and amd64 boot blocks. Diff below. Tom Index: sys/arch/amd64/stand/libsa/biosdev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v retrieving revision 1.27 diff -u -p -u -r1.27 biosdev.c --- sys/arch/amd64/stand/libsa/biosdev.c1 Oct 2015 20:28:12 - 1.27 +++ sys/arch/amd64/stand/libsa/biosdev.c6 Jun 2016 21:04:07 - @@ -671,7 +671,8 @@ biosdisk_err(u_int error) register const u_char *p = bidos_errs; while (*p && *p != error) - while (*p++); + while (*p++) + continue; return ++p; } @@ -703,7 +704,8 @@ biosdisk_errno(u_int error) if (error == 0) return 0; - for (p = tab; p->error && p->error != error; p++); + for (p = tab; p->error && p->error != error; p++) + continue; return p->errno; } Index: sys/arch/i386/stand/libsa/biosdev.c === RCS file: /home/OpenBSD/cvs/src/sys/arch/i386/stand/libsa/biosdev.c,v retrieving revision 1.92 diff -u -p -u -r1.92 biosdev.c --- sys/arch/i386/stand/libsa/biosdev.c 1 Oct 2015 20:28:12 - 1.92 +++ sys/arch/i386/stand/libsa/biosdev.c 6 Jun 2016 21:04:07 - @@ -672,7 +672,8 @@ biosdisk_err(u_int error) register const u_char *p = bidos_errs; while (*p && *p != error) - while (*p++); + while (*p++) + continue; return ++p; } @@ -704,7 +705,8 @@ biosdisk_errno(u_int error) if (error == 0) return 0; - for (p = tab; p->error && p->error != error; p++); + for (p = tab; p->error && p->error != error; p++) + continue; return p->errno; }