| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: drm_wait_netbsd.h,v 1.4 2014/07/16 20:59:58 riastradh Exp $ */ | | 1 | /* $NetBSD: drm_wait_netbsd.h,v 1.4.2.1 2014/09/21 18:00:33 snj Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -167,26 +167,27 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, | | | @@ -167,26 +167,27 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, |
167 | /* | | 167 | /* |
168 | * XXX Can't assert sleepable here because we hold a spin lock. At | | 168 | * XXX Can't assert sleepable here because we hold a spin lock. At |
169 | * least we can assert that we're not in (soft) interrupt context, and | | 169 | * least we can assert that we're not in (soft) interrupt context, and |
170 | * hope that nobody tries to use these with a sometimes quickly | | 170 | * hope that nobody tries to use these with a sometimes quickly |
171 | * satisfied condition while holding a different spin lock. | | 171 | * satisfied condition while holding a different spin lock. |
172 | */ | | 172 | */ |
173 | | | 173 | |
174 | #define _DRM_SPIN_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, CONDITION) do \ | | 174 | #define _DRM_SPIN_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, CONDITION) do \ |
175 | { \ | | 175 | { \ |
176 | KASSERT(spin_is_locked((INTERLOCK))); \ | | 176 | KASSERT(spin_is_locked((INTERLOCK))); \ |
177 | KASSERT(!cpu_intr_p()); \ | | 177 | KASSERT(!cpu_intr_p()); \ |
178 | KASSERT(!cpu_softintr_p()); \ | | 178 | KASSERT(!cpu_softintr_p()); \ |
179 | KASSERT(!cold); \ | | 179 | KASSERT(!cold); \ |
| | | 180 | (RET) = 0; \ |
180 | while (!(CONDITION)) { \ | | 181 | while (!(CONDITION)) { \ |
181 | /* XXX errno NetBSD->Linux */ \ | | 182 | /* XXX errno NetBSD->Linux */ \ |
182 | (RET) = -WAIT((Q), &(INTERLOCK)->sl_lock); \ | | 183 | (RET) = -WAIT((Q), &(INTERLOCK)->sl_lock); \ |
183 | if (RET) \ | | 184 | if (RET) \ |
184 | break; \ | | 185 | break; \ |
185 | } \ | | 186 | } \ |
186 | } while (0) | | 187 | } while (0) |
187 | | | 188 | |
188 | #define DRM_SPIN_WAIT_NOINTR_UNTIL(RET, Q, I, C) \ | | 189 | #define DRM_SPIN_WAIT_NOINTR_UNTIL(RET, Q, I, C) \ |
189 | _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_nointr, Q, I, C) | | 190 | _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_nointr, Q, I, C) |
190 | | | 191 | |
191 | #define DRM_SPIN_WAIT_UNTIL(RET, Q, I, C) \ | | 192 | #define DRM_SPIN_WAIT_UNTIL(RET, Q, I, C) \ |
192 | _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_sig, Q, I, C) | | 193 | _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_sig, Q, I, C) |