Module Name:    src
Committed By:   pgoyette
Date:           Wed Mar 14 02:57:10 UTC 2012

Modified Files:
        src/sys/dev/i2c: i2c.c

Log Message:
Don't try to match a device if there's already a device attached at
the specified address.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/i2c/i2c.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/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.37 src/sys/dev/i2c/i2c.c:1.38
--- src/sys/dev/i2c/i2c.c:1.37	Tue Oct 11 15:19:09 2011
+++ src/sys/dev/i2c/i2c.c	Wed Mar 14 02:57:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.37 2011/10/11 15:19:09 macallan Exp $	*/
+/*	$NetBSD: i2c.c,v 1.38 2012/03/14 02:57:10 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.37 2011/10/11 15:19:09 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.38 2012/03/14 02:57:10 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,10 +118,10 @@ iic_search(device_t parent, cfdata_t cf,
 	ia.ia_ncompat = 0;
 	ia.ia_compat = NULL;
 
-	if (config_match(parent, cf, &ia) > 0) {
-		if (ia.ia_addr != (i2c_addr_t)-1 &&
-		    ia.ia_addr <= I2C_MAX_ADDR &&
-		    !sc->sc_devices[ia.ia_addr])
+	if (ia.ia_addr != (i2c_addr_t)-1 &&
+	    ia.ia_addr <= I2C_MAX_ADDR &&
+	    !sc->sc_devices[ia.ia_addr])
+		if (config_match(parent, cf, &ia) > 0) {
 			sc->sc_devices[ia.ia_addr] =
 			    config_attach(parent, cf, &ia, iic_print);
 	}

Reply via email to