summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/drm/drm_linux.h43
-rw-r--r--sys/sys/mutex.h21
2 files changed, 11 insertions, 53 deletions
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index bc76aa4ed88..e525e585367 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.59 2017/08/10 14:18:31 guenther Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.60 2017/08/12 16:28:01 guenther Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@@ -491,7 +491,6 @@ typedef struct mutex spinlock_t;
#define DEFINE_SPINLOCK(x) struct mutex x
#define DEFINE_MUTEX(x) struct rwlock x
-#ifdef WITNESS
static inline void
_spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags
LOCK_FL_VARS)
@@ -508,18 +507,6 @@ _spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags
_spin_lock_irqsave(m, fl LOCK_FILE_LINE)
#define spin_unlock_irqrestore(m, fl) \
_spin_unlock_irqrestore(m, fl LOCK_FILE_LINE)
-#else /* !WITNESS */
-static inline void
-spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags)
-{
- mtx_enter(mtxp);
-}
-static inline void
-spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags)
-{
- mtx_leave(mtxp);
-}
-#endif /* !WITNESS */
#define spin_lock(mtxp) mtx_enter(mtxp)
@@ -666,7 +653,6 @@ init_completion(struct completion *x)
mtx_init(&x->wait.lock, IPL_NONE);
}
-#ifdef WITNESS
static inline u_long
_wait_for_completion_interruptible_timeout(struct completion *x, u_long timo
LOCK_FL_VARS)
@@ -696,33 +682,6 @@ _complete_all(struct completion *x LOCK_FL_VARS)
wakeup(x);
}
#define complete_all(x) _complete_all(x LOCK_FILE_LINE)
-#else /* !WITNESS */
-static inline u_long
-wait_for_completion_interruptible_timeout(struct completion *x, u_long timo)
-{
- int ret;
-
- mtx_enter(&x->wait.lock);
- while (x->done == 0) {
- ret = msleep(x, &x->wait.lock, PCATCH, "wfcit", timo);
- if (ret) {
- mtx_leave(&x->wait.lock);
- return (ret == EWOULDBLOCK) ? 0 : -ret;
- }
- }
-
- return 1;
-}
-
-static inline void
-complete_all(struct completion *x)
-{
- mtx_enter(&x->wait.lock);
- x->done = 1;
- mtx_leave(&x->wait.lock);
- wakeup(x);
-}
-#endif /* !WITNESS */
struct workqueue_struct;
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 20abc7f7f99..3554e4e2cbe 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.9 2017/05/16 13:30:48 dlg Exp $ */
+/* $OpenBSD: mutex.h,v 1.10 2017/08/12 16:28:01 guenther Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -75,6 +75,11 @@ void __mtx_enter(struct mutex *);
int __mtx_enter_try(struct mutex *);
void __mtx_leave(struct mutex *);
+#define mtx_init(m, ipl) mtx_init_flags(m, ipl, NULL, 0)
+#define mtx_enter(m) _mtx_enter(m LOCK_FILE_LINE)
+#define mtx_enter_try(m) _mtx_enter_try(m LOCK_FILE_LINE)
+#define mtx_leave(m) _mtx_leave(m LOCK_FILE_LINE)
+
#ifdef WITNESS
void _mtx_init_flags(struct mutex *, int, const char *, int,
@@ -89,23 +94,17 @@ void _mtx_leave(struct mutex *, const char *, int);
_mtx_init_flags(m, ipl, name, flags, &__lock_type); \
} while (0)
-#define mtx_init(m, ipl) mtx_init_flags(m, ipl, NULL, 0)
-#define mtx_enter(m) _mtx_enter(m, __FILE__, __LINE__)
-#define mtx_enter_try(m) _mtx_enter_try(m, __FILE__, __LINE__)
-#define mtx_leave(m) _mtx_leave(m, __FILE__, __LINE__)
-
#else /* WITNESS */
-#define mtx_init(m, ipl) _mtx_init(m, ipl)
-
#define mtx_init_flags(m, ipl, name, flags) do { \
(void)(name); (void)(flags); \
_mtx_init(m, ipl); \
} while (0)
-#define mtx_enter __mtx_enter
-#define mtx_leave __mtx_leave
-#define mtx_enter_try __mtx_enter_try
+#define _mtx_init_flags(m,i,n,f,t) _mtx_init(m,i)
+#define _mtx_enter(m) __mtx_enter(m)
+#define _mtx_enter_try(m) __mtx_enter_try(m)
+#define _mtx_leave(m) __mtx_leave(m)
#endif /* WITNESS */