Module Name:    src
Committed By:   jmcneill
Date:           Sun Jul  1 21:23:17 UTC 2018

Modified Files:
        src/sys/arch/arm/broadcom: bcm2835_bsc.c

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm2835_bsc.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/arm/broadcom/bcm2835_bsc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.12 src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.13
--- src/sys/arch/arm/broadcom/bcm2835_bsc.c:1.12	Thu Jun  7 05:07:28 2018
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c	Sun Jul  1 21:23:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.12 2018/06/07 05:07:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.13 2018/07/01 21:23:16 jmcneill Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_kernhist.h"
@@ -102,9 +102,6 @@ bsciic_attach(device_t parent, device_t 
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	prop_dictionary_t prop = device_properties(self);
-	prop_dictionary_t devs;
-	uint32_t address_cells;
-	struct i2cbus_attach_args iba;
 	bool disable = false;
 
 	static ONCE_DECL(control);
@@ -172,20 +169,7 @@ bsciic_attach(device_t parent, device_t 
 	sc->sc_i2c.ic_release_bus = bsciic_release_bus;
 	sc->sc_i2c.ic_exec = bsciic_exec;
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", &address_cells))
-		address_cells = 1;
-
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(&iba, 0, sizeof(iba));
-	iba.iba_tag = &sc->sc_i2c;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	config_found_ia(self, "i2cbus", &iba, iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, &sc->sc_i2c, iicbus_print);
 }
 
 void

Reply via email to