Module Name: src Committed By: christos Date: Wed Mar 26 17:53:36 UTC 2014
Modified Files: src/sys/arch/hpcmips/dev: mq200debug.c plumpcmcia.c src/sys/arch/hpcmips/hpcmips: machdep.c src/sys/arch/hpcmips/include: cpu.h src/sys/arch/hpcmips/tx: tx39.c tx39icu.c src/sys/arch/hpcmips/vr: vr.c vrpmu.c Log Message: - kill sprintf - fix unused To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hpcmips/dev/mq200debug.c cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hpcmips/dev/plumpcmcia.c cvs rdiff -u -r1.118 -r1.119 src/sys/arch/hpcmips/hpcmips/machdep.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hpcmips/include/cpu.h cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hpcmips/tx/tx39.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/hpcmips/tx/tx39icu.c cvs rdiff -u -r1.64 -r1.65 src/sys/arch/hpcmips/vr/vr.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hpcmips/vr/vrpmu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hpcmips/dev/mq200debug.c diff -u src/sys/arch/hpcmips/dev/mq200debug.c:1.5 src/sys/arch/hpcmips/dev/mq200debug.c:1.6 --- src/sys/arch/hpcmips/dev/mq200debug.c:1.5 Sun Dec 11 07:17:33 2005 +++ src/sys/arch/hpcmips/dev/mq200debug.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mq200debug.c,v 1.5 2005/12/11 12:17:33 christos Exp $ */ +/* $NetBSD: mq200debug.c,v 1.6 2014/03/26 17:53:36 christos Exp $ */ /*- * Copyright (c) 2001 TAKEMURA Shin @@ -31,7 +31,7 @@ #ifdef _KERNEL #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mq200debug.c,v 1.5 2005/12/11 12:17:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mq200debug.c,v 1.6 2014/03/26 17:53:36 christos Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -193,11 +193,11 @@ mq200_regname(struct mq200_softc *sc, in for (i = 0; i < sizeof(regs)/sizeof(*regs); i++) if (regs[i].base + regs[i].start * 4 <= offset && offset <= regs[i].base + regs[i].end * 4) { - sprintf(buf, "%s%02XR", regs[i].name, + snprintf(buf, bufsize, "%s%02XR", regs[i].name, (offset - regs[i].base) / 4); return (buf); } - sprintf(buf, "OFFSET %02X", offset); + snprintf(buf, bufsize, "OFFSET %02X", offset); return (buf); } Index: src/sys/arch/hpcmips/dev/plumpcmcia.c diff -u src/sys/arch/hpcmips/dev/plumpcmcia.c:1.26 src/sys/arch/hpcmips/dev/plumpcmcia.c:1.27 --- src/sys/arch/hpcmips/dev/plumpcmcia.c:1.26 Sat Oct 27 13:17:53 2012 +++ src/sys/arch/hpcmips/dev/plumpcmcia.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: plumpcmcia.c,v 1.26 2012/10/27 17:17:53 chs Exp $ */ +/* $NetBSD: plumpcmcia.c,v 1.27 2014/03/26 17:53:36 christos Exp $ */ /* * Copyright (c) 1999, 2000 UCHIYAMA Yasushi. All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: plumpcmcia.c,v 1.26 2012/10/27 17:17:53 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plumpcmcia.c,v 1.27 2014/03/26 17:53:36 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -213,7 +213,7 @@ plumpcmcia_attach(device_t parent, devic struct plum_attach_args *pa = aux; struct plumpcmcia_softc *sc = device_private(self); struct plumpcmcia_handle *ph; - int error; + int error __diagused; sc->sc_dev = self; sc->sc_pc = pa->pa_pc; @@ -844,7 +844,6 @@ plum_csc_intr_setup(struct plumpcmcia_so bus_space_tag_t regt = ph->ph_regt; bus_space_handle_t regh = ph->ph_regh; plumreg_t reg; - void *ih; /* enable CARD DETECT ENABLE only */ plum_conf_write(regt, regh, PLUM_PCMCIA_CSCINT, @@ -856,7 +855,7 @@ plum_csc_intr_setup(struct plumpcmcia_so plum_conf_write(regt, regh, PLUM_PCMCIA_GLOBALCTRL, reg); /* install interrupt handler (don't fail) */ - ih = plum_intr_establish(sc->sc_pc, irq, IST_EDGE, IPL_TTY, + plum_intr_establish(sc->sc_pc, irq, IST_EDGE, IPL_TTY, plum_csc_intr, ph); KASSERT(ih != 0); } Index: src/sys/arch/hpcmips/hpcmips/machdep.c diff -u src/sys/arch/hpcmips/hpcmips/machdep.c:1.118 src/sys/arch/hpcmips/hpcmips/machdep.c:1.119 --- src/sys/arch/hpcmips/hpcmips/machdep.c:1.118 Tue Mar 25 09:38:25 2014 +++ src/sys/arch/hpcmips/hpcmips/machdep.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.118 2014/03/25 13:38:25 christos Exp $ */ +/* $NetBSD: machdep.c,v 1.119 2014/03/26 17:53:36 christos Exp $ */ /*- * Copyright (c) 1999 Shin Takemura, All rights reserved. @@ -69,7 +69,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.118 2014/03/25 13:38:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.119 2014/03/26 17:53:36 christos Exp $"); #include "opt_vr41xx.h" #include "opt_tx39xx.h" @@ -152,7 +152,7 @@ static int __bicons_enable; #endif /* the following is used externally (sysctl_hw) */ -char hpcmips_cpuname[40]; /* set CPU depend xx_init() */ +static char hpcmips_cpuname[40]; /* set CPU depend xx_init() */ int cpuspeed = 1; /* approx # instr per usec. */ @@ -458,6 +458,19 @@ mach_init(int argc, char *argv[], struct mips_init_lwp0_uarea(); } +int +cpuname_printf(const char *fmt, ...) +{ + int len; + va_list ap; + + va_start(ap, fmt); + len = vsnprintf(hpcmips_cpuname, sizeof(hpcmips_cpuname), fmt, ap); + va_end(ap); + + return len; +} + /* * Machine-dependent startup code. * allocate memory for variable-sized tables, initialize CPU. Index: src/sys/arch/hpcmips/include/cpu.h diff -u src/sys/arch/hpcmips/include/cpu.h:1.13 src/sys/arch/hpcmips/include/cpu.h:1.14 --- src/sys/arch/hpcmips/include/cpu.h:1.13 Wed Jan 20 20:23:15 2010 +++ src/sys/arch/hpcmips/include/cpu.h Wed Mar 26 13:53:36 2014 @@ -1,6 +1,6 @@ -/* $NetBSD: cpu.h,v 1.13 2010/01/21 01:23:15 pooka Exp $ */ +/* $NetBSD: cpu.h,v 1.14 2014/03/26 17:53:36 christos Exp $ */ #include <mips/cpu.h> #ifndef _LOCORE -extern char hpcmips_cpuname[]; +int cpuname_printf(const char *, ...) __printflike(1, 2); #endif Index: src/sys/arch/hpcmips/tx/tx39.c diff -u src/sys/arch/hpcmips/tx/tx39.c:1.44 src/sys/arch/hpcmips/tx/tx39.c:1.45 --- src/sys/arch/hpcmips/tx/tx39.c:1.44 Fri Dec 2 13:07:26 2011 +++ src/sys/arch/hpcmips/tx/tx39.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tx39.c,v 1.44 2011/12/02 18:07:26 shattered Exp $ */ +/* $NetBSD: tx39.c,v 1.45 2014/03/26 17:53:36 christos Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tx39.c,v 1.44 2011/12/02 18:07:26 shattered Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tx39.c,v 1.45 2014/03/26 17:53:36 christos Exp $"); #include "opt_vr41xx.h" #include "opt_tx39xx.h" @@ -120,13 +120,12 @@ tx_init(void) switch (model) { default: /* Unknown TOSHIBA TX39-series */ - sprintf(hpcmips_cpuname, - "Unknown TOSHIBA TX39-series %x", model); + cpuname_printf("Unknown TOSHIBA TX39-series %x", model); break; case TMPR3912: tx39clock_cpuspeed(&cpuclock, &cpuspeed); - sprintf(hpcmips_cpuname, "TOSHIBA TMPR3912 %d.%02d MHz", + cpuname_printf("TOSHIBA TMPR3912 %d.%02d MHz", cpuclock / 1000000, (cpuclock % 1000000) / 10000); tc->tc_chipset = __TX391X; break; @@ -134,7 +133,7 @@ tx_init(void) tx39clock_cpuspeed(&cpuclock, &cpuspeed); rev = tx_conf_read(tc, TX3922_REVISION_REG); - sprintf(hpcmips_cpuname, "TOSHIBA TMPR3922 rev. %x.%x " + cpuname_printf("TOSHIBA TMPR3922 rev. %x.%x " "%d.%02d MHz", (rev >> 4) & 0xf, rev & 0xf, cpuclock / 1000000, (cpuclock % 1000000) / 10000); tc->tc_chipset = __TX392X; Index: src/sys/arch/hpcmips/tx/tx39icu.c diff -u src/sys/arch/hpcmips/tx/tx39icu.c:1.32 src/sys/arch/hpcmips/tx/tx39icu.c:1.33 --- src/sys/arch/hpcmips/tx/tx39icu.c:1.32 Sat Oct 27 13:17:54 2012 +++ src/sys/arch/hpcmips/tx/tx39icu.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tx39icu.c,v 1.32 2012/10/27 17:17:54 chs Exp $ */ +/* $NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.32 2012/10/27 17:17:54 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $"); #include "opt_vr41xx.h" #include "opt_tx39xx.h" @@ -746,13 +746,13 @@ tx39_intr_dump(struct tx39icu_softc *sc) reg |= (1 << j); } } - sprintf(msg, "%d high", i); + snprintf(msg, sizeof(msg), "%d high", i); dbg_bit_print_msg(reg, msg); - sprintf(msg, "%d status", i); + snprintf(msg, sizeof(msg), "%d status", i); dbg_bit_print_msg(sc->sc_regs[i], msg); ofs = TX39_INTRENABLE_REG(i); reg = tx_conf_read(tc, ofs); - sprintf(msg, "%d enable", i); + snprintf(msg, sizeof(msg), "%d enable", i); dbg_bit_print_msg(reg, msg); } reg = sc->sc_regs[0]; Index: src/sys/arch/hpcmips/vr/vr.c diff -u src/sys/arch/hpcmips/vr/vr.c:1.64 src/sys/arch/hpcmips/vr/vr.c:1.65 --- src/sys/arch/hpcmips/vr/vr.c:1.64 Fri Mar 18 11:31:38 2011 +++ src/sys/arch/hpcmips/vr/vr.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vr.c,v 1.64 2011/03/18 15:31:38 tsutsui Exp $ */ +/* $NetBSD: vr.c,v 1.65 2014/03/26 17:53:36 christos Exp $ */ /*- * Copyright (c) 1999-2002 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vr.c,v 1.64 2011/03/18 15:31:38 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vr.c,v 1.65 2014/03/26 17:53:36 christos Exp $"); #include "opt_vr41xx.h" #include "opt_tx39xx.h" @@ -303,14 +303,14 @@ vr_init(void) platform.reboot = vr_reboot; #if NVRBCU > 0 - sprintf(hpcmips_cpuname, "NEC %s rev%d.%d %d.%03dMHz", + cpuname_printf("NEC %s rev%d.%d %d.%03dMHz", vrbcu_vrip_getcpuname(), vrbcu_vrip_getcpumajor(), vrbcu_vrip_getcpuminor(), vrbcu_vrip_getcpuclock() / 1000000, (vrbcu_vrip_getcpuclock() % 1000000) / 1000); #else - sprintf(hpcmips_cpuname, "NEC VR41xx"); + cpuname_printf("NEC VR41xx"); #endif } Index: src/sys/arch/hpcmips/vr/vrpmu.c diff -u src/sys/arch/hpcmips/vr/vrpmu.c:1.19 src/sys/arch/hpcmips/vr/vrpmu.c:1.20 --- src/sys/arch/hpcmips/vr/vrpmu.c:1.19 Sat Oct 27 13:17:56 2012 +++ src/sys/arch/hpcmips/vr/vrpmu.c Wed Mar 26 13:53:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vrpmu.c,v 1.19 2012/10/27 17:17:56 chs Exp $ */ +/* $NetBSD: vrpmu.c,v 1.20 2014/03/26 17:53:36 christos Exp $ */ /* * Copyright (c) 1999 M. Warner Losh. All rights reserved. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vrpmu.c,v 1.19 2012/10/27 17:17:56 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vrpmu.c,v 1.20 2014/03/26 17:53:36 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -219,14 +219,12 @@ void vrpmu_dump_regs(void *arg) { struct vrpmu_softc *sc = arg; - unsigned int intstat1; - unsigned int intstat2; unsigned int reg; #if NVRBCU > 0 int cpuid; #endif - intstat1 = vrpmu_read(sc, PMUINT_REG_W); - intstat2 = vrpmu_read(sc, PMUINT2_REG_W); + reg = vrpmu_read(sc, PMUINT_REG_W); + reg = vrpmu_read(sc, PMUINT2_REG_W); /* others? XXXX */ reg = vrpmu_read(sc, PMUCNT_REG_W);