@@ -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);
@@ -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
@@ -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;
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(-)