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/1eebce483962
branches:  trunk
changeset: 753761:1eebce483962
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Apr 09 12:09:29 2010 +0000

description:
- misc KNF
- remove `register' keyword from variable declarations

diffstat:

 sys/arch/atari/dev/zs.c    |  699 ++++++++++++++++++++++----------------------
 sys/arch/atari/dev/zsvar.h |   20 +-
 2 files changed, 365 insertions(+), 354 deletions(-)

diffs (truncated from 1206 to 300 lines):

diff -r e36c9e5c7a38 -r 1eebce483962 sys/arch/atari/dev/zs.c
--- a/sys/arch/atari/dev/zs.c   Fri Apr 09 11:47:17 2010 +0000
+++ b/sys/arch/atari/dev/zs.c   Fri Apr 09 12:09:29 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $  */
+/*     $NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.65 2010/04/09 11:30:19 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.66 2010/04/09 12:09:29 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,16 +122,16 @@
  * Software state per found chip.
  */
 struct zs_softc {
-    struct     device          zi_dev;    /* base device                 */
-    volatile struct zsdevice   *zi_zs;    /* chip registers              */
-    struct     zs_chanstate    zi_cs[2];  /* chan A and B software state */
+       struct  device          zi_dev;    /* base device                 */
+       volatile struct zsdevice *zi_zs;   /* chip registers              */
+       struct  zs_chanstate    zi_cs[2];  /* chan A and B software state */
 };
 
 static void    *zs_softint_cookie;     /* for callback */
 /*
  * Define the registers for a closed port
  */
-static u_char zs_init_regs[16] = {
+static uint8_t zs_init_regs[16] = {
 /*  0 */       0,
 /*  1 */       0,
 /*  2 */       0x60,
@@ -258,18 +258,18 @@
 static int     zsparam(struct tty *, struct termios *);
 static int     zsbaudrate(int, int, int *, int *, int *, int *);
 static int     zs_modem(struct zs_chanstate *, int, int);
-static void    zs_loadchannelregs(volatile struct zschan *, u_char *);
+static void    zs_loadchannelregs(volatile struct zschan *, uint8_t *);
 static void    zs_shutdown(struct zs_chanstate *);
 
 static int
 zsmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
 {
-       static int      zs_matched = 0;
+       static int zs_matched = 0;
 
-       if(strcmp("zs", auxp) || zs_matched)
-               return(0);
+       if (strcmp("zs", auxp) || zs_matched)
+               return 0;
        zs_matched = 1;
-       return(1);
+       return 1;
 }
 
 /*
@@ -278,10 +278,10 @@
 static void
 zsattach(struct device *parent, struct device *dev, void *aux)
 {
-       register struct zs_softc                *zi;
-       register struct zs_chanstate            *cs;
-       register volatile struct zsdevice       *addr;
-                char                           tmp;
+       struct zs_softc *zi;
+       struct zs_chanstate *cs;
+       volatile struct zsdevice *addr;
+       uint8_t tmp;
 
        addr      = (struct zsdevice *)AD_SCC;
        zi        = (struct zs_softc *)dev;
@@ -309,7 +309,7 @@
        zs_loadchannelregs(&addr->zs_chan[ZS_CHAN_A], zs_init_regs);
        zs_loadchannelregs(&addr->zs_chan[ZS_CHAN_B], zs_init_regs);
 
-       if(machineid & ATARI_TT) {
+       if (machineid & ATARI_TT) {
                /*
                 * ininitialise TT-MFP timer C: 307200Hz
                 * timer C and D share one control register:
@@ -358,28 +358,28 @@
 int
 zsopen(dev_t dev, int flags, int mode, struct lwp *l)
 {
-       register struct tty             *tp;
-       register struct zs_chanstate    *cs;
-                struct zs_softc        *zi;
-                int                    unit = ZS_UNIT(dev);
-                int                    zs = unit >> 1;
-                int                    error, s;
+       struct tty *tp;
+       struct zs_chanstate *cs;
+       struct zs_softc *zi;
+       int unit = ZS_UNIT(dev);
+       int zs = unit >> 1;
+       int error, s;
 
        zi = device_lookup_private(&zs_cd, zs);
        if (zi == NULL)
-               return (ENXIO);
+               return ENXIO;
        cs = &zi->zi_cs[unit & 1];
 
        /*
         * When port A (ser02) is selected on the TT, make sure
         * the port is enabled.
         */
-       if((machineid & ATARI_TT) && !(unit & 1))
+       if ((machineid & ATARI_TT) && !(unit & 1))
                ym2149_ser2(1);
 
        if (cs->cs_rbuf == NULL) {
                cs->cs_rbuf = malloc(ZLRB_RING_SIZE * sizeof(int), M_DEVBUF,
-                                                                  M_WAITOK);
+                   M_WAITOK);
        }
 
        tp = cs->cs_ttyp;
@@ -392,14 +392,14 @@
        }
 
        if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
-               return (EBUSY);
+               return EBUSY;
 
        s  = spltty();
 
        /*
         * Do the following iff this is a first open.
         */
-       if (!(tp->t_state & TS_ISOPEN) && tp->t_wopen == 0) {
+       if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
                if(tp->t_ispeed == 0) {
                        tp->t_iflag = TTYDEF_IFLAG;
                        tp->t_oflag = TTYDEF_OFLAG;
@@ -421,7 +421,7 @@
                 */
                zs_modem(cs, ZSWR5_RTS|ZSWR5_DTR, DMSET);
                /* May never get a status intr. if DCD already on. -gwr */
-               if((cs->cs_rr0 = cs->cs_zc->zc_csr) & ZSRR0_DCD)
+               if (((cs->cs_rr0 = cs->cs_zc->zc_csr) & ZSRR0_DCD) != 0)
                        tp->t_state |= TS_CARR_ON;
                if(cs->cs_softcar)
                        tp->t_state |= TS_CARR_ON;
@@ -434,19 +434,19 @@
                goto bad;
        
        error = tp->t_linesw->l_open(dev, tp);
-       if(error)
+       if (error)
                goto bad;
-       return (0);
+       return 0;
 
 bad:
-       if (!(tp->t_state & TS_ISOPEN) && tp->t_wopen == 0) {
+       if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
                /*
                 * We failed to open the device, and nobody else had it opened.
                 * Clean up the state as appropriate.
                 */
                zs_shutdown(cs);
        }
-       return(error);
+       return error;
 }
 
 /*
@@ -455,10 +455,10 @@
 int
 zsclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
-       register struct zs_chanstate    *cs;
-       register struct tty             *tp;
-                struct zs_softc        *zi;
-                int                    unit = ZS_UNIT(dev);
+       struct zs_chanstate *cs;
+       struct tty *tp;
+       struct zs_softc *zi;
+       int unit = ZS_UNIT(dev);
 
        zi = device_lookup_private(&zs_cd, unit >> 1);
        cs = &zi->zi_cs[unit & 1];
@@ -467,7 +467,7 @@
        tp->t_linesw->l_close(tp, flags);
        ttyclose(tp);
 
-       if (!(tp->t_state & TS_ISOPEN) && tp->t_wopen == 0) {
+       if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
                /*
                 * Although we got a last close, the device may still be in
                 * use; e.g. if this was the dialout node, and there are still
@@ -475,7 +475,7 @@
                 */
                zs_shutdown(cs);
        }
-       return (0);
+       return 0;
 }
 
 /*
@@ -484,62 +484,62 @@
 int
 zsread(dev_t dev, struct uio *uio, int flags)
 {
-       register struct zs_chanstate    *cs;
-       register struct zs_softc        *zi;
-       register struct tty             *tp;
-                int                    unit;
+       struct zs_chanstate *cs;
+       struct zs_softc *zi;
+       struct tty *tp;
+       int unit;
 
        unit = ZS_UNIT(dev);
        zi   = device_lookup_private(&zs_cd, unit >> 1);
        cs   = &zi->zi_cs[unit & 1];
        tp   = cs->cs_ttyp;
 
-       return(tp->t_linesw->l_read(tp, uio, flags));
+       return (*tp->t_linesw->l_read)(tp, uio, flags);
 }
 
 int
 zswrite(dev_t dev, struct uio *uio, int flags)
 {
-       register struct zs_chanstate    *cs;
-       register struct zs_softc        *zi;
-       register struct tty             *tp;
-                int                    unit;
+       struct zs_chanstate *cs;
+       struct zs_softc *zi;
+       struct tty *tp;
+       int unit;
 
        unit = ZS_UNIT(dev);
        zi   = device_lookup_private(&zs_cd, unit >> 1);
        cs   = &zi->zi_cs[unit & 1];
        tp   = cs->cs_ttyp;
 
-       return(tp->t_linesw->l_write(tp, uio, flags));
+       return (*tp->t_linesw->l_write)(tp, uio, flags);
 }
 
 int
 zspoll(dev_t dev, int events, struct lwp *l)
 {
-       register struct zs_chanstate    *cs;
-       register struct zs_softc        *zi;
-       register struct tty             *tp;
-                int                    unit;
+       struct zs_chanstate *cs;
+       struct zs_softc *zi;
+       struct tty *tp;
+       int unit;
 
        unit = ZS_UNIT(dev);
        zi   = device_lookup_private(&zs_cd, unit >> 1);
        cs   = &zi->zi_cs[unit & 1];
        tp   = cs->cs_ttyp;
  
-       return ((*tp->t_linesw->l_poll)(tp, events, l));
+       return (*tp->t_linesw->l_poll)(tp, events, l);
 }
 
 struct tty *
 zstty(dev_t dev)
 {
-       register struct zs_chanstate    *cs;
-       register struct zs_softc        *zi;
-                int                    unit;
+       struct zs_chanstate *cs;
+       struct zs_softc *zi;
+       int unit;
 
        unit = ZS_UNIT(dev);
        zi   = device_lookup_private(&zs_cd, unit >> 1);
        cs   = &zi->zi_cs[unit & 1];
-       return(cs->cs_ttyp);
+       return cs->cs_ttyp;
 }
 
 /*
@@ -557,65 +557,73 @@
 int
 zshard(long sr)
 {
-       register struct zs_chanstate    *a;
+       struct zs_chanstate *a;
 #define        b (a + 1)
-       register volatile struct zschan *zc;
-       register int                    rr3, intflags = 0, v, i;
+       volatile struct zschan *zc;



Home | Main Index | Thread Index | Old Index