From 51d46cb132e01e3102afbb182ed85dcdbdd238b8 Mon Sep 17 00:00:00 2001 From: scw Date: Wed, 1 Jun 2005 10:55:07 +0000 Subject: [PATCH] Fix const and shadow variable fallout. --- sys/arch/sh5/dev/cprc.c | 8 +++++--- sys/arch/sh5/dev/cpu_sh.c | 12 ++++++------ sys/arch/sh5/dev/rtc.c | 24 ++++++++++++------------ sys/arch/sh5/dev/scif.c | 22 +++++++++++----------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/sys/arch/sh5/dev/cprc.c b/sys/arch/sh5/dev/cprc.c index 72332132e35f..69f9e90fb704 100644 --- a/sys/arch/sh5/dev/cprc.c +++ b/sys/arch/sh5/dev/cprc.c @@ -1,4 +1,4 @@ -/* $NetBSD: cprc.c,v 1.7 2003/07/15 03:35:58 lukem Exp $ */ +/* $NetBSD: cprc.c,v 1.8 2005/06/01 10:55:07 scw Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cprc.c,v 1.7 2003/07/15 03:35:58 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cprc.c,v 1.8 2005/06/01 10:55:07 scw Exp $"); #include #include @@ -128,7 +128,9 @@ cprcattach(struct device *parent, struct device *self, void *args) printf(": Clock, Power and Watchdog/Reset Controller\n"); for (i = 0; cprc_subdevs[i] != NULL; i++) { - child = config_found(self, (void *)cprc_subdevs[i], cprcprint); + char name[16]; + strlcpy(name, cprc_subdevs[i], sizeof(name)); + child = config_found(self, name, cprcprint); if (i == 0 && child == NULL) panic("%s: no clock driver configured!",self->dv_xname); } diff --git a/sys/arch/sh5/dev/cpu_sh.c b/sys/arch/sh5/dev/cpu_sh.c index d2408043fd13..3ee89f9ac4f8 100644 --- a/sys/arch/sh5/dev/cpu_sh.c +++ b/sys/arch/sh5/dev/cpu_sh.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_sh.c,v 1.7 2003/11/09 21:12:08 scw Exp $ */ +/* $NetBSD: cpu_sh.c,v 1.8 2005/06/01 10:55:07 scw Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu_sh.c,v 1.7 2003/11/09 21:12:08 scw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_sh.c,v 1.8 2005/06/01 10:55:07 scw Exp $"); #include #include @@ -91,7 +91,7 @@ cpu_shattach(struct device *parent, struct device *self, void *args) struct superhyway_attach_args *sa = args; bus_space_handle_t bh; u_int64_t vcr; - u_int cpuid, version; + u_int cpuid, vers; const char *cpustr; char str[64]; @@ -106,10 +106,10 @@ cpu_shattach(struct device *parent, struct device *self, void *args) */ if (vcr == 0) { cpuid = bootparams.bp_cpu[0].cpuid; - version = bootparams.bp_cpu[0].version; + vers = bootparams.bp_cpu[0].version; } else { cpuid = SUPERHYWAY_VCR_MOD_ID(vcr); - version = SUPERHYWAY_VCR_MOD_VERS(vcr); + vers = SUPERHYWAY_VCR_MOD_VERS(vcr); } switch (cpuid) { @@ -124,7 +124,7 @@ cpu_shattach(struct device *parent, struct device *self, void *args) } printf("\n%s: %s, Version %d, %ld.%02ld MHz\n", self->dv_xname, cpustr, - version, (long)(bootparams.bp_cpu[0].speed / 1000000), + vers, (long)(bootparams.bp_cpu[0].speed / 1000000), (long)(bootparams.bp_cpu[0].speed % 1000000) / 10000); if (sh5_cache_ops.iinfo.type == SH5_CACHE_INFO_TYPE_NONE) { diff --git a/sys/arch/sh5/dev/rtc.c b/sys/arch/sh5/dev/rtc.c index 138dbde3ebf7..f5e56770287a 100644 --- a/sys/arch/sh5/dev/rtc.c +++ b/sys/arch/sh5/dev/rtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.8 2003/07/18 21:41:24 thorpej Exp $ */ +/* $NetBSD: rtc.c,v 1.9 2005/06/01 10:55:07 scw Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.8 2003/07/18 21:41:24 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.9 2005/06/01 10:55:07 scw Exp $"); #include #include @@ -120,7 +120,7 @@ rtc_gettime(struct todr_chip_handle *todr, struct timeval *tv) struct rtc_softc *sc = todr->cookie; struct clock_ymdhms dt; u_int8_t r64cnt; - u_int8_t sec, min, hour; + u_int8_t second, minute, hour; u_int8_t dow, day, mon; u_int16_t year; int s, retry; @@ -131,8 +131,8 @@ rtc_gettime(struct todr_chip_handle *todr, struct timeval *tv) do { r64cnt = rtc_read_r64cnt(sc->sc_bust, sc->sc_bush); - sec = rtc_read(sc, RTC_REG_RSECCNT); - min = rtc_read(sc, RTC_REG_RMINCNT); + second = rtc_read(sc, RTC_REG_RSECCNT); + minute = rtc_read(sc, RTC_REG_RMINCNT); hour = rtc_read(sc, RTC_REG_RHRCNT); dow = rtc_read(sc, RTC_REG_RWKCNT); day = rtc_read(sc, RTC_REG_RDAYCNT); @@ -151,8 +151,8 @@ rtc_gettime(struct todr_chip_handle *todr, struct timeval *tv) return (1); } - dt.dt_sec = FROMBCD(sec); - dt.dt_min = FROMBCD(min); + dt.dt_sec = FROMBCD(second); + dt.dt_min = FROMBCD(minute); dt.dt_hour = FROMBCD(hour); dt.dt_day = FROMBCD(day); dt.dt_wday = FROMBCD(dow); @@ -172,15 +172,15 @@ rtc_settime(struct todr_chip_handle *todr, struct timeval *tv) struct rtc_softc *sc = todr->cookie; struct clock_ymdhms dt; u_int8_t r64cnt; - u_int8_t sec, min, hour; + u_int8_t second, minute, hour; u_int8_t dow, day, mon; u_int16_t year; int s, retry; clock_secs_to_ymdhms(tv->tv_sec, &dt); - sec = TOBCD(dt.dt_sec); - min = TOBCD(dt.dt_min); + second = TOBCD(dt.dt_sec); + minute = TOBCD(dt.dt_min); hour = TOBCD(dt.dt_hour); day = TOBCD(dt.dt_day); dow = TOBCD(dt.dt_wday); @@ -200,8 +200,8 @@ rtc_settime(struct todr_chip_handle *todr, struct timeval *tv) rtc_write(sc, RTC_REG_RDAYCNT, day); rtc_write(sc, RTC_REG_RWKCNT, dow); rtc_write(sc, RTC_REG_RHRCNT, hour); - rtc_write(sc, RTC_REG_RMINCNT, min); - rtc_write(sc, RTC_REG_RSECCNT, sec); + rtc_write(sc, RTC_REG_RMINCNT, minute); + rtc_write(sc, RTC_REG_RSECCNT, second); retry--; } while (r64cnt != rtc_read_r64cnt(sc->sc_bust, sc->sc_bush) && retry); diff --git a/sys/arch/sh5/dev/scif.c b/sys/arch/sh5/dev/scif.c index 1a376983be7e..de743adf835d 100644 --- a/sys/arch/sh5/dev/scif.c +++ b/sys/arch/sh5/dev/scif.c @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.14 2004/12/13 02:34:03 chs Exp $ */ +/* $NetBSD: scif.c,v 1.15 2005/06/01 10:55:07 scw Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -106,7 +106,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.14 2004/12/13 02:34:03 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.15 2005/06/01 10:55:07 scw Exp $"); #include "opt_kgdb.h" @@ -588,15 +588,15 @@ scifstart(struct tty *tp) /* Output the first chunk of the contiguous buffer. */ { int n; - int max; + int maxb; int i; n = sc->sc_tbc; - max = sc->sc_fifolen - + maxb = sc->sc_fifolen - ((scif_rd_scfdr2(sc) >> SCIF_SCFDR2_T_SHIFT) & SCIF_SCFDR2_T_MASK); - if (n > max) - n = max; + if (n > maxb) + n = maxb; for (i = 0; i < n; i++) { scif_putc(sc->sc_iot, sc->sc_ioh, *(sc->sc_tba)); @@ -1059,7 +1059,7 @@ scifdiag(void *arg) integrate void scif_rxsoft(struct scif_softc *sc, struct tty *tp) { - int (*rint)(int c, struct tty *tp) = tp->t_linesw->l_rint; + int (*rint)(int, struct tty *) = tp->t_linesw->l_rint; u_char *get, *end; u_int cc, scc; u_char ssr2; @@ -1425,15 +1425,15 @@ scifintr(void *arg) /* Output the next chunk of the contiguous buffer, if any. */ if (sc->sc_tbc > 0) { int n; - int max; + int maxb; int i; n = sc->sc_tbc; - max = sc->sc_fifolen - + maxb = sc->sc_fifolen - ((scif_rd_scfdr2(sc) >> SCIF_SCFDR2_T_SHIFT) & SCIF_SCFDR2_T_MASK); - if (n > max) - n = max; + if (n > maxb) + n = maxb; for (i = 0; i < n; i++) { scif_putc(sc->sc_iot, sc->sc_ioh,*(sc->sc_tba));