Module Name:    src
Committed By:   tsutsui
Date:           Sat Feb 14 05:58:03 UTC 2015

Modified Files:
        src/sys/arch/luna68k/stand/boot: bmc.c bmd.c cons.c devopen.c
            disklabel.c machdep.c sc.c scsi.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/stand/boot/bmc.c \
    src/sys/arch/luna68k/stand/boot/bmd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/cons.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/stand/boot/devopen.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/disklabel.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/stand/boot/sc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/scsi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/luna68k/stand/boot/bmc.c
diff -u src/sys/arch/luna68k/stand/boot/bmc.c:1.5 src/sys/arch/luna68k/stand/boot/bmc.c:1.6
--- src/sys/arch/luna68k/stand/boot/bmc.c:1.5	Sat Jan 11 15:51:02 2014
+++ src/sys/arch/luna68k/stand/boot/bmc.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ bmccngetc(dev_t dev)
 	POP_RBUF(unit, c);
 
 #if 1
-	return c ;
+	return c;
 #else
 	return siocngetc(dev);
 #endif
Index: src/sys/arch/luna68k/stand/boot/bmd.c
diff -u src/sys/arch/luna68k/stand/boot/bmd.c:1.5 src/sys/arch/luna68k/stand/boot/bmd.c:1.6
--- src/sys/arch/luna68k/stand/boot/bmd.c:1.5	Sat Feb 14 05:03:09 2015
+++ src/sys/arch/luna68k/stand/boot/bmd.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ bmdinit(void)
 	 *  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 @@ bmdinit(void)
 	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 @@ bmdputc(int c)
 	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 @@ bmdputc(int c)
 			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 @@ bmdputc(int c)
 	}
 
  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 @@ bmdclear(void)
 	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);
 }
 
 

