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 fdtbus_get_string helper



details:   https://anonhg.NetBSD.org/src/rev/ccb6ce91948a
branches:  trunk
changeset: 825115:ccb6ce91948a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jun 30 09:11:21 2017 +0000

description:
Add fdtbus_get_string helper

diffstat:

 sys/dev/fdt/fdt_subr.c |  12 ++++++++++--
 sys/dev/fdt/fdtvar.h   |   4 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r b6f49775194b -r ccb6ce91948a sys/dev/fdt/fdt_subr.c
--- a/sys/dev/fdt/fdt_subr.c    Fri Jun 30 09:05:52 2017 +0000
+++ b/sys/dev/fdt/fdt_subr.c    Fri Jun 30 09:11:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.13 2017/06/02 01:07:53 jmcneill Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.14 2017/06/30 09:11:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.13 2017/06/02 01:07:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.14 2017/06/30 09:11:22 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -406,3 +406,11 @@
 
        return strncmp(prop, "ok", 2) == 0;
 }
+
+const char *
+fdtbus_get_string(int phandle, const char *prop)
+{
+       const int off = fdtbus_phandle2offset(phandle);
+
+       return fdt_getprop(fdtbus_get_data(), off, prop, NULL);
+}
diff -r b6f49775194b -r ccb6ce91948a sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h      Fri Jun 30 09:05:52 2017 +0000
+++ b/sys/dev/fdt/fdtvar.h      Fri Jun 30 09:11:21 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.21 2017/06/29 17:04:17 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.22 2017/06/30 09:11:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -294,6 +294,8 @@
 
 bool           fdtbus_status_okay(int);
 
+const char *   fdtbus_get_string(int, const char *);
+
 int            fdtbus_print(void *, const char *);
 
 #endif /* _DEV_FDT_FDTVAR_H */



Home | Main Index | Thread Index | Old Index