Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Constify ug2_mb[], so that it lands in .rodata.



details:   https://anonhg.NetBSD.org/src/rev/893905fa4d3c
branches:  trunk
changeset: 323190:893905fa4d3c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jun 03 10:04:40 2018 +0000

description:
Constify ug2_mb[], so that it lands in .rodata.

diffstat:

 sys/dev/ic/ug.c    |  15 ++++++++-------
 sys/dev/ic/ugvar.h |   4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diffs (75 lines):

diff -r 0215184d3c44 -r 893905fa4d3c sys/dev/ic/ug.c
--- a/sys/dev/ic/ug.c   Sun Jun 03 10:01:21 2018 +0000
+++ b/sys/dev/ic/ug.c   Sun Jun 03 10:04:40 2018 +0000
@@ -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 <kefren%netbsd.ro@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -56,7 +56,7 @@
  * 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 @@
        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 @@
        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 @@
 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 -r 0215184d3c44 -r 893905fa4d3c sys/dev/ic/ugvar.h
--- a/sys/dev/ic/ugvar.h        Sun Jun 03 10:01:21 2018 +0000
+++ b/sys/dev/ic/ugvar.h        Sun Jun 03 10:04:40 2018 +0000
@@ -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 <kefren%netbsd.ro@localhost>
@@ -35,7 +35,7 @@
        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 {



Home | Main Index | Thread Index | Old Index