summaryrefslogtreecommitdiff
path: root/sound/virtio/virtio_card.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/virtio/virtio_card.c')
-rw-r--r--sound/virtio/virtio_card.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c
index 965209e1d872..647190f4d5af 100644
--- a/sound/virtio/virtio_card.c
+++ b/sound/virtio/virtio_card.c
@@ -85,9 +85,8 @@ static void virtsnd_event_notify_cb(struct virtqueue *vqueue)
struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
struct virtio_snd_event *event;
u32 length;
- unsigned long flags;
- spin_lock_irqsave(&queue->lock, flags);
+ guard(spinlock_irqsave)(&queue->lock);
do {
virtqueue_disable_cb(vqueue);
while ((event = virtqueue_get_buf(vqueue, &length))) {
@@ -95,7 +94,6 @@ static void virtsnd_event_notify_cb(struct virtqueue *vqueue)
virtsnd_event_send(vqueue, event, true, GFP_ATOMIC);
}
} while (!virtqueue_enable_cb(vqueue));
- spin_unlock_irqrestore(&queue->lock, flags);
}
/**
@@ -139,8 +137,7 @@ static int virtsnd_find_vqs(struct virtio_snd *snd)
n = virtqueue_get_vring_size(vqs[VIRTIO_SND_VQ_EVENT]);
- snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs),
- GFP_KERNEL);
+ snd->event_msgs = kmalloc_objs(*snd->event_msgs, n);
if (!snd->event_msgs)
return -ENOMEM;
@@ -176,14 +173,12 @@ static void virtsnd_disable_event_vq(struct virtio_snd *snd)
struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
struct virtio_snd_event *event;
u32 length;
- unsigned long flags;
if (queue->vqueue) {
- spin_lock_irqsave(&queue->lock, flags);
+ guard(spinlock_irqsave)(&queue->lock);
virtqueue_disable_cb(queue->vqueue);
while ((event = virtqueue_get_buf(queue->vqueue, &length)))
virtsnd_event_dispatch(snd, event);
- spin_unlock_irqrestore(&queue->lock, flags);
}
}