From a2aecb60e1fe334569a7da773c2a4a32668795d0 Mon Sep 17 00:00:00 2001 From: maxv Date: Sun, 3 Jun 2018 10:04:40 +0000 Subject: [PATCH] Constify ug2_mb[], so that it lands in .rodata. --- sys/dev/ic/ug.c | 15 ++++++++------- sys/dev/ic/ugvar.h | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/ic/ug.c b/sys/dev/ic/ug.c index 16e95fc81ddd..ac5a9a91e840 100644 --- a/sys/dev/ic/ug.c +++ b/sys/dev/ic/ug.c @@ -1,4 +1,4 @@ -/* $NetBSD: ug.c,v 1.12 2011/06/20 18:12:06 pgoyette Exp $ */ +/* $NetBSD: ug.c,v 1.13 2018/06/03 10:04:40 maxv Exp $ */ /* * Copyright (c) 2007 Mihai Chelaru @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ug.c,v 1.12 2011/06/20 18:12:06 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ug.c,v 1.13 2018/06/03 10:04:40 maxv Exp $"); #include #include @@ -56,7 +56,7 @@ uint8_t ug_ver; * Imported from linux driver */ -struct ug2_motherboard_info ug2_mb[] = { +static const struct ug2_motherboard_info ug2_mb[] = { { 0x000C, "unknown. Please send-pr(1)", { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, @@ -485,8 +485,8 @@ ug2_attach(device_t dv) struct ug_softc *sc = device_private(dv); uint8_t buf[2]; int i; - struct ug2_motherboard_info *ai; - struct ug2_sensor_info *si; + const struct ug2_motherboard_info *ai; + const struct ug2_sensor_info *si; aprint_normal(": Abit uGuru 2005 system monitor\n"); @@ -509,7 +509,7 @@ ug2_attach(device_t dv) aprint_normal_dev(dv, "mainboard %s (%.2X%.2X)\n", ai->name, buf[0], buf[1]); - sc->mbsens = (void*)ai->sensors; + sc->mbsens = (const void *)ai->sensors; sc->sc_sme = sysmon_envsys_create(); for (i = 0, si = ai->sensors; si && si->name; si++, i++) { @@ -552,7 +552,8 @@ void ug2_refresh(struct sysmon_envsys *sme, envsys_data_t *edata) { struct ug_softc *sc = sme->sme_cookie; - struct ug2_sensor_info *si = (struct ug2_sensor_info *)sc->mbsens; + const struct ug2_sensor_info *si = + (const struct ug2_sensor_info *)sc->mbsens; int rfact = 1; uint8_t v; diff --git a/sys/dev/ic/ugvar.h b/sys/dev/ic/ugvar.h index f9e9f3151b0f..1f8bb9153a53 100644 --- a/sys/dev/ic/ugvar.h +++ b/sys/dev/ic/ugvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ugvar.h,v 1.4 2008/03/26 16:09:37 xtraeme Exp $ */ +/* $NetBSD: ugvar.h,v 1.5 2018/06/03 10:04:40 maxv Exp $ */ /* * Copyright (c) 2007 Mihai Chelaru @@ -35,7 +35,7 @@ struct ug_softc { struct sysmon_envsys *sc_sme; envsys_data_t sc_sensor[UG_MAX_SENSORS]; uint8_t version; - void *mbsens; + const void *mbsens; }; struct ug2_sensor_info {