Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt Add helper to lookup syscon by phandle



details:   https://anonhg.NetBSD.org/src/rev/2408a71c3cea
branches:  trunk
changeset: 362894:2408a71c3cea
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jun 30 18:07:12 2018 +0000

description:
Add helper to lookup syscon by phandle

diffstat:

 sys/dev/fdt/fdt_syscon.c |  16 ++++++++++++++--
 sys/dev/fdt/fdtvar.h     |   3 ++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diffs (51 lines):

diff -r fa32ae9769f7 -r 2408a71c3cea sys/dev/fdt/fdt_syscon.c
--- a/sys/dev/fdt/fdt_syscon.c  Sat Jun 30 17:54:07 2018 +0000
+++ b/sys/dev/fdt/fdt_syscon.c  Sat Jun 30 18:07:12 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 
        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;
+}
diff -r fa32ae9769f7 -r 2408a71c3cea sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h      Sat Jun 30 17:54:07 2018 +0000
+++ b/sys/dev/fdt/fdtvar.h      Sat Jun 30 18:07:12 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -296,6 +296,7 @@
 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 *),



Home | Main Index | Thread Index | Old Index