Source-Changes-HG archive

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

[src/trunk]: src/sys/arch arm: Use device_set_private for cpuN.



details:   https://anonhg.NetBSD.org/src/rev/c551d799d152
branches:  trunk
changeset: 362581:c551d799d152
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 06:26:05 2022 +0000

description:
arm: Use device_set_private for cpuN.

For cpu at fdt, nix the fdt softc -- this was leaked and never used
for anything.  The device's private storage is the cpu_info.

diffstat:

 sys/arch/aarch64/aarch64/cpu.c |   8 ++++----
 sys/arch/arm/arm32/cpu.c       |   8 ++++----
 sys/arch/arm/fdt/cpu_fdt.c     |  15 +++------------
 3 files changed, 11 insertions(+), 20 deletions(-)

diffs (121 lines):

diff -r a537652b89ba -r c551d799d152 sys/arch/aarch64/aarch64/cpu.c
--- a/sys/arch/aarch64/aarch64/cpu.c    Thu Mar 03 06:25:46 2022 +0000
+++ b/sys/arch/aarch64/aarch64/cpu.c    Thu Mar 03 06:26:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.68 2021/11/12 06:44:46 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.69 2022/03/03 06:26:05 riastradh Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.68 2021/11/12 06:44:46 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.69 2022/03/03 06:26:05 riastradh Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -128,7 +128,7 @@
                cpu_info[ncpu] = ci;
                if (cpu_hatched_p(unit) == 0) {
                        ci->ci_dev = dv;
-                       dv->dv_private = ci;
+                       device_set_private(dv, ci);
                        ci->ci_index = -1;
 
                        aprint_naive(": disabled\n");
@@ -143,7 +143,7 @@
        }
 
        ci->ci_dev = dv;
-       dv->dv_private = ci;
+       device_set_private(dv, ci);
 
        ci->ci_kfpu_spl = -1;
 
diff -r a537652b89ba -r c551d799d152 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Thu Mar 03 06:25:46 2022 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Thu Mar 03 06:26:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.152 2021/10/31 16:23:47 skrll Exp $  */
+/*     $NetBSD: cpu.c,v 1.153 2022/03/03 06:26:05 riastradh Exp $      */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.152 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.153 2022/03/03 06:26:05 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -128,7 +128,7 @@
                cpu_info[unit] = ci;
                if (cpu_hatched_p(unit) == false) {
                        ci->ci_dev = dv;
-                       dv->dv_private = ci;
+                       device_set_private(dv, ci);
                        aprint_naive(": disabled\n");
                        aprint_normal(": disabled (unresponsive)\n");
                        return;
@@ -141,7 +141,7 @@
        }
 
        ci->ci_dev = dv;
-       dv->dv_private = ci;
+       device_set_private(dv, ci);
 
        arm_cpu_do_topology(ci);
 
diff -r a537652b89ba -r c551d799d152 sys/arch/arm/fdt/cpu_fdt.c
--- a/sys/arch/arm/fdt/cpu_fdt.c        Thu Mar 03 06:25:46 2022 +0000
+++ b/sys/arch/arm/fdt/cpu_fdt.c        Thu Mar 03 06:26:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.41 2021/08/30 23:16:17 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.42 2022/03/03 06:26:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.41 2021/08/30 23:16:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.42 2022/03/03 06:26:05 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -57,12 +57,7 @@
 static int     cpu_fdt_match(device_t, cfdata_t, void *);
 static void    cpu_fdt_attach(device_t, device_t, void *);
 
-struct cpu_fdt_softc {
-       device_t                sc_dev;
-       int                     sc_phandle;
-};
-
-CFATTACH_DECL_NEW(cpu_fdt, sizeof(struct cpu_fdt_softc),
+CFATTACH_DECL_NEW(cpu_fdt, 0,
        cpu_fdt_match, cpu_fdt_attach, NULL, NULL);
 
 static int
@@ -80,16 +75,12 @@
 static void
 cpu_fdt_attach(device_t parent, device_t self, void *aux)
 {
-       struct cpu_fdt_softc * const sc = device_private(self);
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
        bus_addr_t cpuid;
        const uint32_t *cap_ptr;
        int len;
 
-       sc->sc_dev = self;
-       sc->sc_phandle = phandle;
-
        cap_ptr = fdtbus_get_prop(phandle, "capacity-dmips-mhz", &len);
        if (cap_ptr && len == 4) {
                prop_dictionary_t dict = device_properties(self);



Home | Main Index | Thread Index | Old Index