Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/thorpej-i2c-spi-conf2]: src/sys/dev/ofw The Device Tree bindings state t...
details: https://anonhg.NetBSD.org/src/rev/90e36291628f
branches: thorpej-i2c-spi-conf2
changeset: 985854:90e36291628f
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Sep 11 12:44:49 2021 +0000
description:
The Device Tree bindings state that if a controller has a
child node named "i2c-bus", then that is the node beneath
which the child devices are populated.
diffstat:
sys/dev/ofw/ofw_i2c_subr.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r f2ebd91ef3fa -r 90e36291628f sys/dev/ofw/ofw_i2c_subr.c
--- a/sys/dev/ofw/ofw_i2c_subr.c Sat Sep 11 01:03:18 2021 +0000
+++ b/sys/dev/ofw/ofw_i2c_subr.c Sat Sep 11 12:44:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_i2c_subr.c,v 1.1.16.2 2021/09/10 15:45:28 thorpej Exp $ */
+/* $NetBSD: ofw_i2c_subr.c,v 1.1.16.3 2021/09/11 12:44:49 thorpej Exp $ */
/*
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_i2c_subr.c,v 1.1.16.2 2021/09/10 15:45:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_i2c_subr.c,v 1.1.16.3 2021/09/11 12:44:49 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -139,6 +139,21 @@
i2c_node = devhandle_to_of(call_handle);
+ /*
+ * The Device Tree bindings state that if a controller has a
+ * child node named "i2c-bus", then that is the node beneath
+ * which the child devices are populated.
+ */
+ for (node = OF_child(i2c_node); node != 0; node = OF_peer(node)) {
+ if (OF_getprop(node, "name", name, sizeof(name)) <= 0) {
+ continue;
+ }
+ if (strcmp(name, "i2c-bus") == 0) {
+ i2c_node = node;
+ break;
+ }
+ }
+
for (node = OF_child(i2c_node); node != 0; node = OF_peer(node)) {
if (OF_getprop(node, "name", name, sizeof(name)) <= 0) {
continue;
Home |
Main Index |
Thread Index |
Old Index