Sun Mar 8 08:25:36 2020 UTC ()
Use MUTEX_DEFAULT to avoid confusion


(skrll)
diff -r1.25 -r1.26 src/sys/dev/fdt/fdt_intr.c

cvs diff -r1.25 -r1.26 src/sys/dev/fdt/fdt_intr.c (expand / switch to unified diff)

--- src/sys/dev/fdt/fdt_intr.c 2020/02/16 20:28:18 1.25
+++ src/sys/dev/fdt/fdt_intr.c 2020/03/08 08:25:36 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $ */ 1/* $NetBSD: fdt_intr.c,v 1.26 2020/03/08 08:25:36 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015-2018 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015-2018 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.25 2020/02/16 20:28:18 thorpej Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.26 2020/03/08 08:25:36 skrll Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/atomic.h> 33#include <sys/atomic.h>
34#include <sys/bus.h> 34#include <sys/bus.h>
35#include <sys/kmem.h> 35#include <sys/kmem.h>
36#include <sys/queue.h> 36#include <sys/queue.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/condvar.h> 38#include <sys/condvar.h>
39 39
40#include <libfdt.h> 40#include <libfdt.h>
41#include <dev/fdt/fdtvar.h> 41#include <dev/fdt/fdtvar.h>
42#include <dev/fdt/fdt_private.h> 42#include <dev/fdt/fdt_private.h>
43 43
@@ -63,27 +63,27 @@ struct fdtbus_interrupt_cookie { @@ -63,27 +63,27 @@ struct fdtbus_interrupt_cookie {
63static LIST_HEAD(, fdtbus_interrupt_cookie) fdtbus_interrupt_cookies = 63static LIST_HEAD(, fdtbus_interrupt_cookie) fdtbus_interrupt_cookies =
64 LIST_HEAD_INITIALIZER(fdtbus_interrupt_cookies); 64 LIST_HEAD_INITIALIZER(fdtbus_interrupt_cookies);
65static kmutex_t fdtbus_interrupt_cookie_mutex; 65static kmutex_t fdtbus_interrupt_cookie_mutex;
66static kcondvar_t fdtbus_interrupt_cookie_wait; 66static kcondvar_t fdtbus_interrupt_cookie_wait;
67static bool fdtbus_interrupt_cookies_wanted; 67static bool fdtbus_interrupt_cookies_wanted;
68 68
69static const u_int * get_specifier_by_index(int, int, int *); 69static const u_int * get_specifier_by_index(int, int, int *);
70static const u_int * get_specifier_from_map(int, const u_int *, int *); 70static const u_int * get_specifier_from_map(int, const u_int *, int *);
71 71
72void 72void
73fdtbus_intr_init(void) 73fdtbus_intr_init(void)
74{ 74{
75 75
76 mutex_init(&fdtbus_interrupt_cookie_mutex, MUTEX_SPIN, IPL_HIGH); 76 mutex_init(&fdtbus_interrupt_cookie_mutex, MUTEX_DEFAULT, IPL_HIGH);
77 cv_init(&fdtbus_interrupt_cookie_wait, "fdtintr"); 77 cv_init(&fdtbus_interrupt_cookie_wait, "fdtintr");
78} 78}
79 79
80/* 80/*
81 * Find the interrupt controller for a given node. This function will either 81 * Find the interrupt controller for a given node. This function will either
82 * return the phandle of the interrupt controller for this node, or the phandle 82 * return the phandle of the interrupt controller for this node, or the phandle
83 * of a node containing an interrupt-map table that can be used to find the 83 * of a node containing an interrupt-map table that can be used to find the
84 * real interrupt controller. 84 * real interrupt controller.
85 */ 85 */
86static int 86static int
87fdtbus_get_interrupt_parent(int phandle) 87fdtbus_get_interrupt_parent(int phandle)
88{ 88{
89 int iparent = phandle; 89 int iparent = phandle;