diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2020-07-09 01:08:56 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2020-07-09 01:08:56 +0000 |
commit | 8c651da5890b98b62e4c168f26f7da07907b8097 (patch) | |
tree | c37770bc4f25ac0c91a582ca45aeeeed93e63ffb /sys/dev | |
parent | 6f89bfd8ed322011b7419e32b18c780879df5cbf (diff) |
a couple of small tweaks that shrink the kstat code.
saves a few hundred bytes on both amd64 and sparc64
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_mcx.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index 55210050d72..49778d78f37 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.60 2020/07/07 04:42:35 dlg Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.61 2020/07/09 01:08:55 dlg Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -7202,7 +7202,7 @@ mcx_hwmem_free(struct mcx_softc *sc, struct mcx_hwmem *mhm) #if NKSTAT > 0 struct mcx_ppcnt { - const char *name; + char name[KSTAT_KV_NAMELEN]; enum kstat_kv_unit unit; }; @@ -7414,6 +7414,13 @@ struct mcx_kstat_mtmp { struct kstat_kv ktmp_threshold_hi; }; +static const struct mcx_kstat_mtmp mcx_kstat_mtmp_tpl = { + KSTAT_KV_INITIALIZER("name", KSTAT_KV_T_ISTR), + KSTAT_KV_INITIALIZER("temperature", KSTAT_KV_T_TEMP), + KSTAT_KV_INITIALIZER("lo threshold", KSTAT_KV_T_TEMP), + KSTAT_KV_INITIALIZER("hi threshold", KSTAT_KV_T_TEMP), +}; + static const struct timeval mcx_kstat_mtmp_rate = { 1, 0 }; static int mcx_kstat_mtmp_read(struct kstat *); @@ -7453,13 +7460,7 @@ mcx_kstat_attach_tmps(struct mcx_softc *sc) } ktmp = malloc(sizeof(*ktmp), M_DEVBUF, M_WAITOK|M_ZERO); - kstat_kv_init(&ktmp->ktmp_name, "name", KSTAT_KV_T_ISTR); - kstat_kv_init(&ktmp->ktmp_temperature, "temperature", - KSTAT_KV_T_TEMP); - kstat_kv_init(&ktmp->ktmp_threshold_lo, "lo threshold", - KSTAT_KV_T_TEMP); - kstat_kv_init(&ktmp->ktmp_threshold_hi, "hi threshold", - KSTAT_KV_T_TEMP); + *ktmp = mcx_kstat_mtmp_tpl; ks->ks_data = ktmp; ks->ks_datalen = sizeof(*ktmp); |