Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha gc sprintf; reduce local static usage of inte...
details: https://anonhg.NetBSD.org/src/rev/6db55c221515
branches: trunk
changeset: 327934:6db55c221515
user: christos <christos%NetBSD.org@localhost>
date: Fri Mar 21 16:39:29 2014 +0000
description:
gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
diffstat:
sys/arch/alpha/eisa/eisa_machdep.c | 11 +++++++-
sys/arch/alpha/include/eisa_machdep.h | 10 ++++---
sys/arch/alpha/include/pci_machdep.h | 10 ++++---
sys/arch/alpha/jensenio/com_jensenio.c | 6 ++--
sys/arch/alpha/jensenio/jensenio_intr.c | 25 +++++++++----------
sys/arch/alpha/jensenio/lpt_jensenio.c | 8 ++++--
sys/arch/alpha/jensenio/pckbc_jensenio.c | 8 +++---
sys/arch/alpha/pci/dwlpx_dma.c | 10 ++++---
sys/arch/alpha/pci/pci_1000.c | 22 ++++++++--------
sys/arch/alpha/pci/pci_1000a.c | 24 +++++++++---------
sys/arch/alpha/pci/pci_2100_a50.c | 10 ++++----
sys/arch/alpha/pci/pci_2100_a500.c | 40 ++++++++++++++-----------------
sys/arch/alpha/pci/pci_550.c | 31 +++++++++++++-----------
sys/arch/alpha/pci/pci_6600.c | 25 +++++++++++--------
sys/arch/alpha/pci/pci_alphabook1.c | 11 ++++----
sys/arch/alpha/pci/pci_axppci_33.c | 10 ++++----
sys/arch/alpha/pci/pci_eb164.c | 27 ++++++++++++---------
sys/arch/alpha/pci/pci_eb64plus.c | 24 +++++++++---------
sys/arch/alpha/pci/pci_eb66.c | 23 ++++++++---------
sys/arch/alpha/pci/pci_kn20aa.c | 27 ++++++++++-----------
sys/arch/alpha/pci/pci_kn300.c | 20 ++++++++--------
sys/arch/alpha/pci/pci_kn8ae.c | 15 ++++-------
sys/arch/alpha/pci/pci_machdep.c | 11 +++++++-
sys/arch/alpha/pci/pci_up1000.c | 14 ++++++----
sys/arch/alpha/pci/sio_pic.c | 21 ++++++++--------
sys/arch/alpha/pci/siovar.h | 4 +-
sys/arch/alpha/sableio/com_sableio.c | 8 ++++--
sys/arch/alpha/sableio/fdc_sableio.c | 8 ++++--
sys/arch/alpha/sableio/lpt_sableio.c | 8 ++++--
sys/arch/alpha/sableio/pckbc_sableio.c | 8 ++++--
30 files changed, 255 insertions(+), 224 deletions(-)
diffs (truncated from 1639 to 300 lines):
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/eisa/eisa_machdep.c
--- a/sys/arch/alpha/eisa/eisa_machdep.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/eisa/eisa_machdep.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eisa_machdep.c,v 1.10 2013/06/27 21:21:05 christos Exp $ */
+/* $NetBSD: eisa_machdep.c,v 1.11 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.10 2013/06/27 21:21:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.11 2014/03/21 16:39:29 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -677,3 +677,10 @@
*dp = ecuio->ecuio_io;
return (0);
}
+
+const char *
+eisa_intr_string(eisa_chipset_tag_t c, eisa_intr_handle_t handle)
+{
+ static char buf[64];
+ return eisa_intr_string_internal(c, handle, buf, sizeof(buf));
+}
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/include/eisa_machdep.h
--- a/sys/arch/alpha/include/eisa_machdep.h Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/include/eisa_machdep.h Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eisa_machdep.h,v 1.10 2011/06/14 06:47:52 matt Exp $ */
+/* $NetBSD: eisa_machdep.h,v 1.11 2014/03/21 16:39:29 christos Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -40,7 +40,8 @@
struct eisabus_attach_args *);
int (*ec_maxslots)(void *);
int (*ec_intr_map)(void *, u_int, eisa_intr_handle_t *);
- const char *(*ec_intr_string)(void *, eisa_intr_handle_t);
+ const char *(*ec_intr_string)(void *, eisa_intr_handle_t, char *,
+ size_t);
const struct evcnt *(*ec_intr_evcnt)(void *, eisa_intr_handle_t);
void *(*ec_intr_establish)(void *, eisa_intr_handle_t,
int, int, int (*)(void *), void *);
@@ -56,8 +57,8 @@
(*(c)->ec_maxslots)((c)->ec_v)
#define eisa_intr_map(c, i, hp) \
(*(c)->ec_intr_map)((c)->ec_v, (i), (hp))
-#define eisa_intr_string(c, h) \
- (*(c)->ec_intr_string)((c)->ec_v, (h))
+#define eisa_intr_string_internal(c, h, buf, len) \
+ (*(c)->ec_intr_string)((c)->ec_v, (h), (buf), (len))
#define eisa_intr_evcnt(c, h) \
(*(c)->ec_intr_evcnt)((c)->ec_v, (h))
#define eisa_intr_establish(c, h, t, l, f, a) \
@@ -79,6 +80,7 @@
*/
void eisa_init(eisa_chipset_tag_t);
+const char *eisa_intr_string(eisa_chipset_tag_t, eisa_intr_handle_t);
extern bus_size_t eisa_config_stride;
extern paddr_t eisa_config_addr;
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/include/pci_machdep.h
--- a/sys/arch/alpha/include/pci_machdep.h Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/include/pci_machdep.h Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.16 2014/01/20 15:05:13 tsutsui Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.17 2014/03/21 16:39:29 christos Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -62,7 +62,8 @@
void *pc_intr_v;
int (*pc_intr_map)(const struct pci_attach_args *,
pci_intr_handle_t *);
- const char *(*pc_intr_string)(void *, pci_intr_handle_t);
+ const char *(*pc_intr_string)(void *, pci_intr_handle_t,
+ char *, size_t);
const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
void *(*pc_intr_establish)(void *, pci_intr_handle_t,
int, int (*)(void *), void *);
@@ -90,8 +91,8 @@
(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
#define pci_intr_map(pa, ihp) \
(*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
-#define pci_intr_string(c, ih) \
- (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
+#define pci_intr_string_internal(c, ih, buf, len) \
+ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih), (buf), (len))
#define pci_intr_evcnt(c, ih) \
(*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
#define pci_intr_establish(c, ih, l, h, a) \
@@ -103,6 +104,7 @@
* alpha-specific PCI functions.
* NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
*/
+const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
void pci_display_console(bus_space_tag_t, bus_space_tag_t,
pci_chipset_tag_t, int, int, int);
#define alpha_pciide_compat_intr_establish(c, d, p, ch, f, a) \
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/jensenio/com_jensenio.c
--- a/sys/arch/alpha/jensenio/com_jensenio.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/jensenio/com_jensenio.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com_jensenio.c,v 1.13 2011/07/01 19:22:35 dyoung Exp $ */
+/* $NetBSD: com_jensenio.c,v 1.14 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.13 2011/07/01 19:22:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_jensenio.c,v 1.14 2014/03/21 16:39:29 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -112,7 +112,7 @@
aprint_normal_dev(self, "interrupting at vector 0x%x\n",
ja->ja_irq[0]);
- sprintf(jsc->sc_vecstr, "0x%x", ja->ja_irq[0]);
+ snprintf(jsc->sc_vecstr, sizeof(jsc->sc_vecstr), "0x%x", ja->ja_irq[0]);
evcnt_attach_dynamic(&jsc->sc_ev_intr, EVCNT_TYPE_INTR,
NULL, "vector", jsc->sc_vecstr);
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/jensenio/jensenio_intr.c
--- a/sys/arch/alpha/jensenio/jensenio_intr.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/jensenio/jensenio_intr.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: jensenio_intr.c,v 1.10 2012/02/06 02:14:14 matt Exp $ */
+/* $NetBSD: jensenio_intr.c,v 1.11 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.10 2012/02/06 02:14:14 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: jensenio_intr.c,v 1.11 2014/03/21 16:39:29 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -56,7 +56,7 @@
static bus_space_handle_t pic_elcr_ioh;
int jensenio_eisa_intr_map(void *, u_int, eisa_intr_handle_t *);
-const char *jensenio_eisa_intr_string(void *, int);
+const char *jensenio_eisa_intr_string(void *, int, char *, size_t);
const struct evcnt *jensenio_eisa_intr_evcnt(void *, int);
void *jensenio_eisa_intr_establish(void *, int, int, int,
int (*)(void *), void *);
@@ -64,6 +64,7 @@
int jensenio_eisa_intr_alloc(void *, int, int, int *);
#define JENSEN_MAX_IRQ 16
+#define JENSEN_MAX_IRQ_STR 16
struct alpha_shared_intr *jensenio_eisa_intr;
@@ -115,7 +116,8 @@
jensenio_pic_init();
- jensenio_eisa_intr = alpha_shared_intr_alloc(JENSEN_MAX_IRQ, 16);
+ jensenio_eisa_intr = alpha_shared_intr_alloc(JENSEN_MAX_IRQ,
+ JENSEN_MAX_IRQ_STR);
for (i = 0; i < JENSEN_MAX_IRQ; i++) {
alpha_shared_intr_set_dfltsharetype(jensenio_eisa_intr,
i, jensenio_intr_deftype[i]);
@@ -124,7 +126,7 @@
i, 0);
cp = alpha_shared_intr_string(jensenio_eisa_intr, i);
- sprintf(cp, "irq %d", i);
+ snprintf(cp, JENSEN_MAX_IRQ_STR, "irq %d", i);
evcnt_attach_dynamic(alpha_shared_intr_evcnt(
jensenio_eisa_intr, i), EVCNT_TYPE_INTR,
NULL, "eisa", cp);
@@ -178,16 +180,13 @@
}
const char *
-jensenio_eisa_intr_string(void *v, int eirq)
+jensenio_eisa_intr_string(void *v, int eirq, char *buf, size_t len)
{
- static char irqstr[64];
-
if (eirq >= JENSEN_MAX_IRQ)
- panic("jensenio_eisa_intr_string: bogus IRQ %d", eirq);
+ panic("%s: bogus IRQ %d", __func__, eirq);
- sprintf(irqstr, "eisa irq %d", eirq);
-
- return (irqstr);
+ snprintf(buf, len, "eisa irq %d", eirq);
+ return buf;
}
const struct evcnt *
@@ -195,7 +194,7 @@
{
if (eirq >= JENSEN_MAX_IRQ)
- panic("jensenio_eisa_intr_evcnt: bogus IRQ %d", eirq);
+ panic("%s: bogus IRQ %d", __func__, eirq);
return (alpha_shared_intr_evcnt(jensenio_eisa_intr, eirq));
}
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/jensenio/lpt_jensenio.c
--- a/sys/arch/alpha/jensenio/lpt_jensenio.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/jensenio/lpt_jensenio.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt_jensenio.c,v 1.11 2011/07/01 19:22:35 dyoung Exp $ */
+/* $NetBSD: lpt_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lpt_jensenio.c,v 1.11 2011/07/01 19:22:35 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -91,6 +91,7 @@
struct lpt_softc *sc = &jsc->sc_lpt;
struct jensenio_attach_args *ja = aux;
const char *intrstr;
+ char buf[64];
sc->sc_dev = self;
sc->sc_iot = ja->ja_iot;
@@ -106,7 +107,8 @@
lpt_attach_subr(sc);
- intrstr = eisa_intr_string(ja->ja_ec, ja->ja_irq[0]);
+ intrstr = eisa_intr_string_internal(ja->ja_ec, ja->ja_irq[0],
+ buf, sizeof(buf));
jsc->sc_ih = eisa_intr_establish(ja->ja_ec, ja->ja_irq[0],
IST_EDGE, IPL_TTY, lptintr, sc);
if (jsc->sc_ih == NULL) {
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/jensenio/pckbc_jensenio.c
--- a/sys/arch/alpha/jensenio/pckbc_jensenio.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/jensenio/pckbc_jensenio.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc_jensenio.c,v 1.11 2012/02/06 02:14:14 matt Exp $ */
+/* $NetBSD: pckbc_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pckbc_jensenio.c,v 1.11 2012/02/06 02:14:14 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_jensenio.c,v 1.12 2014/03/21 16:39:29 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -148,8 +148,8 @@
aprint_normal_dev(sc->sc_dv, "%s slot interrupting at vector 0x%lx\n",
pckbc_slot_names[slot], jsc->sc_ic[slot].ic_vector);
- sprintf(jsc->sc_ic[slot].ic_vecstr, "0x%lx",
- jsc->sc_ic[slot].ic_vector);
+ snprintf(jsc->sc_ic[slot].ic_vecstr, sizeof(jsc->sc_ic[slot].ic_vecstr),
+ "0x%lx", jsc->sc_ic[slot].ic_vector);
evcnt_attach_dynamic(&jsc->sc_ic[slot].ic_ev, EVCNT_TYPE_INTR,
NULL, "vector", jsc->sc_ic[slot].ic_vecstr);
}
diff -r c4d885bbd8bd -r 6db55c221515 sys/arch/alpha/pci/dwlpx_dma.c
--- a/sys/arch/alpha/pci/dwlpx_dma.c Fri Mar 21 16:26:30 2014 +0000
+++ b/sys/arch/alpha/pci/dwlpx_dma.c Fri Mar 21 16:39:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwlpx_dma.c,v 1.23 2012/02/06 02:14:14 matt Exp $ */
+/* $NetBSD: dwlpx_dma.c,v 1.24 2014/03/21 16:39:29 christos Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.23 2012/02/06 02:14:14 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.24 2014/03/21 16:39:29 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -209,10 +209,12 @@
Home |
Main Index |
Thread Index |
Old Index