Wed Jul 24 03:08:03 2013 UTC ()
Add DRM_WAITERS_P and DRM_SPIN_WAITERS_P to drm_wait_netbsd.h.


(riastradh)
diff -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h

cvs diff -r1.1.2.5 -r1.1.2.6 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h 2013/07/24 02:36:31 1.1.2.5
+++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h 2013/07/24 03:08:03 1.1.2.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.5 2013/07/24 02:36:31 riastradh Exp $ */ 1/* $NetBSD: drm_wait_netbsd.h,v 1.1.2.6 2013/07/24 03:08:03 riastradh 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.
@@ -47,40 +47,54 @@ typedef kcondvar_t drm_waitqueue_t; @@ -47,40 +47,54 @@ typedef kcondvar_t drm_waitqueue_t;
47 47
48static inline void 48static inline void
49DRM_INIT_WAITQUEUE(drm_waitqueue_t *q, const char *name) 49DRM_INIT_WAITQUEUE(drm_waitqueue_t *q, const char *name)
50{ 50{
51 cv_init(q, name); 51 cv_init(q, name);
52} 52}
53 53
54static inline void 54static inline void
55DRM_DESTROY_WAITQUEUE(drm_waitqueue_t *q) 55DRM_DESTROY_WAITQUEUE(drm_waitqueue_t *q)
56{ 56{
57 cv_destroy(q); 57 cv_destroy(q);
58} 58}
59 59
 60static inline bool
 61DRM_WAITERS_P(drm_waitqueue_t *q, struct mutex *interlock)
 62{
 63 KASSERT(mutex_is_locked(interlock));
 64 return cv_has_waiters(q);
 65}
 66
60static inline void 67static inline void
61DRM_WAKEUP_ONE(drm_waitqueue_t *q, struct mutex *interlock) 68DRM_WAKEUP_ONE(drm_waitqueue_t *q, struct mutex *interlock)
62{ 69{
63 KASSERT(mutex_is_locked(interlock)); 70 KASSERT(mutex_is_locked(interlock));
64 cv_signal(q); 71 cv_signal(q);
65} 72}
66 73
67static inline void 74static inline void
68DRM_WAKEUP_ALL(drm_waitqueue_t *q, struct mutex *interlock) 75DRM_WAKEUP_ALL(drm_waitqueue_t *q, struct mutex *interlock)
69{ 76{
70 KASSERT(mutex_is_locked(interlock)); 77 KASSERT(mutex_is_locked(interlock));
71 cv_broadcast(q); 78 cv_broadcast(q);
72} 79}
73 80
 81static inline bool
 82DRM_SPIN_WAITERS_P(drm_waitqueue_t *q, spinlock_t *interlock)
 83{
 84 KASSERT(spin_is_locked(interlock));
 85 return cv_has_waiters(q);
 86}
 87
74static inline void 88static inline void
75DRM_SPIN_WAKEUP_ONE(drm_waitqueue_t *q, spinlock_t *interlock) 89DRM_SPIN_WAKEUP_ONE(drm_waitqueue_t *q, spinlock_t *interlock)
76{ 90{
77 KASSERT(spin_is_locked(interlock)); 91 KASSERT(spin_is_locked(interlock));
78 cv_signal(q); 92 cv_signal(q);
79} 93}
80 94
81static inline void 95static inline void
82DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, spinlock_t *interlock) 96DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, spinlock_t *interlock)
83{ 97{
84 KASSERT(spin_is_locked(interlock)); 98 KASSERT(spin_is_locked(interlock));
85 cv_broadcast(q); 99 cv_broadcast(q);
86} 100}