Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Use machdep.cpu for the first instance



details:   https://anonhg.NetBSD.org/src/rev/26d53e455d66
branches:  trunk
changeset: 835989:26d53e455d66
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 20 09:19:56 2018 +0000

description:
Use machdep.cpu for the first instance

diffstat:

 sys/dev/fdt/cpufreq_dt.c |  24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)

diffs (53 lines):

diff -r 73013d914a77 -r 26d53e455d66 sys/dev/fdt/cpufreq_dt.c
--- a/sys/dev/fdt/cpufreq_dt.c  Thu Sep 20 09:03:36 2018 +0000
+++ b/sys/dev/fdt/cpufreq_dt.c  Thu Sep 20 09:19:56 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.5 2018/09/01 23:41:16 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.6 2018/09/20 09:19:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.5 2018/09/01 23:41:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.6 2018/09/20 09:19:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -250,20 +250,6 @@
        return error;
 }
 
-static int
-cpufreq_dt_instance_count(void)
-{
-       deviter_t di;
-       int count = 0;
-
-       deviter_init(&di, 0);
-       while (deviter_next(&di) != NULL)
-               ++count;
-       deviter_release(&di);
-
-       return count;
-}
-
 static void
 cpufreq_dt_init_sysctl(struct cpufreq_dt_softc *sc)
 {
@@ -279,10 +265,10 @@
                strcat(sc->sc_freq_available, buf);
        }
 
-       if (cpufreq_dt_instance_count() > 1)
+       if (device_unit(sc->sc_dev) == 0)
+               cpunodename = "cpu";
+       else
                cpunodename = device_xname(sc->sc_dev);
-       else
-               cpunodename = "cpu";
 
        error = sysctl_createv(&cpufreq_log, 0, NULL, &node,
            CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,



Home | Main Index | Thread Index | Old Index