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_intr_establish_byname() helper.



details:   https://anonhg.NetBSD.org/src/rev/431bfe3250b5
branches:  trunk
changeset: 997220:431bfe3250b5
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Feb 27 17:01:57 2019 +0000

description:
Add fdtbus_intr_establish_byname() helper.

diffstat:

 sys/dev/fdt/fdt_intr.c |  18 ++++++++++++++++--
 sys/dev/fdt/fdtvar.h   |   4 +++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diffs (57 lines):

diff -r 2877b7658cd1 -r 431bfe3250b5 sys/dev/fdt/fdt_intr.c
--- a/sys/dev/fdt/fdt_intr.c    Wed Feb 27 16:56:00 2019 +0000
+++ b/sys/dev/fdt/fdt_intr.c    Wed Feb 27 17:01:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.20 2018/11/13 01:06:37 jakllsch Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.21 2019/02/27 17:01:57 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.20 2018/11/13 01:06:37 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.21 2019/02/27 17:01:57 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -146,6 +146,20 @@
 }
 
 void *
+fdtbus_intr_establish_byname(int phandle, const char *name, int ipl,
+    int flags, int (*func)(void *), void *arg)
+{
+       u_int index;
+       int err;
+
+       err = fdtbus_get_index(phandle, "interrupt-names", name, &index);
+       if (err != 0)
+               return NULL;
+
+       return fdtbus_intr_establish(phandle, index, ipl, flags, func, arg);
+}
+
+void *
 fdtbus_intr_establish_raw(int ihandle, const u_int *specifier, int ipl,
     int flags, int (*func)(void *), void *arg)
 {
diff -r 2877b7658cd1 -r 431bfe3250b5 sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h      Wed Feb 27 16:56:00 2019 +0000
+++ b/sys/dev/fdt/fdtvar.h      Wed Feb 27 17:01:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.49 2019/02/27 16:56:00 jakllsch Exp $ */
+/* $NetBSD: fdtvar.h,v 1.50 2019/02/27 17:01:57 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -283,6 +283,8 @@
 i2c_tag_t      fdtbus_i2c_acquire(int, const char *);
 void *         fdtbus_intr_establish(int, u_int, int, int,
                    int (*func)(void *), void *arg);
+void *         fdtbus_intr_establish_byname(int, const char *, int, int,
+                   int (*func)(void *), void *arg);
 void *         fdtbus_intr_establish_raw(int, const u_int *, int, int,
                    int (*func)(void *), void *arg);
 void           fdtbus_intr_disestablish(int, void *);



Home | Main Index | Thread Index | Old Index