Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use config_defer(9) for cpu_rescan() in cpu_attach().



details:   https://anonhg.NetBSD.org/src/rev/dfdbff1de45a
branches:  trunk
changeset: 762728:dfdbff1de45a
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Feb 26 14:43:18 2011 +0000

description:
Use config_defer(9) for cpu_rescan() in cpu_attach().
Also mark few local functions as static.

diffstat:

 sys/arch/x86/x86/cpu.c |  29 +++++++++++++++++------------
 sys/arch/xen/x86/cpu.c |  43 +++++++++++++++++++++++++------------------
 2 files changed, 42 insertions(+), 30 deletions(-)

diffs (195 lines):

diff -r db6949df7e36 -r dfdbff1de45a sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Sat Feb 26 13:58:34 2011 +0000
+++ b/sys/arch/x86/x86/cpu.c    Sat Feb 26 14:43:18 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.86 2011/02/24 15:42:17 jruoho Exp $  */
+/*     $NetBSD: cpu.c,v 1.87 2011/02/26 14:43:18 jruoho Exp $  */
 
 /*-
  * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.86 2011/02/24 15:42:17 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.87 2011/02/26 14:43:18 jruoho Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
@@ -117,12 +117,11 @@
 #error cpu_info contains 32bit bitmasks
 #endif
 
-int     cpu_match(device_t, cfdata_t, void *);
-void    cpu_attach(device_t, device_t, void *);
-int    cpu_rescan(device_t, const char *, const int *);
-void   cpu_childdetached(device_t, device_t);
-
-
+static int     cpu_match(device_t, cfdata_t, void *);
+static void    cpu_attach(device_t, device_t, void *);
+static void    cpu_defer(device_t);
+static int     cpu_rescan(device_t, const char *, const int *);
+static void    cpu_childdetached(device_t, device_t);
 static bool    cpu_suspend(device_t, const pmf_qual_t *);
 static bool    cpu_resume(device_t, const pmf_qual_t *);
 static bool    cpu_shutdown(device_t, int);
@@ -214,7 +213,7 @@
        pmap_update(pmap_kernel());
 }
 
-int
+static int
 cpu_match(device_t parent, cfdata_t match, void *aux)
 {
 
@@ -274,7 +273,7 @@
 }
 
 
-void
+static void
 cpu_attach(device_t parent, device_t self, void *aux)
 {
        struct cpu_softc *sc = device_private(self);
@@ -449,10 +448,16 @@
                );
        }
 
+       (void)config_defer(self, cpu_defer);
+}
+
+static void
+cpu_defer(device_t self)
+{
        cpu_rescan(self, NULL, NULL);
 }
 
-int
+static int
 cpu_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct cpu_softc *sc = device_private(self);
@@ -486,7 +491,7 @@
        return 0;
 }
 
-void
+static void
 cpu_childdetached(device_t self, device_t child)
 {
        struct cpu_softc *sc = device_private(self);
diff -r db6949df7e36 -r dfdbff1de45a sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Sat Feb 26 13:58:34 2011 +0000
+++ b/sys/arch/xen/x86/cpu.c    Sat Feb 26 14:43:18 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.55 2011/02/24 19:00:58 jruoho Exp $  */
+/*     $NetBSD: cpu.c,v 1.56 2011/02/26 14:43:18 jruoho Exp $  */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.55 2011/02/24 19:00:58 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56 2011/02/26 14:43:18 jruoho Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -115,14 +115,15 @@
 #error cpu_info contains 32bit bitmasks
 #endif
 
-int    cpu_match(device_t, cfdata_t, void *);
-void   cpu_attach(device_t, device_t, void *);
-int    cpu_rescan(device_t, const char *, const int *);
-void   cpu_childdetached(device_t, device_t);
-int    vcpu_match(device_t, cfdata_t, void *);
-void   vcpu_attach(device_t, device_t, void *);
-void   cpu_attach_common(device_t, device_t, void *);
-void   cpu_offline_md(void);
+static int     cpu_match(device_t, cfdata_t, void *);
+static void    cpu_attach(device_t, device_t, void *);
+static void    cpu_defer(device_t);
+static int     cpu_rescan(device_t, const char *, const int *);
+static void    cpu_childdetached(device_t, device_t);
+static int     vcpu_match(device_t, cfdata_t, void *);
+static void    vcpu_attach(device_t, device_t, void *);
+static void    cpu_attach_common(device_t, device_t, void *);
+void           cpu_offline_md(void);
 
 struct cpu_softc {
        device_t sc_dev;                /* device tree glue */
@@ -209,14 +210,14 @@
 }
 #endif /* MULTIPROCESSOR */
 
-int
+static int
 cpu_match(device_t parent, cfdata_t match, void *aux)
 {
 
        return 1;
 }
 
-void
+static void
 cpu_attach(device_t parent, device_t self, void *aux)
 {
        struct cpu_softc *sc = device_private(self);
@@ -270,10 +271,16 @@
        if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
 
-       return;
+       (void)config_defer(self, cpu_defer);
 }
 
-int
+static void
+cpu_defer(device_t self)
+{
+       cpu_rescan(self, NULL, NULL);
+}
+
+static int
 cpu_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct cpu_softc *sc = device_private(self);
@@ -295,7 +302,7 @@
        return 0;
 }
 
-void
+static void
 cpu_childdetached(device_t self, device_t child)
 {
        struct cpu_softc *sc = device_private(self);
@@ -305,7 +312,7 @@
                ci->ci_frequency = NULL;
 }
 
-int
+static int
 vcpu_match(device_t parent, cfdata_t match, void *aux)
 {
        struct vcpu_attach_args *vcaa = aux;
@@ -315,7 +322,7 @@
        return 0;
 }
 
-void
+static void
 vcpu_attach(device_t parent, device_t self, void *aux)
 {
        struct vcpu_attach_args *vcaa = aux;
@@ -358,7 +365,7 @@
        uvm_page_recolor(ncolors);
 }
 
-void
+static void
 cpu_attach_common(device_t parent, device_t self, void *aux)
 {
        struct cpu_softc *sc = device_private(self);



Home | Main Index | Thread Index | Old Index