Wed Dec 31 08:00:31 2008 UTC ()
Search all of mfp(4)'s children automatically, instead of
attaching hard-coded children.  mfp(4) was trying to attach
pow(4) though pow(4) was a pseudo-device for a long time.


(isaki)
diff -r1.20 -r1.21 src/sys/arch/x68k/dev/mfp.c

cvs diff -r1.20 -r1.21 src/sys/arch/x68k/dev/mfp.c (expand / switch to context diff)
--- src/sys/arch/x68k/dev/mfp.c 2008/12/18 02:27:41 1.20
+++ src/sys/arch/x68k/dev/mfp.c 2008/12/31 08:00:31 1.21
@@ -1,4 +1,4 @@
-/*	$NetBSD: mfp.c,v 1.20 2008/12/18 02:27:41 isaki Exp $	*/
+/*	$NetBSD: mfp.c,v 1.21 2008/12/31 08:00:31 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1998 NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfp.c,v 1.20 2008/12/18 02:27:41 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfp.c,v 1.21 2008/12/31 08:00:31 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,6 +57,7 @@
 
 static int mfp_match(struct device *, struct cfdata *, void *);
 static void mfp_attach(struct device *, struct device *, void *);
+static int  mfp_search(device_t, cfdata_t, const int *, void *);
 static void mfp_init(void);
 static void mfp_calibrate_delay(void);
 
@@ -115,9 +116,7 @@
 			panic("IO map for MFP corruption??");
 #endif
 		bus_space_map(ia->ia_bst, ia->ia_addr, 0x2000, 0, &sc->sc_bht);
-		config_found(self, __UNCONST("kbd"), NULL);
-		config_found(self, __UNCONST("clock"), NULL);
-		config_found(self, __UNCONST("pow"), NULL);
+		config_search_ia(mfp_search, self, "mfp", NULL);
 	} else {
 		/*
 		 * Called from config_console;
@@ -125,6 +124,14 @@
 		 */
 		mfp_calibrate_delay();
 	}
+}
+
+static int
+mfp_search(device_t parent, cfdata_t cf, const int *loc, void *aux)
+{
+	if (config_match(parent, cf, __UNCONST(cf->cf_name)) > 0)
+		config_attach(parent, cf, __UNCONST(cf->cf_name), NULL);
+	return 0;
 }
 
 static void