diff --git a/sys/arch/arm/sa11x0/sa1111.c b/sys/arch/arm/sa11x0/sa1111.c index 9498accb5238..62ee6ef9d6d6 100644 --- a/sys/arch/arm/sa11x0/sa1111.c +++ b/sys/arch/arm/sa11x0/sa1111.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa1111.c,v 1.17 2006/03/04 17:24:13 peter Exp $ */ +/* $NetBSD: sa1111.c,v 1.18 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -38,11 +38,11 @@ /* * TODO: - * - introduce bus abstraction to support SA1101 + * - introduce bus abstraction to support SA-1101 */ #include -__KERNEL_RCSID(0, "$NetBSD: sa1111.c,v 1.17 2006/03/04 17:24:13 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa1111.c,v 1.18 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -63,11 +63,10 @@ __KERNEL_RCSID(0, "$NetBSD: sa1111.c,v 1.17 2006/03/04 17:24:13 peter Exp $"); #include "locators.h" -static int sa1111_print(void *, const char *); +static int sa1111_print(void *, const char *); static void sacc_intr_calculatemasks(struct sacc_softc *); static void sacc_intr_setpolarity(sacc_chipset_tag_t *, int , int); -int sacc_intr(void *); #if !defined(__HAVE_GENERIC_SOFT_INTERRUPTS) void *softintr_establish(int, int (*)(void *), void *); @@ -88,15 +87,15 @@ sacc_probe(struct device *parent, struct cfdata *match, void *aux) uint32_t skid; if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &ioh)) - return (0); + return 0; skid = bus_space_read_4(sa->sa_iot, ioh, SACCSBI_SKID); bus_space_unmap(sa->sa_iot, ioh, sa->sa_size); if ((skid & 0xffffff00) != 0x690cc200) - return (0); + return 0; - return (1); + return 1; } @@ -123,7 +122,8 @@ sa1111_search(struct device *parent, struct cfdata *cf, const int *ldesc, static int sa1111_print(void *aux, const char *name) { - return (UNCONF); + + return UNCONF; } @@ -141,7 +141,7 @@ sacc_intr_establish(sacc_chipset_tag_t *ic, int irq, int type, int level, panic("sacc_intr_establish: can't malloc handler info"); if (irq < 0 || irq > SACCIC_LEN || - ! (type == IST_EDGE_RAISE || type == IST_EDGE_FALL)) + !(type == IST_EDGE_RAISE || type == IST_EDGE_FALL)) panic("sacc_intr_establish: bogus irq or type"); if (sc->sc_intrhand[irq] == NULL) { @@ -162,7 +162,7 @@ sacc_intr_establish(sacc_chipset_tag_t *ic, int irq, int type, int level, /* map interrupt level to appropriate softinterrupt level */ if (level >= IPL_SOFTSERIAL) level = IPL_SOFTSERIAL; - else if(level >= IPL_SOFTNET) + else if (level >= IPL_SOFTNET) level = IPL_SOFTNET; ih->ih_soft = softintr_establish(level, (void (*)(void *)) ih_fun, ih_arg); @@ -171,15 +171,15 @@ sacc_intr_establish(sacc_chipset_tag_t *ic, int irq, int type, int level, ih->ih_next = NULL; s = splhigh(); - for(p = &sc->sc_intrhand[irq]; *p; p = &(*p)->ih_next) - ; + for (p = &sc->sc_intrhand[irq]; *p; p = &(*p)->ih_next) + continue; *p = ih; sacc_intr_calculatemasks(sc); splx(s); - return(ih); + return ih; } void @@ -199,7 +199,7 @@ sacc_intr_disestablish(sacc_chipset_tag_t *ic, void *arg) s = splhigh(); - for(p = &sc->sc_intrhand[irq];; p = &(*p)->ih_next) { + for (p = &sc->sc_intrhand[irq];; p = &(*p)->ih_next) { if (*p == NULL) panic("sacc_intr_disestablish: handler not registered"); if (*p == ih) @@ -213,7 +213,7 @@ sacc_intr_disestablish(sacc_chipset_tag_t *ic, void *arg) free(ih, M_DEVBUF); } -void +static void sacc_intr_setpolarity(sacc_chipset_tag_t *ic, int irq, int type) { struct sacc_softc *sc = (struct sacc_softc *)ic; @@ -239,17 +239,17 @@ sacc_intr_setpolarity(sacc_chipset_tag_t *ic, int irq, int type) splx(s); } -void +static void sacc_intr_calculatemasks(struct sacc_softc *sc) { int irq; sc->sc_imask.lo = 0; sc->sc_imask.hi = 0; - for(irq = 0; irq < 32; irq++) + for (irq = 0; irq < 32; irq++) if (sc->sc_intrhand[irq]) sc->sc_imask.lo |= (1 << irq); - for(irq = 0; irq < SACCIC_LEN - 32; irq++) + for (irq = 0; irq < SACCIC_LEN - 32; irq++) if (sc->sc_intrhand[irq + 32]) sc->sc_imask.hi |= (1 << irq); diff --git a/sys/arch/arm/sa11x0/sa1111_kbc.c b/sys/arch/arm/sa11x0/sa1111_kbc.c index d68cc9f3d4ab..dfe4503b5110 100644 --- a/sys/arch/arm/sa11x0/sa1111_kbc.c +++ b/sys/arch/arm/sa11x0/sa1111_kbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa1111_kbc.c,v 1.8 2006/02/23 05:37:46 thorpej Exp $ */ +/* $NetBSD: sa1111_kbc.c,v 1.9 2006/06/27 13:58:08 peter Exp $ */ /* * Copyright (c) 2004 Ben Harris. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.8 2006/02/23 05:37:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.9 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -102,8 +102,8 @@ struct sackbc_softc { pckbport_tag_t pt; }; -static int sackbc_match(struct device *, struct cfdata *, void *); -static void sackbc_attach(struct device *, struct device *, void *); +static int sackbc_match(struct device *, struct cfdata *, void *); +static void sackbc_attach(struct device *, struct device *, void *); static int sackbc_xt_translation(void *, pckbport_slot_t, int); #define sackbc_send_devcmd sackbc_send_cmd @@ -142,7 +142,8 @@ sackbc_match(struct device *parent, struct cfdata *cf, void *aux) struct sa1111_attach_args *aa = (struct sa1111_attach_args *)aux; switch (aa->sa_addr) { - case SACC_KBD0: case SACC_KBD1: + case SACC_KBD0: + case SACC_KBD1: return 1; } return 0; @@ -164,7 +165,7 @@ static int sackbc_rxint(void *cookie) { struct sackbc_softc *sc = cookie; - int stat, code=-1; + int stat, code = -1; stat = bus_space_read_4(sc->iot, sc->ioh, SACCKBD_STAT); DPRINTF(("sackbc_rxint stat=%x\n", stat)); @@ -178,8 +179,7 @@ sackbc_rxint(void *cookie) if (sc->polling) { sc->poll_data = code; sc->poll_stat = stat; - } - else + } else pckbportintr(sc->pt, sc->slot, code); return 1; } @@ -192,7 +192,7 @@ sackbc_intr_establish(void *cookie, pckbport_slot_t slot) { struct sackbc_softc *sc = cookie; - if (!(sc->polling) && sc->ih_rx==NULL) { + if (!(sc->polling) && sc->ih_rx == NULL) { sc->ih_rx = sacc_intr_establish( (sacc_chipset_tag_t *) device_parent(&sc->dev), sc->intr+1, IST_EDGE_RAISE, IPL_TTY, sackbc_rxint, sc); @@ -269,10 +269,10 @@ sackbc_attach(struct device *parent, struct device *self, void *aux) sc->pt = pckbport_attach(sc, &sackbc_ops); /* - * Although there is no such thing as SLOT for SA1111 kbd + * Although there is no such thing as SLOT for SA-1111 kbd * controller, pckbd and pms drivers require it. */ - for (slot=PCKBPORT_KBD_SLOT; slot <= PCKBPORT_AUX_SLOT; ++slot) { + for (slot = PCKBPORT_KBD_SLOT; slot <= PCKBPORT_AUX_SLOT; ++slot) { child = pckbport_attach_slot(self, sc->pt, slot); if (child == NULL) @@ -333,7 +333,7 @@ sackbc_poll_data1(void *cookie, pckbport_slot_t slot) } splx(s); - return (c); + return c; } static int @@ -342,9 +342,9 @@ sackbc_send_cmd(void *cookie, pckbport_slot_t slot, u_char val) struct sackbc_softc *sc = cookie; if (!sackbc_wait_output(sc)) - return (0); + return 0; bus_space_write_1(sc->iot, sc->ioh, SACCKBD_DATA, val); - return (1); + return 1; } @@ -394,8 +394,7 @@ sackbc_set_poll(void *self, pckbport_slot_t slot, int on) if (on) { sc->poll_data = sc->poll_stat = -1; sackbc_disable_intrhandler(sc); - } - else { + } else { /* * If disabling polling on a device that's * been configured, make sure there are no diff --git a/sys/arch/arm/sa11x0/sa1111_var.h b/sys/arch/arm/sa11x0/sa1111_var.h index 3151286e66c8..799789e4c243 100644 --- a/sys/arch/arm/sa11x0/sa1111_var.h +++ b/sys/arch/arm/sa11x0/sa1111_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: sa1111_var.h,v 1.9 2006/03/04 17:24:13 peter Exp $ */ +/* $NetBSD: sa1111_var.h,v 1.10 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,10 +35,10 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + #ifndef _SA1111_VAR_H #define _SA1111_VAR_H - struct sacc_intrhand { void *ih_soft; int ih_irq; @@ -54,10 +54,10 @@ struct sacc_softc { struct device sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; - bus_space_tag_t sc_piot; /* parent(SA1110)'s iot */ + bus_space_tag_t sc_piot; /* parent(SA-1110)'s iot */ bus_space_handle_t sc_gpioh; - uint32_t sc_gpiomask; /* SA1110 GPIO mask */ + uint32_t sc_gpiomask; /* SA-1110 GPIO mask */ struct sacc_intrvec sc_imask; struct sacc_intrhand *sc_intrhand[SACCIC_LEN]; @@ -75,11 +75,10 @@ struct sa1111_attach_args { #define IST_EDGE_RAISE 6 #define IST_EDGE_FALL 7 -void *sacc_intr_establish(sacc_chipset_tag_t *, int, int, int, +void *sacc_intr_establish(sacc_chipset_tag_t *, int, int, int, int (*)(void *), void *); -void sacc_intr_disestablish(sacc_chipset_tag_t *, void *); +void sacc_intr_disestablish(sacc_chipset_tag_t *, void *); int sacc_probe(struct device *, struct cfdata *, void *); -int sa1111_search(struct device *, struct cfdata *, - const int *, void *); +int sa1111_search(struct device *, struct cfdata *, const int *, void *); #endif /* _SA1111_VAR_H */ diff --git a/sys/arch/arm/sa11x0/sa11x0.c b/sys/arch/arm/sa11x0/sa11x0.c index 22893a059e08..2d28cb15e635 100644 --- a/sys/arch/arm/sa11x0/sa11x0.c +++ b/sys/arch/arm/sa11x0/sa11x0.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0.c,v 1.20 2006/04/11 15:22:07 peter Exp $ */ +/* $NetBSD: sa11x0.c,v 1.21 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 2001, The NetBSD Foundation, Inc. All rights reserved. @@ -54,10 +54,10 @@ * may be used to endorse or promote products derived from this software * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0.c,v 1.20 2006/04/11 15:22:07 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0.c,v 1.21 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -124,12 +124,13 @@ sa11x0_print(void *aux, const char *name) if (sa->sa_gpio != -1) aprint_normal(" gpio %d", sa->sa_gpio); - return (UNCONF); + return UNCONF; } int sa11x0_match(struct device *parent, struct cfdata *match, void *aux) { + return 1; } diff --git a/sys/arch/arm/sa11x0/sa11x0_com.c b/sys/arch/arm/sa11x0/sa11x0_com.c index 1bafd99d4ee9..5a957d75467b 100644 --- a/sys/arch/arm/sa11x0/sa11x0_com.c +++ b/sys/arch/arm/sa11x0/sa11x0_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_com.c,v 1.33 2006/06/27 11:01:41 peter Exp $ */ +/* $NetBSD: sa11x0_com.c,v 1.34 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.33 2006/06/27 11:01:41 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.34 2006/06/27 13:58:08 peter Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -233,7 +233,8 @@ struct consdev sacomcons = { static int sacom_match(struct device *parent, struct cfdata *match, void *aux) { - return (1); + + return 1; } void @@ -252,14 +253,14 @@ sacom_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = sa->sa_iot; sc->sc_baseaddr = sa->sa_addr; - if(bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, - &sc->sc_ioh)) { + if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, + &sc->sc_ioh)) { printf("%s: unable to map registers\n", sc->sc_dev.dv_xname); return; } printf("%s: ", sc->sc_dev.dv_xname); - switch(sc->sc_baseaddr) { + switch (sc->sc_baseaddr) { case SACOM1_BASE: printf("SA-11x0 UART1\n"); break; @@ -392,7 +393,7 @@ sacom_detach(struct device *self, int flags) rnd_detach_source(&sc->rnd_source); #endif - return (0); + return 0; } void @@ -456,7 +457,7 @@ sacom_activate(struct device *self, enum devact act) COM_UNLOCK(sc); splx(s); - return (rv); + return rv; } void @@ -513,17 +514,18 @@ sacomopen(dev_t dev, int flag, int mode, struct lwp *l) sc = device_lookup(&sacom_cd, COMUNIT(dev)); if (sc == NULL || !ISSET(sc->sc_hwflags, COM_HW_DEV_OK) || sc->sc_rbuf == NULL) - return (ENXIO); + return ENXIO; if (!device_is_active(&sc->sc_dev)) - return (ENXIO); + return ENXIO; tp = sc->sc_tty; if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - kauth_authorize_generic(l->l_proc->p_cred, KAUTH_GENERIC_ISSUSER, &l->l_proc->p_acflag) != 0) - return (EBUSY); + kauth_authorize_generic(l->l_proc->p_cred, KAUTH_GENERIC_ISSUSER, + &l->l_proc->p_acflag) != 0) + return EBUSY; s = spltty(); @@ -545,7 +547,7 @@ sacomopen(dev_t dev, int flag, int mode, struct lwp *l) splx(s); printf("%s: device enable failed\n", sc->sc_dev.dv_xname); - return (EIO); + return EIO; } sc->enabled = 1; sacom_config(sc); @@ -625,7 +627,7 @@ sacomopen(dev_t dev, int flag, int mode, struct lwp *l) if (error) goto bad; - return (0); + return 0; bad: if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) { @@ -636,7 +638,7 @@ bad: sacom_shutdown(sc); } - return (error); + return error; } int @@ -647,13 +649,13 @@ sacomclose(dev_t dev, int flag, int mode, struct lwp *l) /* 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); if (COM_ISALIVE(sc) == 0) - return (0); + return 0; if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) { /* @@ -664,7 +666,7 @@ sacomclose(dev_t dev, int flag, int mode, struct lwp *l) sacom_shutdown(sc); } - return (0); + return 0; } int @@ -674,9 +676,9 @@ sacomread(dev_t dev, struct uio *uio, int flag) struct tty *tp = sc->sc_tty; if (COM_ISALIVE(sc) == 0) - return (EIO); + return EIO; - return ((*tp->t_linesw->l_read)(tp, uio, flag)); + return (*tp->t_linesw->l_read)(tp, uio, flag); } int @@ -686,9 +688,9 @@ sacomwrite(dev_t dev, struct uio *uio, int flag) struct tty *tp = sc->sc_tty; if (COM_ISALIVE(sc) == 0) - return (EIO); + return EIO; - return ((*tp->t_linesw->l_write)(tp, uio, flag)); + return (*tp->t_linesw->l_write)(tp, uio, flag); } int @@ -698,9 +700,9 @@ sacompoll(dev_t dev, int events, struct lwp *l) struct tty *tp = sc->sc_tty; if (COM_ISALIVE(sc) == 0) - return (EIO); + return EIO; - return ((*tp->t_linesw->l_poll)(tp, events, l)); + return (*tp->t_linesw->l_poll)(tp, events, l); } struct tty * @@ -709,7 +711,7 @@ sacomtty(dev_t dev) struct sacom_softc *sc = device_lookup(&sacom_cd, COMUNIT(dev)); struct tty *tp = sc->sc_tty; - return (tp); + return tp; } int @@ -721,15 +723,15 @@ sacomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) int s; if (COM_ISALIVE(sc) == 0) - return (EIO); + return EIO; error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flag, l); if (error != EPASSTHROUGH) - return (error); + return error; error = ttioctl(tp, cmd, data, flag, l); if (error != EPASSTHROUGH) - return (error); + return error; error = 0; @@ -787,7 +789,7 @@ sacomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) comstatus(sc, "comioctl "); #endif - return (error); + return error; } static inline void @@ -849,7 +851,7 @@ sacom_to_tiocm(struct sacom_softc *sc) if (sc->sc_cr3 != 0) SET(ttybits, TIOCM_LE); - return (ttybits); + return ttybits; } static u_int @@ -862,7 +864,7 @@ cflag2cr0(tcflag_t cflag) cr0 |= (cflag & CSTOPB) ? CR0_SBS : 0; cr0 |= ((cflag & CSIZE) == CS8) ? CR0_DSS : 0; - return (cr0); + return cr0; } int @@ -874,13 +876,13 @@ sacomparam(struct tty *tp, struct termios *t) int s; if (COM_ISALIVE(sc) == 0) - return (EIO); + return EIO; /* Check requested parameters. */ if (ospeed < 0) - return (EINVAL); + return EINVAL; if (t->c_ispeed && t->c_ispeed != t->c_ospeed) - return (EINVAL); + return EINVAL; /* * For the console, always force CLOCAL and !HUPCL, so that the port @@ -899,7 +901,7 @@ sacomparam(struct tty *tp, struct termios *t) */ if (tp->t_ospeed == t->c_ospeed && tp->t_cflag == t->c_cflag) - return (0); + return 0; cr0 = cflag2cr0(t->c_cflag); @@ -946,7 +948,7 @@ sacomparam(struct tty *tp, struct termios *t) comstatus(sc, "comparam "); #endif - return (0); + return 0; } void @@ -1017,10 +1019,10 @@ sacomhwiflow(struct tty *tp, int block) int s; if (COM_ISALIVE(sc) == 0) - return (0); + return 0; if (sc->sc_mcr_rts == 0) - return (0); + return 0; s = splserial(); COM_LOCK(sc); @@ -1044,7 +1046,7 @@ sacomhwiflow(struct tty *tp, int block) COM_UNLOCK(sc); splx(s); #endif - return (1); + return 1; } /* @@ -1128,8 +1130,7 @@ sacom_filltx(struct sacom_softc *sc) int c, n; n = 0; - while(bus_space_read_4(iot, ioh, SACOM_SR1) - & SR1_TNF) { + while (bus_space_read_4(iot, ioh, SACOM_SR1) & SR1_TNF) { if (n == SACOM_TXFIFOLEN || n == sc->sc_tbc) break; c = *(sc->sc_tba + n); @@ -1326,13 +1327,13 @@ sacomintr(void *arg) u_int sr0, sr1; if (COM_ISALIVE(sc) == 0) - return (0); + return 0; COM_LOCK(sc); sr0 = bus_space_read_4(iot, ioh, SACOM_SR0); - if (! sr0) { + if (!sr0) { COM_UNLOCK(sc); - return (0); + return 0; } if (ISSET(sr0, SR0_EIF)) /* XXX silently discard error bits */ @@ -1357,7 +1358,7 @@ sacomintr(void *arg) sr1 = bus_space_read_4(iot, ioh, SACOM_SR1); if (ISSET(sr0, SR0_RFS | SR0_RID)) { - if (! ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) { + if (!ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) { while (cc > 0) { if (!ISSET(sr1, SR1_RNE)) { bus_space_write_4(iot, ioh, SACOM_SR0, @@ -1425,7 +1426,7 @@ sacomintr(void *arg) /* * If we've delayed a parameter change, do it now, and restart * output. - * XXX sacom_loadchanelregs() waits TX completion, + * XXX sacom_loadchannelregs() waits TX completion, * XXX resulting in ~0.1s hang (300bps, 4 bytes) in worst case */ if (sc->sc_heldchange) { @@ -1463,7 +1464,7 @@ sacomintr(void *arg) #if NRND > 0 && defined(RND_COM) rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif - return (1); + return 1; } static void @@ -1487,8 +1488,8 @@ sacominit(bus_space_tag_t iot, bus_addr_t iobase, int baud, tcflag_t cflag, printf("register map failed\n"); /* wait for the Tx queue to drain and disable the UART */ - while(bus_space_read_4(iot, *iohp, SACOM_SR1) & SR1_TBY) - ; + while (bus_space_read_4(iot, *iohp, SACOM_SR1) & SR1_TBY) + continue; bus_space_write_4(iot, *iohp, SACOM_CR3, 0); cr0 = cflag2cr0(cflag); @@ -1505,7 +1506,7 @@ sacominit(bus_space_tag_t iot, bus_addr_t iobase, int baud, tcflag_t cflag, /* enable the UART */ bus_space_write_4(iot, *iohp, SACOM_CR3, CR3_RXE | CR3_TXE); - return (0); + return 0; } void @@ -1539,7 +1540,7 @@ sacomcngetc(dev_t dev) s = spltty(); /* XXX do we need this? */ - while(! (bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) + while (!(bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) & SR1_RNE)) { #if defined(DDB) || defined(KGDB) #ifndef DDB_BREAK_CHAR @@ -1564,7 +1565,7 @@ sacomcngetc(dev_t dev) c &= 0xff; splx(s); - return (c); + return c; } void @@ -1574,9 +1575,9 @@ sacomcnputc(dev_t dev, int c) s = spltty(); /* XXX do we need this? */ - while(! (bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) - & SR1_TNF)) - ; + while (!(bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) + & SR1_TNF)) + continue; bus_space_write_4(sacomconstag, sacomconsioh, SACOM_DR, c); splx(s); @@ -1595,14 +1596,14 @@ sacomcncharpoll(void) { int c; - if (! (bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) + if (!(bus_space_read_4(sacomconstag, sacomconsioh, SACOM_SR1) & SR1_RNE)) return -1; c = bus_space_read_4(sacomconstag, sacomconsioh, SACOM_DR); c &= 0xff; - return (c); + return c; } #endif #endif @@ -1615,13 +1616,13 @@ sacom_is_console(bus_space_tag_t iot, bus_addr_t iobase, { bus_space_handle_t help; - if (! sacomconsattached && + if (!sacomconsattached && iot == sacomconstag && iobase == sacomconsaddr) help = sacomconsioh; else - return (0); + return 0; if (ioh) *ioh = help; - return (1); + return 1; } diff --git a/sys/arch/arm/sa11x0/sa11x0_io.c b/sys/arch/arm/sa11x0/sa11x0_io.c index c2a386d8a72d..b893518cc94b 100644 --- a/sys/arch/arm/sa11x0/sa11x0_io.c +++ b/sys/arch/arm/sa11x0/sa11x0_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_io.c,v 1.16 2006/04/11 15:08:10 peter Exp $ */ +/* $NetBSD: sa11x0_io.c,v 1.17 2006/06/27 13:58:08 peter Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_io.c,v 1.16 2006/04/11 15:08:10 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_io.c,v 1.17 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: sa11x0_io.c,v 1.16 2006/04/11 15:08:10 peter Exp $") #include #include -/* Proto types for all the bus_space structure functions */ +/* Prototypes for all the bus_space structure functions */ bs_protos(sa11x0); bs_protos(bs_notimpl); @@ -160,12 +160,12 @@ sa11x0_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, va = uvm_km_alloc(kernel_map, endpa - startpa, 0, UVM_KMF_VAONLY | UVM_KMF_NOWAIT); - if (! va) - return(ENOMEM); + if (!va) + return ENOMEM; *bshp = (bus_space_handle_t)(va + (bpa - startpa)); - for(pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { + for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE); pte = vtopte(va); if (cacheable == 0) { @@ -175,7 +175,7 @@ sa11x0_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, } pmap_update(pmap_kernel()); - return(0); + return 0; } int @@ -183,7 +183,8 @@ sa11x0_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable, bus_addr_t *bpap, bus_space_handle_t *bshp) { - panic("sa11x0_alloc(): Help!"); + + panic("sa11x0_bs_alloc(): Help!"); } void @@ -209,9 +210,7 @@ void sa11x0_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { - panic("sa11x0_free(): Help!"); - /* sa11x0_unmap() does all that we need to do. */ -/* sa11x0_unmap(t, bsh, size);*/ + panic("sa11x0_bs_free(): Help!"); } int @@ -220,7 +219,7 @@ sa11x0_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, { *nbshp = bsh + offset; - return (0); + return 0; } paddr_t @@ -229,20 +228,18 @@ sa11x0_bs_mmap(void *t, bus_addr_t paddr, off_t offset, int prot, int flags) /* * mmap from address `paddr+offset' for one page */ - return (arm_btop((paddr + offset))); + return arm_btop((paddr + offset)); } void * sa11x0_bs_vaddr(void *t, bus_space_handle_t bsh) { - return ((void *)bsh); + return (void *)bsh; } void sa11x0_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t len, int flags) { -/* NULL */ -} -/* End of sa11x0_io.c */ +} diff --git a/sys/arch/arm/sa11x0/sa11x0_io_asm.S b/sys/arch/arm/sa11x0/sa11x0_io_asm.S index bf9f6b05eb91..e80f184a613a 100644 --- a/sys/arch/arm/sa11x0/sa11x0_io_asm.S +++ b/sys/arch/arm/sa11x0/sa11x0_io_asm.S @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_io_asm.S,v 1.3 2005/12/11 12:16:51 christos Exp $ */ +/* $NetBSD: sa11x0_io_asm.S,v 1.4 2006/06/27 13:58:08 peter Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -284,5 +284,3 @@ sa11x0_bs_cb_2_loop: bne sa11x0_bs_cb_2_loop mov pc, lr - -/* end of sa11x0_io_asm.S */ diff --git a/sys/arch/arm/sa11x0/sa11x0_irqhandler.c b/sys/arch/arm/sa11x0/sa11x0_irqhandler.c index 5dc0268430f3..525d8e785cab 100644 --- a/sys/arch/arm/sa11x0/sa11x0_irqhandler.c +++ b/sys/arch/arm/sa11x0/sa11x0_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_irqhandler.c,v 1.9 2006/05/11 12:05:37 yamt Exp $ */ +/* $NetBSD: sa11x0_irqhandler.c,v 1.10 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_irqhandler.c,v 1.9 2006/05/11 12:05:37 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_irqhandler.c,v 1.10 2006/06/27 13:58:08 peter Exp $"); #include "opt_irqstats.h" @@ -105,7 +105,6 @@ u_int spl_mask; u_int irqmasks[IPL_LEVELS]; #endif - extern void set_spl_masks(void); static int fakeintr(void *); #ifdef INTR_DEBUG @@ -200,7 +199,7 @@ sa11x0_intr_establish(sa11x0_chipset_tag_t ic, int irq, int type, int level, * generally small. */ for (p = &irqhandlers[irq]; (q = *p) != NULL; p = &q->ih_next) - ; + continue; /* * Actually install a fake handler momentarily, since we might be doing @@ -239,7 +238,7 @@ sa11x0_intr_establish(sa11x0_chipset_tag_t ic, int irq, int type, int level, #ifdef INTR_DEBUG dumpirqhandlers(); #endif - return (ih); + return ih; } #ifdef hpcarm @@ -265,7 +264,7 @@ sa11x0_intr_disestablish(sa11x0_chipset_tag_t ic, void *arg) */ for (p = &irqhandlers[irq]; (q = *p) != NULL && q != ih; p = &q->ih_next) - ; + continue; if (q) *p = q->ih_next; else @@ -313,4 +312,3 @@ dumpirqhandlers(void) return 0; } #endif -/* End of irqhandler.c */ diff --git a/sys/arch/arm/sa11x0/sa11x0_ost.c b/sys/arch/arm/sa11x0/sa11x0_ost.c index 4d8079fb331b..965f924ebb4b 100644 --- a/sys/arch/arm/sa11x0/sa11x0_ost.c +++ b/sys/arch/arm/sa11x0/sa11x0_ost.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_ost.c,v 1.17 2006/04/18 17:50:25 peter Exp $ */ +/* $NetBSD: sa11x0_ost.c,v 1.18 2006/06/27 13:58:08 peter Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.17 2006/04/18 17:50:25 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_ost.c,v 1.18 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -92,7 +92,8 @@ CFATTACH_DECL(saost, sizeof(struct saost_softc), static int saost_match(struct device *parent, struct cfdata *match, void *aux) { - return (1); + + return 1; } void @@ -108,8 +109,8 @@ saost_attach(struct device *parent, struct device *self, void *aux) saost_sc = sc; - if(bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, - &sc->sc_ioh)) + if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, + &sc->sc_ioh)) panic("%s: Cannot map registers", self->dv_xname); /* disable all channel and clear interrupt status */ @@ -144,7 +145,7 @@ clockintr(void *arg) /* * we couldn't set the matching register in time. * just set it to some value so that next interrupt happens. - * XXX is it possible to compansate lost interrupts? + * XXX is it possible to compensate lost interrupts? */ s = splhigh(); @@ -159,7 +160,7 @@ clockintr(void *arg) saost_sc->sc_clock_count = nextmatch; hardclock(frame); - return(1); + return 1; } static int @@ -187,7 +188,7 @@ statintr(void *arg) /* * we couldn't set the matching register in time. * just set it to some value so that next interrupt happens. - * XXX is it possible to compansate lost interrupts? + * XXX is it possible to compensate lost interrupts? */ s = splhigh(); @@ -202,7 +203,7 @@ statintr(void *arg) saost_sc->sc_statclock_count = nextmatch; statclock(frame); - return(1); + return 1; } @@ -266,7 +267,7 @@ microtime(struct timeval *tvp) int s, tm, deltatm; static struct timeval lasttime; - if(saost_sc == NULL) { + if (saost_sc == NULL) { tvp->tv_sec = 0; tvp->tv_usec = 0; return; @@ -312,19 +313,19 @@ delay(u_int usecs) usecs = (TIMER_FREQUENCY / 100) * csec + (TIMER_FREQUENCY / 100) * usec / 10000; - if (! saost_sc) { + if (!saost_sc) { /* clock isn't initialized yet */ - for(; usecs > 0; usecs--) - for(j = 100; j > 0; j--) - ; + for (; usecs > 0; usecs--) + for (j = 100; j > 0; j--) + continue; return; } otick = gettick(); while (1) { - for(j = 100; j > 0; j--) - ; + for (j = 100; j > 0; j--) + continue; xtick = gettick(); delta = xtick - otick; if (delta > usecs) diff --git a/sys/arch/arm/sa11x0/sa11x0_ostreg.h b/sys/arch/arm/sa11x0/sa11x0_ostreg.h index 0db7282c2651..91ab4b285a63 100644 --- a/sys/arch/arm/sa11x0/sa11x0_ostreg.h +++ b/sys/arch/arm/sa11x0/sa11x0_ostreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_ostreg.h,v 1.1 2001/07/08 23:37:53 rjs Exp $ */ +/* $NetBSD: sa11x0_ostreg.h,v 1.2 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved. @@ -76,5 +76,3 @@ /* RTC Status Register */ #define SARTC_SR 0x0C - -/* end of sa11x0_ostreg.h */ diff --git a/sys/arch/arm/sa11x0/sa11x1_pcic.c b/sys/arch/arm/sa11x0/sa11x1_pcic.c index 315906a072f0..02a937a8852f 100644 --- a/sys/arch/arm/sa11x0/sa11x1_pcic.c +++ b/sys/arch/arm/sa11x0/sa11x1_pcic.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x1_pcic.c,v 1.12 2006/03/04 17:22:06 peter Exp $ */ +/* $NetBSD: sa11x1_pcic.c,v 1.13 2006/06/27 13:58:08 peter Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x1_pcic.c,v 1.12 2006/03/04 17:22:06 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x1_pcic.c,v 1.13 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -77,7 +77,7 @@ sacpcic_attach_common(struct sacc_softc *psc, struct sacpcic_softc *sc, sc->sc_pc.sc_iot = psc->sc_iot; sc->sc_ioh = psc->sc_ioh; - for(i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) { sc->sc_socket[i].sc = (struct sapcic_softc *)sc; sc->sc_socket[i].socket = i; sc->sc_socket[i].pcictag_cookie = psc; @@ -117,7 +117,8 @@ sacpcic_attach_common(struct sacc_softc *psc, struct sacpcic_softc *sc, int sacpcic_print(void *aux, const char *name) { - return (UNCONF); + + return UNCONF; } int @@ -218,8 +219,8 @@ sacpcic_intr_establish(struct sapcic_socket *so, int level, int irq; irq = so->socket ? IRQ_S1_READY : IRQ_S0_READY; - return (sacc_intr_establish((sacc_chipset_tag_t)so->pcictag_cookie, irq, - IST_EDGE_FALL, level, ih_fun, ih_arg)); + return sacc_intr_establish((sacc_chipset_tag_t)so->pcictag_cookie, irq, + IST_EDGE_FALL, level, ih_fun, ih_arg); } void diff --git a/sys/arch/arm/sa11x0/sa11xx_pcic.c b/sys/arch/arm/sa11x0/sa11xx_pcic.c index 2782c316e20c..2bfb65e578d7 100644 --- a/sys/arch/arm/sa11x0/sa11xx_pcic.c +++ b/sys/arch/arm/sa11x0/sa11xx_pcic.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11xx_pcic.c,v 1.7 2006/03/04 17:22:06 peter Exp $ */ +/* $NetBSD: sa11xx_pcic.c,v 1.8 2006/06/27 13:58:08 peter Exp $ */ /* * Copyright (c) 2001 IWAMOTO Toshihiro. All rights reserved. @@ -31,11 +31,11 @@ */ /* - * Common code for SA11x0 based PCMCIA modules + * Common code for SA-11x0 based PCMCIA modules. */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11xx_pcic.c,v 1.7 2006/03/04 17:22:06 peter Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11xx_pcic.c,v 1.8 2006/06/27 13:58:08 peter Exp $"); #include #include @@ -122,7 +122,7 @@ sapcic_kthread_create(void *arg) /* XXX attach card if already present */ - so->laststatus =(so->pcictag->read)(so, SAPCIC_STATUS_CARD); + so->laststatus = (so->pcictag->read)(so, SAPCIC_STATUS_CARD); if (so->laststatus == SAPCIC_CARD_VALID) { printf("%s: card present\n", so->sc->sc_dev.dv_xname); @@ -152,8 +152,7 @@ sapcic_event_thread(void *arg) (void) lockmgr(&so->sc->sc_lock, LK_EXCLUSIVE, NULL); /* sleep .25s to be enqueued chatterling interrupts */ - (void) tsleep((caddr_t)sapcic_event_thread, PWAIT, - "pcicss", hz/4); + (void) tsleep(sapcic_event_thread, PWAIT, "pcicss", hz / 4); s = splhigh(); so->event = 0; @@ -234,7 +233,7 @@ sapcic_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, /* All we need is bus space tag */ memset(pmh, 0, sizeof(*pmh)); pmh->memt = so->sc->sc_iot; - return (0); + return 0; } @@ -272,9 +271,9 @@ sapcic_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t card_addr, } error = bus_space_map(so->sc->sc_iot, pa, size, 0, &pmh->memh); - if (! error) + if (!error) *windowp = (int)pmh->memh; - return (error); + return error; } static void @@ -307,7 +306,7 @@ sapcic_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, /* XXX Are we ignoring alignment constraints? */ error = bus_space_map(so->sc->sc_iot, pa, size, 0, &pih->ioh); - return (error); + return error; } static void @@ -322,7 +321,8 @@ static int sapcic_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset, bus_size_t size, struct pcmcia_io_handle *pih, int *windowp) { - return (0); + + return 0; } static void sapcic_io_unmap(pcmcia_chipset_handle_t pch, int window) @@ -337,7 +337,7 @@ sapcic_intr_establish(pcmcia_chipset_handle_t pch, struct pcmcia_function *pf, /* XXX need to check if something should be done here */ - return ((so->pcictag->intr_establish)(so, ipl, fct, arg)); + return (so->pcictag->intr_establish)(so, ipl, fct, arg); } static void @@ -345,7 +345,7 @@ sapcic_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih) { struct sapcic_socket *so = pch; - ((so->pcictag->intr_disestablish)(so, ih)); + (so->pcictag->intr_disestablish)(so, ih); } static void @@ -413,7 +413,7 @@ sapcic_socket_enable(pcmcia_chipset_handle_t pch) /* wait for the chip to finish initializing */ sapcic_delay(10, "pccen3"); - for(i = 100; i; i--) { + for (i = 100; i; i--) { if ((so->pcictag->read)(so, SAPCIC_STATUS_READY)) break; sapcic_delay(100, "pccen4");