Module Name: src
Committed By: jmcneill
Date: Sat Jun 30 18:07:12 UTC 2018
Modified Files:
src/sys/dev/fdt: fdt_syscon.c fdtvar.h
Log Message:
Add helper to lookup syscon by phandle
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_syscon.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/fdt/fdtvar.h
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/fdt/fdt_syscon.c
diff -u src/sys/dev/fdt/fdt_syscon.c:1.1 src/sys/dev/fdt/fdt_syscon.c:1.2
--- src/sys/dev/fdt/fdt_syscon.c:1.1 Sat Jun 30 12:35:18 2018
+++ src/sys/dev/fdt/fdt_syscon.c Sat Jun 30 18:07:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $ */
+/* $NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -96,3 +96,15 @@ fdtbus_syscon_acquire(int phandle, const
return sc->sc_syscon;
}
+
+struct syscon *
+fdtbus_syscon_lookup(int phandle)
+{
+ struct fdtbus_syscon *sc;
+
+ sc = fdtbus_get_syscon(phandle);
+ if (sc == NULL)
+ return NULL;
+
+ return sc->sc_syscon;
+}
Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.36 src/sys/dev/fdt/fdtvar.h:1.37
--- src/sys/dev/fdt/fdtvar.h:1.36 Sat Jun 30 16:22:56 2018
+++ src/sys/dev/fdt/fdtvar.h Sat Jun 30 18:07:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.36 2018/06/30 16:22:56 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.37 2018/06/30 18:07:12 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -296,6 +296,7 @@ int fdtbus_regulator_set_voltage(struct
int fdtbus_regulator_get_voltage(struct fdtbus_regulator *,
u_int *);
struct syscon * fdtbus_syscon_acquire(int, const char *);
+struct syscon * fdtbus_syscon_lookup(int);
struct fdtbus_dma *fdtbus_dma_get(int, const char *, void (*)(void *), void *);
struct fdtbus_dma *fdtbus_dma_get_index(int, u_int, void (*)(void *),