summaryrefslogtreecommitdiff
path: root/xen
diff options
context:
space:
mode:
Diffstat (limited to 'xen')
-rw-r--r--xen/common/event_channel.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 54b2e2550e..dbfba62a49 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -326,23 +326,18 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn)
{
- if ( lchn <= rchn )
- {
- evtchn_write_lock(lchn);
- if ( lchn != rchn )
- evtchn_write_lock(rchn);
- }
- else
- {
- evtchn_write_lock(rchn);
- evtchn_write_lock(lchn);
- }
+ ASSERT(lchn != rchn);
+
+ if ( lchn > rchn )
+ SWAP(lchn, rchn);
+
+ evtchn_write_lock(lchn);
+ evtchn_write_lock(rchn);
}
static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
{
- if ( lchn != rchn )
- evtchn_write_unlock(lchn);
+ evtchn_write_unlock(lchn);
evtchn_write_unlock(rchn);
}