Index: src/sys/arch/luna68k/stand/boot/cons.c
diff -u src/sys/arch/luna68k/stand/boot/cons.c:1.2 src/sys/arch/luna68k/stand/boot/cons.c:1.3
--- src/sys/arch/luna68k/stand/boot/cons.c:1.2	Sat Jan 11 15:51:02 2014
+++ src/sys/arch/luna68k/stand/boot/cons.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ cninit(void)
 int
 cngetc(void)
 {
+
 	if (cn_tab == NULL)
 		return 0;
 	return (*cn_tab->cn_getc)(cn_tab->cn_dev);
@@ -134,9 +135,10 @@ cngetc(void)
 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');

Index: src/sys/arch/luna68k/stand/boot/devopen.c
diff -u src/sys/arch/luna68k/stand/boot/devopen.c:1.8 src/sys/arch/luna68k/stand/boot/devopen.c:1.9
--- src/sys/arch/luna68k/stand/boot/devopen.c:1.8	Mon Apr 21 11:06:55 2014
+++ src/sys/arch/luna68k/stand/boot/devopen.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ make_device(const char *str, int *devp, 
 	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 @@ make_device(const char *str, int *devp, 
 			break;
 	cp++;
 	if (dp->dv_name == NULL) {
-		return (-1);
+		return -1;
 	}
 	dev = dp - devsw;
 	/* get mixed controller and unit number */
@@ -164,7 +164,7 @@ make_device(const char *str, int *devp, 
 #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 @@ make_device(const char *str, int *devp, 
 #ifdef DEBUG
 		printf("%s: invalid partition number (%d)\n", __func__, part);
 #endif
-		return (-1);
+		return -1;
 	}
 	/* check out end of dev spec */
 	*devp  = dev;

Index: src/sys/arch/luna68k/stand/boot/disklabel.c
diff -u src/sys/arch/luna68k/stand/boot/disklabel.c:1.7 src/sys/arch/luna68k/stand/boot/disklabel.c:1.8
--- src/sys/arch/luna68k/stand/boot/disklabel.c:1.7	Sat Feb 14 05:03:09 2015
+++ src/sys/arch/luna68k/stand/boot/disklabel.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ dkcksum(struct disklabel *lp)
 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 @@ disklabel(int argc, char *argv[])
 			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 @@ disklabel(int argc, char *argv[])
 		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 @@ disklabel(int argc, char *argv[])
 			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 @@ display(struct disklabel *lp)
 			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");
 		}
 	}

Index: src/sys/arch/luna68k/stand/boot/machdep.c
diff -u src/sys/arch/luna68k/stand/boot/machdep.c:1.3 src/sys/arch/luna68k/stand/boot/machdep.c:1.4
--- src/sys/arch/luna68k/stand/boot/machdep.c:1.3	Wed Apr 16 11:18:00 2014
+++ src/sys/arch/luna68k/stand/boot/machdep.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ static void dumpmem(int *, int, int);
 void
 straytrap(int addr)
 {
+
 	printf("stray trap, addr 0x%x\n", addr);
 }
 
@@ -93,7 +94,7 @@ badaddr(volatile void *addr)
 	int i;
 	i = *addr; if (i) return 0;
 #endif
-	nofault = (int *) &faultbuf;
+	nofault = (int *)&faultbuf;
 	if (setjmp((label_t *)nofault)) {
 		nofault = NULL;
 		return 1;

Index: src/sys/arch/luna68k/stand/boot/sc.c
diff -u src/sys/arch/luna68k/stand/boot/sc.c:1.12 src/sys/arch/luna68k/stand/boot/sc.c:1.13
--- src/sys/arch/luna68k/stand/boot/sc.c:1.12	Sat Feb 14 05:03:09 2015
+++ src/sys/arch/luna68k/stand/boot/sc.c	Sat Feb 14 05:58:02 2015
@@ -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 @@ scrun(int ctlr, int target, uint8_t *cdb
 	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 @@ scabort(struct scsi_softc *hs)
 	int len;
 
 	printf("sc%d: abort  phase=0x%x, ssts=0x%x, ints=0x%x\n",
-		hs->sc_ctlr, hd->scsi_psns, hd->scsi_ssts,
-		hd->scsi_ints);
+	    hs->sc_ctlr, hd->scsi_psns, hd->scsi_ssts, hd->scsi_ints);
 
 	if (hd->scsi_ints != 0)
 		hd->scsi_ints = hd->scsi_ints;
@@ -419,7 +418,8 @@ scabort(struct scsi_softc *hs)
 	len = (hd->scsi_tch << 16) | (hd->scsi_tcm << 8) | hd->scsi_tcl;
 
 	/* for that many bus cycles, try to send an abort msg */
-	for (len += 1024; (hd->scsi_ssts & SSTS_INITIATOR) && --len >= 0; ) {
+	for (len += 1024;
+	    ((hd->scsi_ssts & SSTS_INITIATOR)) != 0 && --len >= 0;) {
 		hd->scsi_scmd = SCMD_SET_ATN;
 
 		while ((hd->scsi_psns & PSNS_REQ) == 0) {
@@ -435,14 +435,14 @@ scabort(struct scsi_softc *hs)
 		if (hd->scsi_psns & PHASE_IO) {
 			/* one of the input phases - read & discard a byte */
 			hd->scsi_scmd = SCMD_SET_ACK;
-			while (hd->scsi_psns & PSNS_REQ)
+			while ((hd->scsi_psns & PSNS_REQ) != 0)
 				DELAY(1);
 			(void)hd->scsi_temp;
 		} else {
 			/* one of the output phases - send an abort msg */
 			hd->scsi_temp = MSG_ABORT;
 			hd->scsi_scmd = SCMD_SET_ACK;
-			while (hd->scsi_psns & PSNS_REQ)
+			while ((hd->scsi_psns & PSNS_REQ) != 0)
 				DELAY(1);
 		}
 
@@ -456,7 +456,7 @@ out:
 	 */
 	if (len < 0 && hs)
 		printf("sc%d: abort failed.  phase=0x%x, ssts=0x%x\n",
-			hs->sc_ctlr, hd->scsi_psns, hd->scsi_ssts);
+		    hs->sc_ctlr, hd->scsi_psns, hd->scsi_ssts);
 }
 
 
@@ -477,7 +477,7 @@ scsi_test_unit_rdy(int ctlr, int target,
 
 	cdb.lun = lun;
 
-	if (!(scrun(ctlr, target, (void *)&cdb, 6, NULL, 0, &lock))) {
+	if (scrun(ctlr, target, (void *)&cdb, 6, NULL, 0, &lock) == 0) {
 #ifdef DEBUG
 		printf("scsi_test_unit_rdy: Command Transfer Failed.\n");
 #endif
@@ -522,7 +522,7 @@ scsi_request_sense(int ctlr, int target,
 	cdb.lun = lun;
 	cdb.len = len;
 
-	if (!(scrun(ctlr, target, (void *)&cdb, 6, buf, len, &lock))) {
+	if (scrun(ctlr, target, (void *)&cdb, 6, buf, len, &lock) == 0) {
 #ifdef DEBUG
 		printf("scsi_request_sense: Command Transfer Failed.\n");
 #endif
@@ -553,13 +553,13 @@ scsi_immed_command(int ctlr, int target,
 
 #ifdef DEBUG
 	printf("scsi_immed_command( %d, %d, %d, cdb(%d), buf, %d): Start\n",
-	       ctlr, target, lun, cdb->len, len);
+	    ctlr, target, lun, cdb->len, len);
 #endif
 
 	cdb->cdb[1] |= lun << 5;
 
-	if (!(scrun(ctlr, target, (void *)&cdb->cdb[0], cdb->len, buf, len,
-	    &lock))) {
+	if (scrun(ctlr, target, (void *)&cdb->cdb[0], cdb->len, buf, len,
+	    &lock) == 0) {
 #ifdef DEBUG
 		printf("scsi_immed_command: Command Transfer Failed.\n");
 #endif
@@ -597,7 +597,7 @@ scsi_format_unit(int ctlr, int target, i
 
 	cdb.lun = lun;
 
-	if (!(scrun(ctlr, target, (void *)&cdb, 6, NULL, 0, &lock))) {
+	if (scrun(ctlr, target, (void *)&cdb, 6, NULL, 0, &lock) == 0) {
 #ifdef DEBUG
 		printf("scsi_format_unit: Command Transfer Failed.\n");
 #endif
@@ -657,8 +657,7 @@ scintr(void)
  get_intr:
 #ifdef DEBUG
 	printf("scintr: INTS 0x%x, SSTS 0x%x,  PCTL 0x%x,  PSNS 0x%x    0x%x\n",
-	        ints, hd->scsi_ssts, hd->scsi_pctl, hd->scsi_psns,
-	        hs->sc_phase);
+	    ints, hd->scsi_ssts, hd->scsi_pctl, hd->scsi_psns, hs->sc_phase);
 #endif
 	if (ints & INTS_RESEL) {
 		if (hs->sc_phase == BUS_FREE_PHASE) {
@@ -675,12 +674,13 @@ scintr(void)
 		    (hs->sc_msg[0] == MSG_DISCONNECT)) {
 			hs->sc_phase  = BUS_FREE_PHASE;
 			hs->sc_target = SCSI_ID;
-			if (hs->sc_msg[0] == MSG_CMD_COMPLETE)
+			if (hs->sc_msg[0] == MSG_CMD_COMPLETE) {
 				/* SCSI IO complete */
 				*(hs->sc_lock) = SC_IO_COMPLETE;
-			else
-				/* Cisconnected from Target */
+			} else {
+				/* Disconnected from Target */
 				*(hs->sc_lock) = SC_DISCONNECTED;
+			}
 			hd->scsi_ints = ints;
 			return 0;
 		} else
@@ -705,7 +705,7 @@ scintr(void)
 				hs->sc_flags &= ~SC_SEL_TIMEOUT;
 				hs->sc_phase  = BUS_FREE_PHASE;
 				hs->sc_target = SCSI_ID;
-				/* Such SCSI Device is not conected. */
+				/* Such SCSI Device is not connected. */
 				*(hs->sc_lock) = SC_DEV_NOT_FOUND;
 				hd->scsi_ints = ints;
 				return 0;

Index: src/sys/arch/luna68k/stand/boot/scsi.c
diff -u src/sys/arch/luna68k/stand/boot/scsi.c:1.6 src/sys/arch/luna68k/stand/boot/scsi.c:1.7
--- src/sys/arch/luna68k/stand/boot/scsi.c:1.6	Sat Feb 14 05:03:09 2015
+++ src/sys/arch/luna68k/stand/boot/scsi.c	Sat Feb 14 05:58:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsi.c,v 1.6 2015/02/14 05:03:09 tsutsui Exp $	*/
+/*	$NetBSD: scsi.c,v 1.7 2015/02/14 05:58:02 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -118,7 +118,7 @@ scsi(int argc, char *argv[])
 			for (p = argv[2]; *p != '\0' ; p++) {
 				i = i * 10 + *p - '0';
 			}
-			if ( i < 8 && i >= 0) {
+			if (i < 8 && i >= 0) {
 				scsi_device = i;
 			}
 		}
@@ -156,14 +156,14 @@ scsi(int argc, char *argv[])
 		if (scsi_immed_command(   0, scsi_device,   0, &capacity,
 		    (uint8_t *)&capacitybuf, sizeof(capacitybuf)) == 0) {
 			printf("Logical Block Address:\t%ld (0x%lx)\n",
-			       capacitybuf[0], capacitybuf[0]);
+			    capacitybuf[0], capacitybuf[0]);
 			printf("Block Length:\t\t%ld (0x%lx)\n",
-			       capacitybuf[1], capacitybuf[1]);
+			    capacitybuf[1], capacitybuf[1]);
 		}
 	} else if (!strcmp(argv[1], "trace")) {
 		for (i = 0; i < 7; i++) {
 			printf("SCSI ID %d .... ", i);
-			status = scsi_test_unit_rdy( 0, i, 0);
+			status = scsi_test_unit_rdy(0, i, 0);
 			if (status >= 0)
 				printf("found.\n");
 			else
@@ -182,7 +182,7 @@ scsi(int argc, char *argv[])
 		}
 
 		if ((i == 'y') || (i == 'Y'))
-			status = scsi_format_unit( 0, scsi_device, 0);
+			status = scsi_format_unit(0, scsi_device, 0);
 	}
 
 	return ST_NORMAL;

Reply via email to