Module Name:    src
Committed By:   jakllsch
Date:           Wed Feb 27 17:01:57 UTC 2019

Modified Files:
        src/sys/dev/fdt: fdt_intr.c fdtvar.h

Log Message:
Add fdtbus_intr_establish_byname() helper.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/fdt_intr.c
cvs rdiff -u -r1.49 -r1.50 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_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.20 src/sys/dev/fdt/fdt_intr.c:1.21
--- src/sys/dev/fdt/fdt_intr.c:1.20	Tue Nov 13 01:06:37 2018
+++ src/sys/dev/fdt/fdt_intr.c	Wed Feb 27 17:01:57 2019
@@ -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 <[email protected]>
@@ -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 @@ fdtbus_intr_establish(int phandle, u_int
 }
 
 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)
 {

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.49 src/sys/dev/fdt/fdtvar.h:1.50
--- src/sys/dev/fdt/fdtvar.h:1.49	Wed Feb 27 16:56:00 2019
+++ src/sys/dev/fdt/fdtvar.h	Wed Feb 27 17:01:57 2019
@@ -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 <[email protected]>
@@ -283,6 +283,8 @@ i2c_tag_t	fdtbus_get_i2c_tag(int);
 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 *);

Reply via email to