summaryrefslogtreecommitdiff
path: root/sound/xen/xen_snd_front_evtchnl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/xen/xen_snd_front_evtchnl.c')
-rw-r--r--sound/xen/xen_snd_front_evtchnl.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/sound/xen/xen_snd_front_evtchnl.c b/sound/xen/xen_snd_front_evtchnl.c
index 26d1b3987887..2fbed8e4a490 100644
--- a/sound/xen/xen_snd_front_evtchnl.c
+++ b/sound/xen/xen_snd_front_evtchnl.c
@@ -28,7 +28,7 @@ static irqreturn_t evtchnl_interrupt_req(int irq, void *dev_id)
if (unlikely(channel->state != EVTCHNL_STATE_CONNECTED))
return IRQ_HANDLED;
- mutex_lock(&channel->ring_io_lock);
+ guard(mutex)(&channel->ring_io_lock);
again:
rp = channel->u.req.ring.sring->rsp_prod;
@@ -80,7 +80,6 @@ again:
channel->u.req.ring.sring->rsp_event = i + 1;
}
- mutex_unlock(&channel->ring_io_lock);
return IRQ_HANDLED;
}
@@ -93,13 +92,13 @@ static irqreturn_t evtchnl_interrupt_evt(int irq, void *dev_id)
if (unlikely(channel->state != EVTCHNL_STATE_CONNECTED))
return IRQ_HANDLED;
- mutex_lock(&channel->ring_io_lock);
+ guard(mutex)(&channel->ring_io_lock);
prod = page->in_prod;
/* Ensure we see ring contents up to prod. */
virt_rmb();
if (prod == page->in_cons)
- goto out;
+ return IRQ_HANDLED;
/*
* Assume that the backend is trusted to always write sane values
@@ -125,8 +124,6 @@ static irqreturn_t evtchnl_interrupt_evt(int irq, void *dev_id)
/* Ensure ring contents. */
virt_wmb();
-out:
- mutex_unlock(&channel->ring_io_lock);
return IRQ_HANDLED;
}
@@ -444,23 +441,23 @@ void xen_snd_front_evtchnl_pair_set_connected(struct xen_snd_front_evtchnl_pair
else
state = EVTCHNL_STATE_DISCONNECTED;
- mutex_lock(&evt_pair->req.ring_io_lock);
- evt_pair->req.state = state;
- mutex_unlock(&evt_pair->req.ring_io_lock);
+ scoped_guard(mutex, &evt_pair->req.ring_io_lock) {
+ evt_pair->req.state = state;
+ }
- mutex_lock(&evt_pair->evt.ring_io_lock);
- evt_pair->evt.state = state;
- mutex_unlock(&evt_pair->evt.ring_io_lock);
+ scoped_guard(mutex, &evt_pair->evt.ring_io_lock) {
+ evt_pair->evt.state = state;
+ }
}
void xen_snd_front_evtchnl_pair_clear(struct xen_snd_front_evtchnl_pair *evt_pair)
{
- mutex_lock(&evt_pair->req.ring_io_lock);
- evt_pair->req.evt_next_id = 0;
- mutex_unlock(&evt_pair->req.ring_io_lock);
+ scoped_guard(mutex, &evt_pair->req.ring_io_lock) {
+ evt_pair->req.evt_next_id = 0;
+ }
- mutex_lock(&evt_pair->evt.ring_io_lock);
- evt_pair->evt.evt_next_id = 0;
- mutex_unlock(&evt_pair->evt.ring_io_lock);
+ scoped_guard(mutex, &evt_pair->evt.ring_io_lock) {
+ evt_pair->evt.evt_next_id = 0;
+ }
}