Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/stand/boot Misc KNF and cosmetics.
details: https://anonhg.NetBSD.org/src/rev/090a4c696f5e
branches: trunk
changeset: 336126:090a4c696f5e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Feb 14 05:58:02 2015 +0000
description:
Misc KNF and cosmetics.
diffstat:
sys/arch/luna68k/stand/boot/bmc.c | 4 +-
sys/arch/luna68k/stand/boot/bmd.c | 27 ++++++++++++++--------
sys/arch/luna68k/stand/boot/cons.c | 6 +++-
sys/arch/luna68k/stand/boot/devopen.c | 10 ++++----
sys/arch/luna68k/stand/boot/disklabel.c | 26 ++++++++++----------
sys/arch/luna68k/stand/boot/machdep.c | 5 ++-
sys/arch/luna68k/stand/boot/sc.c | 40 ++++++++++++++++----------------
sys/arch/luna68k/stand/boot/scsi.c | 12 ++++----
8 files changed, 70 insertions(+), 60 deletions(-)
diffs (truncated from 470 to 300 lines):
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/bmc.c
--- a/sys/arch/luna68k/stand/boot/bmc.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/bmc.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bmc.c,v 1.5 2014/01/11 15:51:02 tsutsui Exp $ */
+/* $NetBSD: bmc.c,v 1.6 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -124,7 +124,7 @@
POP_RBUF(unit, c);
#if 1
- return c ;
+ return c;
#else
return siocngetc(dev);
#endif
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/bmd.c
--- a/sys/arch/luna68k/stand/boot/bmd.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/bmd.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bmd.c,v 1.5 2015/02/14 05:03:09 tsutsui Exp $ */
+/* $NetBSD: bmd.c,v 1.6 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -290,8 +290,11 @@
* adjust plane position
*/
- bp->bc_raddr = (uint8_t *)0xB10C0008; /* plane-0 hardware address */
- bp->bc_waddr = (uint8_t *)0xB1080008; /* common bitmap hardware address */
+ /* plane-0 hardware address */
+ bp->bc_raddr = (uint8_t *)0xB10C0008;
+ /* common bitmap hardware address */
+ bp->bc_waddr = (uint8_t *)0xB1080008;
+
rfcnt.p.rfc_hcnt = 7; /* shift left 16 dot */
rfcnt.p.rfc_vcnt = -27; /* shift down 1 dot */
*bmd_rfcnt = rfcnt.u;
@@ -324,7 +327,7 @@
bmd_erase_screen((uint32_t *)bp->bc_waddr); /* clear screen */
*bmd_bmsel = 0x01; /* 1 plane */
- /* turn on cursole */
+ /* turn on cursor */
bmd_reverse_char(bp->bc_raddr,
bp->bc_waddr,
bq->bl_col, bp->bc_row);
@@ -352,11 +355,13 @@
int i;
c &= 0x7F;
- /* turn off cursole */
+
+ /* turn off cursor */
bmd_reverse_char(bp->bc_raddr,
bp->bc_waddr,
bq->bl_col, bp->bc_row);
- /* do escape-sequence */
+
+ /* do escape-sequence */
if (bp->bc_stat & STAT_ESCAPE) {
*bp->bc_esc++ = c;
(*bp->bc_escape)(c);
@@ -412,7 +417,7 @@
bq->bl_col = bp->bc_xmin;
break;
- case 0x1b: /* ESC */
+ case 0x1B: /* ESC */
bp->bc_stat |= STAT_ESCAPE;
*bp->bc_esc++ = 0x1b;
break;
@@ -432,7 +437,7 @@
}
done:
- /* turn on cursole */
+ /* turn on cursor */
bmd_reverse_char(bp->bc_raddr,
bp->bc_waddr,
bq->bl_col, bp->bc_row);
@@ -446,14 +451,16 @@
struct bmd_softc *bp = &bmd_softc;
struct bmd_linec *bq = bp->bc_bl;
- bmd_erase_screen((uint32_t *)bp->bc_waddr); /* clear screen */
+ /* clear screen */
+ bmd_erase_screen((uint32_t *)bp->bc_waddr);
bq->bl_col = bq->bl_end = bp->bc_xmin;
bp->bc_row = bp->bc_ymin;
+ /* turn on cursor */
bmd_reverse_char(bp->bc_raddr,
bp->bc_waddr,
- bq->bl_col, bp->bc_row); /* turn on cursole */
+ bq->bl_col, bp->bc_row);
}
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/cons.c
--- a/sys/arch/luna68k/stand/boot/cons.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/cons.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cons.c,v 1.2 2014/01/11 15:51:02 tsutsui Exp $ */
+/* $NetBSD: cons.c,v 1.3 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -126,6 +126,7 @@
int
cngetc(void)
{
+
if (cn_tab == NULL)
return 0;
return (*cn_tab->cn_getc)(cn_tab->cn_dev);
@@ -134,9 +135,10 @@
void
cnputc(int c)
{
+
if (cn_tab == NULL)
return;
- if (c) {
+ if (c != 0) {
(*cn_tab->cn_putc)(cn_tab->cn_dev, c);
if (c == '\n')
(*cn_tab->cn_putc)(cn_tab->cn_dev, '\r');
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/devopen.c
--- a/sys/arch/luna68k/stand/boot/devopen.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/devopen.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.8 2014/04/21 11:06:55 tsutsui Exp $ */
+/* $NetBSD: devopen.c,v 1.9 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -138,7 +138,7 @@
for (cp = str, i = 0; *cp != '\0' && *cp != '(' && i < MAXDEVNAME; i++)
devname[i] = *cp++;
if (*cp != '(') {
- return (-1);
+ return -1;
}
devname[i] = '\0';
/* compare dev type name */
@@ -147,7 +147,7 @@
break;
cp++;
if (dp->dv_name == NULL) {
- return (-1);
+ return -1;
}
dev = dp - devsw;
/* get mixed controller and unit number */
@@ -164,7 +164,7 @@
#ifdef DEBUG
printf("%s: invalid unit number (%d)\n", __func__, unit);
#endif
- return (-1);
+ return -1;
}
if (!haveunit && strcmp(devname, default_bootdev) == 0)
unit = default_unit;
@@ -182,7 +182,7 @@
#ifdef DEBUG
printf("%s: invalid partition number (%d)\n", __func__, part);
#endif
- return (-1);
+ return -1;
}
/* check out end of dev spec */
*devp = dev;
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/disklabel.c
--- a/sys/arch/luna68k/stand/boot/disklabel.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/disklabel.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.7 2015/02/14 05:03:09 tsutsui Exp $ */
+/* $NetBSD: disklabel.c,v 1.8 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -111,9 +111,9 @@
int
disklabel(int argc, char *argv[])
{
- struct scd_dk_label *omp = (struct scd_dk_label *) lbl_buff;
+ struct scd_dk_label *omp = (struct scd_dk_label *)lbl_buff;
struct disklabel *bp = (struct disklabel *)&lbl_buff[LABELOFFSET];
- struct fs *fp = (struct fs *) lbl_buff;
+ struct fs *fp = (struct fs *)lbl_buff;
uint16_t *p;
u_long chksum, count;
char *q;
@@ -143,8 +143,8 @@
printf("Disk Label read error !!\n");
}
} else if (!strcmp(argv[1], "omron")) {
- i = (int) &omp->dkl_badchk;
- i -= (int) lbl_buff;
+ i = (int)&omp->dkl_badchk;
+ i -= (int)lbl_buff;
printf("Offset = %d\n", i);
printf("\n");
printf("Checksum of Bad Track:\t0x%x\n",
@@ -304,9 +304,9 @@
printf("checking Super Block: block size = %d bytes,"
" seek amount = 1 blocks\n", BLOCK_SIZE);
i = j = 0;
- while (1) {
- if (!scsi_read( i, lbl_buff, BLOCK_SIZE))
- break;
+ for (;;) {
+ if (scsi_read(i, lbl_buff, BLOCK_SIZE) == 0)
+ break;
if (fp->fs_magic == FS_MAGIC) {
printf("%d, (%d)\n", i, i - j);
@@ -315,11 +315,11 @@
i++;
}
} else if (!strcmp(argv[1], "sbcopy")) {
- if (!scsi_read(32, lbl_buff, BLOCK_SIZE)) {
+ if (scsi_read(32, lbl_buff, BLOCK_SIZE) == 0) {
printf("sbcopy: read failed\n");
return ST_ERROR;
}
- if (scsi_write(16, lbl_buff, BLOCK_SIZE)) {
+ if (scsi_write(16, lbl_buff, BLOCK_SIZE) != 0) {
printf("sbcopy: copy done\n");
} else {
printf("sbcopy: write failed\n");
@@ -399,15 +399,15 @@
printf("\t# (Cyl. %d",
pp->p_offset / lp->d_secpercyl);
if (pp->p_offset % lp->d_secpercyl)
- cnputc('*');
+ cnputc('*');
else
- cnputc(' ');
+ cnputc(' ');
printf("- %d",
(pp->p_offset +
pp->p_size + lp->d_secpercyl - 1) /
lp->d_secpercyl - 1);
if (pp->p_size % lp->d_secpercyl)
- cnputc('*');
+ cnputc('*');
printf(")\n");
}
}
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/machdep.c
--- a/sys/arch/luna68k/stand/boot/machdep.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/machdep.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.3 2014/04/16 11:18:00 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.4 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -79,6 +79,7 @@
void
straytrap(int addr)
{
+
printf("stray trap, addr 0x%x\n", addr);
}
@@ -93,7 +94,7 @@
int i;
i = *addr; if (i) return 0;
#endif
- nofault = (int *) &faultbuf;
+ nofault = (int *)&faultbuf;
if (setjmp((label_t *)nofault)) {
nofault = NULL;
return 1;
diff -r 06c3159eb35f -r 090a4c696f5e sys/arch/luna68k/stand/boot/sc.c
--- a/sys/arch/luna68k/stand/boot/sc.c Sat Feb 14 05:03:09 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/sc.c Sat Feb 14 05:58:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sc.c,v 1.12 2015/02/14 05:03:09 tsutsui Exp $ */
+/* $NetBSD: sc.c,v 1.13 2015/02/14 05:58:02 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -354,7 +354,7 @@
if (hd == NULL)
return 0;
- if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY))
+ if ((hd->scsi_ssts & (SSTS_INITIATOR | SSTS_TARGET | SSTS_BUSY)) != 0)
return 0;
hs->sc_flags = 0;
@@ -405,8 +405,7 @@
Home |
Main Index |
Thread Index |
Old Index