Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari/dev Misc KNF.
details: https://anonhg.NetBSD.org/src/rev/c513c561535f
branches: trunk
changeset: 753751:c513c561535f
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Apr 09 10:04:35 2010 +0000
description:
Misc KNF.
diffstat:
sys/arch/atari/dev/ser.c | 314 ++++++++++++++++++++++++----------------------
1 files changed, 164 insertions(+), 150 deletions(-)
diffs (truncated from 727 to 300 lines):
diff -r 60954c8eca40 -r c513c561535f sys/arch/atari/dev/ser.c
--- a/sys/arch/atari/dev/ser.c Fri Apr 09 08:09:18 2010 +0000
+++ b/sys/arch/atari/dev/ser.c Fri Apr 09 10:04:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ser.c,v 1.45 2009/11/23 00:11:43 rmind Exp $ */
+/* $NetBSD: ser.c,v 1.46 2010/04/09 10:04:35 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.45 2009/11/23 00:11:43 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.46 2010/04/09 10:04:35 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_mbtype.h"
@@ -128,13 +128,15 @@
#define ym2149_dtr(set) { \
if (set) \
single_inst_bset_b(MFP->mf_gpip, 0x08); \
- else single_inst_bclr_b(MFP->mf_gpip, 0x08); \
+ else \
+ single_inst_bclr_b(MFP->mf_gpip, 0x08); \
}
#define ym2149_rts(set) { \
if (set) \
single_inst_bset_b(MFP->mf_gpip, 0x01); \
- else single_inst_bclr_b(MFP->mf_gpip, 0x01); \
+ else \
+ single_inst_bclr_b(MFP->mf_gpip, 0x01); \
}
#endif /* _MILANHW_ */
@@ -163,42 +165,42 @@
int sc_floods;
int sc_errors;
- u_char sc_hwflags;
- u_char sc_swflags;
+ uint8_t sc_hwflags;
+ uint8_t sc_swflags;
int sc_ospeed; /* delay + timer-d data */
- u_char sc_imra;
- u_char sc_imrb;
- u_char sc_ucr; /* Uart control */
- u_char sc_msr; /* Modem status */
- u_char sc_tsr; /* Tranceiver status */
- u_char sc_rsr; /* Receiver status */
- u_char sc_mcr; /* (Pseudo) Modem ctrl. */
+ uint8_t sc_imra;
+ uint8_t sc_imrb;
+ uint8_t sc_ucr; /* Uart control */
+ uint8_t sc_msr; /* Modem status */
+ uint8_t sc_tsr; /* Tranceiver status */
+ uint8_t sc_rsr; /* Receiver status */
+ uint8_t sc_mcr; /* (Pseudo) Modem ctrl. */
- u_char sc_msr_delta;
- u_char sc_msr_mask;
- u_char sc_mcr_active;
- u_char sc_mcr_dtr, sc_mcr_rts, sc_msr_cts, sc_msr_dcd;
+ uint8_t sc_msr_delta;
+ uint8_t sc_msr_mask;
+ uint8_t sc_mcr_active;
+ uint8_t sc_mcr_dtr, sc_mcr_rts, sc_msr_cts, sc_msr_dcd;
int sc_r_hiwat;
volatile u_int sc_rbget;
volatile u_int sc_rbput;
volatile u_int sc_rbavail;
- u_char sc_rbuf[RXBUFSIZE];
- u_char sc_lbuf[RXBUFSIZE];
+ uint8_t sc_rbuf[RXBUFSIZE];
+ uint8_t sc_lbuf[RXBUFSIZE];
- volatile u_char sc_rx_blocked;
- volatile u_char sc_rx_ready;
- volatile u_char sc_tx_busy;
- volatile u_char sc_tx_done;
- volatile u_char sc_tx_stopped;
- volatile u_char sc_st_check;
+ volatile uint8_t sc_rx_blocked;
+ volatile uint8_t sc_rx_ready;
+ volatile uint8_t sc_tx_busy;
+ volatile uint8_t sc_tx_done;
+ volatile uint8_t sc_tx_stopped;
+ volatile uint8_t sc_st_check;
- u_char *sc_tba;
+ uint8_t *sc_tba;
int sc_tbc;
int sc_heldtbc;
- volatile u_char sc_heldchange;
+ volatile uint8_t sc_heldchange;
void *sc_sicookie;
};
@@ -265,7 +267,7 @@
static int
sermatch(struct device *pdp, struct cfdata *cfp, void *auxp)
{
- static int ser_matched = 0;
+ static int ser_matched = 0;
/* Match at most one ser unit */
if (strcmp((char *)auxp, "ser") || ser_matched)
@@ -316,7 +318,7 @@
/*
* Activate serial console when DCD present...
*/
- if (!(MFP->mf_gpip & MCR_DCD))
+ if ((MFP->mf_gpip & MCR_DCD) == 0)
SET(sc->sc_hwflags, SER_HW_CONSOLE);
#endif /* SERCONSOLE > 0 */
@@ -363,7 +365,7 @@
sc = device_lookup_private(&ser_cd, unit);
if (sc == NULL)
- return (ENXIO);
+ return ENXIO;
if (!sc->sc_tty) {
tp = sc->sc_tty = ttymalloc();
@@ -372,7 +374,7 @@
tp = sc->sc_tty;
if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
- return (EBUSY);
+ return EBUSY;
s = spltty();
@@ -380,71 +382,70 @@
* Do the following if this is a first open.
*/
if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
- struct termios t;
+ struct termios t;
- /* Turn on interrupts. */
- sc->sc_imra = IA_RRDY|IA_RERR|IA_TRDY|IA_TERR;
- sc->sc_imrb = IB_SCTS|IB_SDCD;
- single_inst_bset_b(MFP->mf_imra, sc->sc_imra);
- single_inst_bset_b(MFP->mf_imrb, sc->sc_imrb);
+ /* Turn on interrupts. */
+ sc->sc_imra = IA_RRDY|IA_RERR|IA_TRDY|IA_TERR;
+ sc->sc_imrb = IB_SCTS|IB_SDCD;
+ single_inst_bset_b(MFP->mf_imra, sc->sc_imra);
+ single_inst_bset_b(MFP->mf_imrb, sc->sc_imrb);
- /* Fetch the current modem control status, needed later. */
- sc->sc_msr = ~MFP->mf_gpip & (IO_SDCD|IO_SCTS|IO_SRI);
+ /* Fetch the current modem control status, needed later. */
+ sc->sc_msr = ~MFP->mf_gpip & (IO_SDCD|IO_SCTS|IO_SRI);
- /* Add some entry points needed by the tty layer. */
- tp->t_oproc = serstart;
- tp->t_param = serparam;
- tp->t_hwiflow = serhwiflow;
- tp->t_dev = dev;
+ /* Add some entry points needed by the tty layer. */
+ tp->t_oproc = serstart;
+ tp->t_param = serparam;
+ tp->t_hwiflow = serhwiflow;
+ tp->t_dev = dev;
- /*
- * Initialize the termios status to the defaults. Add in the
- * sticky bits from TIOCSFLAGS.
- */
- t.c_ispeed = 0;
- if (ISSET(sc->sc_hwflags, SER_HW_CONSOLE)) {
- t.c_ospeed = CONSBAUD;
- t.c_cflag = CONSCFLAG;
- }
- else {
- t.c_ospeed = TTYDEF_SPEED;
- t.c_cflag = TTYDEF_CFLAG;
- }
- if (ISSET(sc->sc_swflags, TIOCFLAG_CLOCAL))
- SET(t.c_cflag, CLOCAL);
- if (ISSET(sc->sc_swflags, TIOCFLAG_CRTSCTS))
- SET(t.c_cflag, CRTSCTS);
- if (ISSET(sc->sc_swflags, TIOCFLAG_MDMBUF))
- SET(t.c_cflag, MDMBUF);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- ttychars(tp);
- (void) serparam(tp, &t);
- ttsetwater(tp);
+ /*
+ * Initialize the termios status to the defaults. Add in the
+ * sticky bits from TIOCSFLAGS.
+ */
+ t.c_ispeed = 0;
+ if (ISSET(sc->sc_hwflags, SER_HW_CONSOLE)) {
+ t.c_ospeed = CONSBAUD;
+ t.c_cflag = CONSCFLAG;
+ } else {
+ t.c_ospeed = TTYDEF_SPEED;
+ t.c_cflag = TTYDEF_CFLAG;
+ }
+ if (ISSET(sc->sc_swflags, TIOCFLAG_CLOCAL))
+ SET(t.c_cflag, CLOCAL);
+ if (ISSET(sc->sc_swflags, TIOCFLAG_CRTSCTS))
+ SET(t.c_cflag, CRTSCTS);
+ if (ISSET(sc->sc_swflags, TIOCFLAG_MDMBUF))
+ SET(t.c_cflag, MDMBUF);
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ ttychars(tp);
+ (void)serparam(tp, &t);
+ ttsetwater(tp);
- s2 = splhigh();
+ s2 = splhigh();
- /*
- * Turn on DTR. We must always do this, even if carrier is not
- * present, because otherwise we'd have to use TIOCSDTR
- * immediately after setting CLOCAL. We will drop DTR only on
- * the next high-low transition of DCD, or by explicit request.
- */
- ser_modem(sc, 1);
+ /*
+ * Turn on DTR. We must always do this, even if carrier is not
+ * present, because otherwise we'd have to use TIOCSDTR
+ * immediately after setting CLOCAL. We will drop DTR only on
+ * the next high-low transition of DCD, or by explicit request.
+ */
+ ser_modem(sc, 1);
- /* Clear the input ring, and unblock. */
- sc->sc_rbput = sc->sc_rbget = 0;
- sc->sc_rbavail = RXBUFSIZE;
- ser_iflush(sc);
- sc->sc_rx_blocked = 0;
- ser_hwiflow(sc, 0);
+ /* Clear the input ring, and unblock. */
+ sc->sc_rbput = sc->sc_rbget = 0;
+ sc->sc_rbavail = RXBUFSIZE;
+ ser_iflush(sc);
+ sc->sc_rx_blocked = 0;
+ ser_hwiflow(sc, 0);
#ifdef SER_DEBUG
- serstatus(sc, "seropen ");
+ serstatus(sc, "seropen ");
#endif
- splx(s2);
+ splx(s2);
}
splx(s);
@@ -457,7 +458,7 @@
if (error)
goto bad;
- return (0);
+ return 0;
bad:
if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
@@ -468,7 +469,7 @@
ser_shutdown(sc);
}
- return (error);
+ return error;
}
int
@@ -480,7 +481,7 @@
/* XXX This is for cons.c. */
if (!ISSET(tp->t_state, TS_ISOPEN))
- return (0);
+ return 0;
(*tp->t_linesw->l_close)(tp, flag);
ttyclose(tp);
@@ -494,7 +495,7 @@
ser_shutdown(sc);
}
- return (0);
+ return 0;
}
int
@@ -503,7 +504,7 @@
Home |
Main Index |
Thread Index |
Old Index