Module Name:    src
Committed By:   christos
Date:           Tue Jun 10 22:01:40 UTC 2014

Modified Files:
        src/sys/arch/x86/x86: x86_autoconf.c

Log Message:
centralize the double match warning.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/x86/x86/x86_autoconf.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/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.70 src/sys/arch/x86/x86/x86_autoconf.c:1.71
--- src/sys/arch/x86/x86/x86_autoconf.c:1.70	Thu Apr  3 11:21:52 2014
+++ src/sys/arch/x86/x86/x86_autoconf.c	Tue Jun 10 18:01:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_autoconf.c,v 1.70 2014/04/03 15:21:52 christos Exp $	*/
+/*	$NetBSD: x86_autoconf.c,v 1.71 2014/06/10 22:01:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.70 2014/04/03 15:21:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.71 2014/06/10 22:01:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -70,6 +70,14 @@ int x86_ndisks;
 #define DPRINTF(a)
 #endif
 
+static void
+dmatch(const char *func, device_t dv)
+{
+
+	printf("WARNING: %s: double match for boot device (%s, %s)\n",
+	    func, device_xname(booted_device), device_xname(dv));
+}
+
 static int
 is_valid_disk(device_t dv)
 {
@@ -388,10 +396,7 @@ findroot(void)
 			continue;
  bootwedge_found:
 			if (booted_device) {
-				printf("WARNING: double match for boot "
-				    "device (%s, %s)\n",
-				    device_xname(booted_device),
-				    device_xname(dv));
+				dmatch(__func__, dv);
 				continue;
 			}
 			booted_device = dv;
@@ -450,10 +455,7 @@ findroot(void)
 			continue;
  bootdisk_found:
 			if (booted_device) {
-				printf("WARNING: double match for boot "
-				    "device (%s, %s)\n",
-				    device_xname(booted_device),
-				    device_xname(dv));
+				dmatch(__func__, dv);
 				continue;
 			}
 			booted_device = dv;
@@ -540,8 +542,7 @@ device_register(device_t dev, void *aux)
 
 	if (booted_device != NULL) {
 		/* XXX should be a panic() */
-		printf("WARNING: double match for boot device (%s, %s)\n",
-		    device_xname(booted_device), device_xname(dev));
+		dmatch(__func__, dev);
 	} else
 		booted_device = (isaboot != NULL) ? isaboot : pciboot;
 }

Reply via email to