Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/dev Misc KNF and cosmetics.
details: https://anonhg.NetBSD.org/src/rev/a0ba65f0070e
branches: trunk
changeset: 372433:a0ba65f0070e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Nov 26 00:25:36 2022 +0000
description:
Misc KNF and cosmetics.
No binary change.
diffstat:
sys/arch/hp300/dev/mt.c | 227 ++++++++++++++++++++++----------------------
sys/arch/hp300/dev/mtreg.h | 4 +-
2 files changed, 117 insertions(+), 114 deletions(-)
diffs (truncated from 638 to 300 lines):
diff -r 8dcc4eb086e2 -r a0ba65f0070e sys/arch/hp300/dev/mt.c
--- a/sys/arch/hp300/dev/mt.c Fri Nov 25 22:17:20 2022 +0000
+++ b/sys/arch/hp300/dev/mt.c Sat Nov 26 00:25:36 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.55 2021/07/05 14:03:46 tsutsui Exp $ */
+/* $NetBSD: mt.c,v 1.56 2022/11/26 00:25:36 tsutsui Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.55 2021/07/05 14:03:46 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.56 2022/11/26 00:25:36 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -86,7 +86,7 @@
#include "ioconf.h"
static const struct mtinfo {
- u_short hwid;
+ uint16_t hwid;
const char *desc;
} mtinfo[] = {
{ MT7978ID, "7978" },
@@ -103,8 +103,8 @@
int sc_hpibno; /* logical HPIB this slave it attached to */
int sc_slave; /* HPIB slave address (0-6) */
short sc_flags; /* see below */
- u_char sc_lastdsj; /* place for DSJ in mtreaddsj() */
- u_char sc_lastecmd; /* place for End Command in mtreaddsj() */
+ uint8_t sc_lastdsj; /* place for DSJ in mtreaddsj() */
+ uint8_t sc_lastecmd; /* place for End Command in mtreaddsj() */
short sc_recvtimeo; /* count of hpibsend timeouts to prevent hang */
short sc_statindex; /* index for next sc_stat when MTF_STATTIMEO */
struct mt_stat sc_stat;/* status bytes last read from device */
@@ -247,10 +247,10 @@
{
int retval;
- if (sc->sc_flags & MTF_STATTIMEO)
+ if ((sc->sc_flags & MTF_STATTIMEO) != 0)
goto getstats;
retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_DSJTIMEO) ? -1 : sc->sc_slave,
+ (sc->sc_flags & MTF_DSJTIMEO) != 0 ? -1 : sc->sc_slave,
MTT_DSJ, &(sc->sc_lastdsj), 1);
sc->sc_flags &= ~MTF_DSJTIMEO;
if (retval != 1) {
@@ -270,24 +270,24 @@
sc->sc_lastdsj);
sc->sc_lastecmd = ecmd;
switch (sc->sc_lastdsj) {
- case 0:
+ case 0:
if (ecmd & MTE_DSJ_FORCE)
break;
return 0;
- case 2:
+ case 2:
sc->sc_lastecmd = MTE_COMPLETE;
- case 1:
+ case 1:
break;
- default:
+ default:
log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", device_xname(sc->sc_dev),
sc->sc_lastdsj);
return -1;
}
getstats:
retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_STATCONT) ? -1 : sc->sc_slave,
+ (sc->sc_flags & MTF_STATCONT) != 0 ? -1 : sc->sc_slave,
MTT_STAT, ((char *)&(sc->sc_stat)) + sc->sc_statindex,
sizeof(sc->sc_stat) - sc->sc_statindex);
sc->sc_flags &= ~(MTF_STATTIMEO | MTF_STATCONT);
@@ -312,9 +312,9 @@
device_xname(sc->sc_dev),
sc->sc_stat1, sc->sc_stat2, sc->sc_stat3,
sc->sc_stat4, sc->sc_stat5, sc->sc_stat6);
- if (sc->sc_lastecmd)
+ if (sc->sc_lastecmd != 0)
(void) hpibsend(sc->sc_hpibno, sc->sc_slave,
- MTL_ECMD, &(sc->sc_lastecmd), 1);
+ MTL_ECMD, &sc->sc_lastecmd, 1);
return (int)sc->sc_lastdsj;
}
@@ -334,7 +334,7 @@
dlog(LOG_DEBUG, "%s open: flags 0x%x", device_xname(sc->sc_dev),
sc->sc_flags);
- if (sc->sc_flags & MTF_OPEN)
+ if ((sc->sc_flags & MTF_OPEN) != 0)
return EBUSY;
sc->sc_flags |= MTF_OPEN;
sc->sc_ttyp = tprintf_open(l->l_proc);
@@ -348,7 +348,7 @@
for (;;) {
if ((error = mtcommand(dev, MTNOP, 0)) != 0)
goto errout;
- if (!(sc->sc_flags & MTF_REW))
+ if ((sc->sc_flags & MTF_REW) == 0)
break;
error = kpause("mt", true, hz, NULL);
if (error != 0 && error != EWOULDBLOCK) {
@@ -356,11 +356,11 @@
goto errout;
}
}
- if ((flag & FWRITE) && (sc->sc_stat1 & SR1_RO)) {
+ if ((flag & FWRITE) != 0 && (sc->sc_stat1 & SR1_RO) != 0) {
error = EROFS;
goto errout;
}
- if (!(sc->sc_stat1 & SR1_ONLINE)) {
+ if ((sc->sc_stat1 & SR1_ONLINE) == 0) {
uprintf("%s: not online\n", device_xname(sc->sc_dev));
error = EIO;
goto errout;
@@ -395,16 +395,15 @@
(sc->sc_stat3 & SR3_800) ? T_800BPI : -1));
req_den = (dev & T_DENSEL);
- if (flag & FWRITE) {
- if (!(sc->sc_stat1 & SR1_BOT)) {
+ if ((flag & FWRITE) != 0) {
+ if ((sc->sc_stat1 & SR1_BOT) == 0) {
if (sc->sc_density != req_den) {
uprintf("%s: can't change density mid-tape\n",
device_xname(sc->sc_dev));
error = EIO;
goto errout;
}
- }
- else {
+ } else {
int mtset_density =
(req_den == T_800BPI ? MTSET800BPI : (
req_den == T_1600BPI ? MTSET1600BPI : (
@@ -417,7 +416,7 @@
}
}
return 0;
-errout:
+ errout:
sc->sc_flags &= ~MTF_OPEN;
return error;
}
@@ -427,12 +426,12 @@
{
struct mt_softc *sc = device_lookup_private(&mt_cd,UNIT(dev));
- if (sc->sc_flags & MTF_WRT) {
- (void) mtcommand(dev, MTWEOF, 2);
- (void) mtcommand(dev, MTBSF, 0);
+ if ((sc->sc_flags & MTF_WRT) != 0) {
+ (void)mtcommand(dev, MTWEOF, 2);
+ (void)mtcommand(dev, MTBSF, 0);
}
if ((minor(dev) & T_NOREWIND) == 0)
- (void) mtcommand(dev, MTREW, 0);
+ (void)mtcommand(dev, MTREW, 0);
sc->sc_flags &= ~MTF_OPEN;
tprintf_close(sc->sc_ttyp);
return 0;
@@ -485,14 +484,14 @@
}
#endif
s = 16 * 1024;
- if (sc->sc_stat2 & SR2_LONGREC) {
+ if ((sc->sc_stat2 & SR2_LONGREC) != 0) {
switch (sc->sc_density) {
- case T_1600BPI:
+ case T_1600BPI:
s = 32 * 1024;
break;
- case T_6250BPI:
- case T_BADBPI:
+ case T_6250BPI:
+ case T_BADBPI:
s = 60 * 1024;
break;
}
@@ -502,7 +501,7 @@
"%s: write record (%d) too big: limit (%d)\n",
device_xname(sc->sc_dev), bp->b_bcount, s);
#if 0 /* XXX see above */
- error:
+ error:
#endif
bp->b_error = EIO;
biodone(bp);
@@ -552,8 +551,8 @@
{
struct mt_softc *sc = arg;
struct buf *bp;
- short cmdcount = 1;
- u_char cmdbuf[2];
+ short cmdcount = 1;
+ uint8_t cmdbuf[2];
dlog(LOG_DEBUG, "%s start", device_xname(sc->sc_dev));
sc->sc_flags &= ~MTF_WRT;
@@ -562,103 +561,104 @@
((bp->b_flags & B_CMD) == 0 || bp->b_cmd != MTRESET))
goto fatalerror;
- if (sc->sc_flags & MTF_REW) {
+ if ((sc->sc_flags & MTF_REW) != 0) {
if (!hpibpptest(sc->sc_hpibno, sc->sc_slave))
goto stillrew;
switch (mtreaddsj(sc, MTE_DSJ_FORCE|MTE_COMPLETE|MTE_IDLE)) {
- case 0:
- case 1:
+ case 0:
+ case 1:
stillrew:
- if ((sc->sc_stat1 & SR1_BOT) ||
- !(sc->sc_stat1 & SR1_ONLINE)) {
+ if ((sc->sc_stat1 & SR1_BOT) != 0 ||
+ (sc->sc_stat1 & SR1_ONLINE) == 0) {
sc->sc_flags &= ~MTF_REW;
break;
}
- case -2:
+ case -2:
/*
* -2 means "timeout" reading DSJ, which is probably
* temporary. This is considered OK when doing a NOP,
* but not otherwise.
*/
- if (sc->sc_flags & (MTF_DSJTIMEO | MTF_STATTIMEO)) {
+ if ((sc->sc_flags &
+ (MTF_DSJTIMEO | MTF_STATTIMEO)) != 0) {
callout_reset(&sc->sc_start_ch, hz >> 5,
spl_mtstart, sc);
return;
}
- case 2:
+ case 2:
if (bp->b_cmd != MTNOP || !(bp->b_flags & B_CMD)) {
bp->b_error = EBUSY;
goto done;
}
goto done;
- default:
+ default:
goto fatalerror;
}
}
- if (bp->b_flags & B_CMD) {
- if (sc->sc_flags & MTF_PASTEOT) {
+ if ((bp->b_flags & B_CMD) != 0) {
+ if ((sc->sc_flags & MTF_PASTEOT) != 0) {
switch(bp->b_cmd) {
- case MTFSF:
- case MTWEOF:
- case MTFSR:
+ case MTFSF:
+ case MTWEOF:
+ case MTFSR:
bp->b_error = ENOSPC;
goto done;
- case MTBSF:
- case MTOFFL:
- case MTBSR:
- case MTREW:
+ case MTBSF:
+ case MTOFFL:
+ case MTBSR:
+ case MTREW:
sc->sc_flags &= ~(MTF_PASTEOT | MTF_ATEOT);
break;
}
}
switch(bp->b_cmd) {
- case MTFSF:
- if (sc->sc_flags & MTF_HITEOF)
+ case MTFSF:
+ if ((sc->sc_flags & MTF_HITEOF) != 0)
goto done;
cmdbuf[0] = MTTC_FSF;
break;
- case MTBSF:
- if (sc->sc_flags & MTF_HITBOF)
+ case MTBSF:
+ if ((sc->sc_flags & MTF_HITBOF) != 0)
goto done;
cmdbuf[0] = MTTC_BSF;
break;
Home |
Main Index |
Thread Index |
Old Index