diff mbox series

[RFC,03/xx] ALSA: virtio: use snd_[sub]stream_is_playback/capture()

Message ID 87v812l1ee.wl-kuninori.morimoto.gx@renesas.com
State Superseded
Headers show
Series [RFC,03/xx] ALSA: virtio: use snd_[sub]stream_is_playback/capture() | expand

Commit Message

Kuninori Morimoto July 18, 2024, 11:35 p.m. UTC
We can use snd_[sub]stream_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/virtio/virtio_card.h    | 2 +-
 sound/virtio/virtio_pcm_msg.c | 4 ++--
 sound/virtio/virtio_pcm_ops.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h
index 3ceee4e416fc7..2febec09b13ab 100644
--- a/sound/virtio/virtio_card.h
+++ b/sound/virtio/virtio_card.h
@@ -107,7 +107,7 @@  virtsnd_rx_queue(struct virtio_snd *snd)
 static inline struct virtio_snd_queue *
 virtsnd_pcm_queue(struct virtio_pcm_substream *vss)
 {
-	if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_stream_is_playback(vss->direction))
 		return virtsnd_tx_queue(vss->snd);
 	else
 		return virtsnd_rx_queue(vss->snd);
diff --git a/sound/virtio/virtio_pcm_msg.c b/sound/virtio/virtio_pcm_msg.c
index 8c32efaf4c529..fd4111a558250 100644
--- a/sound/virtio/virtio_pcm_msg.c
+++ b/sound/virtio/virtio_pcm_msg.c
@@ -230,7 +230,7 @@  int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss, unsigned long offset,
 			msg->xfer.stream_id = cpu_to_le32(vss->sid);
 			memset(&msg->status, 0, sizeof(msg->status));
 
-			if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
+			if (snd_stream_is_playback(vss->direction))
 				rc = virtqueue_add_sgs(vqueue, psgs, 2, 1, msg,
 						       GFP_ATOMIC);
 			else
@@ -313,7 +313,7 @@  static void virtsnd_pcm_msg_complete(struct virtio_pcm_msg *msg,
 	 * If the capture substream returned an incorrect status, then just
 	 * increase the hw_ptr by the message size.
 	 */
-	if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK ||
+	if (snd_stream_is_playback(vss->direction) ||
 	    written_bytes <= sizeof(msg->status))
 		vss->hw_ptr += msg->length;
 	else
diff --git a/sound/virtio/virtio_pcm_ops.c b/sound/virtio/virtio_pcm_ops.c
index ad12aae52fc32..6e8c4881b44f9 100644
--- a/sound/virtio/virtio_pcm_ops.c
+++ b/sound/virtio/virtio_pcm_ops.c
@@ -337,7 +337,7 @@  static int virtsnd_pcm_trigger(struct snd_pcm_substream *substream, int command)
 
 		spin_lock_irqsave(&queue->lock, flags);
 		spin_lock(&vss->lock);
-		if (vss->direction == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_stream_is_capture(vss->direction))
 			rc = virtsnd_pcm_msg_send(vss, 0, vss->buffer_bytes);
 		if (!rc)
 			vss->xfer_enabled = true;