Module Name: src Committed By: jruoho Date: Sat Feb 26 14:43:18 UTC 2011
Modified Files: src/sys/arch/x86/x86: cpu.c src/sys/arch/xen/x86: cpu.c Log Message: Use config_defer(9) for cpu_rescan() in cpu_attach(). Also mark few local functions as static. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.55 -r1.56 src/sys/arch/xen/x86/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.86 src/sys/arch/x86/x86/cpu.c:1.87 --- src/sys/arch/x86/x86/cpu.c:1.86 Thu Feb 24 15:42:17 2011 +++ src/sys/arch/x86/x86/cpu.c Sat Feb 26 14:43:18 2011 @@ -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); Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.55 src/sys/arch/xen/x86/cpu.c:1.56 --- src/sys/arch/xen/x86/cpu.c:1.55 Thu Feb 24 19:00:58 2011 +++ src/sys/arch/xen/x86/cpu.c Sat Feb 26 14:43:18 2011 @@ -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);