All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	upstream@semihalf.com, kai.vehmanen@linux.intel.com,
	harshapriya.n@intel.com, rad@semihalf.com,
	pierre-louis.bossart@linux.intel.com, tiwai@suse.com,
	hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com,
	cujomalainey@chromium.org, lma@semihalf.com
Subject: [PATCH v2 01/14] ALSA: Add snd_pcm_direction_name() helper
Date: Wed, 11 May 2022 18:23:50 +0200	[thread overview]
Message-ID: <20220511162403.3987658-2-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20220511162403.3987658-1-cezary.rojewski@intel.com>

Allow for retrieving string naming a direction of a stream without the
need of substream pointer.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 include/sound/pcm.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 6b99310b5b88..26523cfe428d 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1392,6 +1392,20 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
 
 const char *snd_pcm_format_name(snd_pcm_format_t format);
 
+/**
+ * snd_pcm_direction_name - Get a string naming the direction of a stream
+ * @direction: Stream's direction, one of SNDRV_PCM_STREAM_XXX
+ *
+ * Returns a string naming the direction of the stream.
+ */
+static inline const char *snd_pcm_direction_name(int direction)
+{
+	if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+		return "Playback";
+	else
+		return "Capture";
+}
+
 /**
  * snd_pcm_stream_str - Get a string naming the direction of a stream
  * @substream: the pcm substream instance
@@ -1400,10 +1414,7 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
  */
 static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		return "Playback";
-	else
-		return "Capture";
+	return snd_pcm_direction_name(substream->stream);
 }
 
 /*
-- 
2.25.1


  reply	other threads:[~2022-05-11 16:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 16:23 [PATCH v2 00/14] ASoC: Intel: avs: Machine boards and HDA codec support Cezary Rojewski
2022-05-11 16:23 ` Cezary Rojewski [this message]
2022-05-11 16:23 ` [PATCH v2 02/14] ASoC: codecs: Add HD-Audio codec driver Cezary Rojewski
2022-07-05 10:20   ` Geert Uytterhoeven
2022-07-05 10:20     ` Geert Uytterhoeven
2022-07-05 12:01     ` Cezary Rojewski
2022-07-05 12:01       ` Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 03/14] ASoC: Intel: avs: Add HDAudio machine board Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 04/14] ASoC: Intel: avs: Add DMIC " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 05/14] ASoC: Intel: avs: Add I2S-test " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 06/14] ASoC: Intel: avs: Add rt274 " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 07/14] ASoC: Intel: avs: Add rt286 " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 08/14] ASoC: Intel: avs: Add rt298 " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 09/14] ASoC: Intel: avs: Add rt5682 " Cezary Rojewski
2022-05-11 16:23 ` [PATCH v2 10/14] ASoC: Intel: avs: Add nau8825 " Cezary Rojewski
2022-05-11 16:24 ` [PATCH v2 11/14] ASoC: Intel: avs: Add ssm4567 " Cezary Rojewski
2022-05-11 16:24 ` [PATCH v2 12/14] ASoC: Intel: avs: Add max98357a " Cezary Rojewski
2022-05-11 16:24 ` [PATCH v2 13/14] ASoC: Intel: avs: Add max98373 " Cezary Rojewski
2022-05-11 16:24 ` [PATCH v2 14/14] ASoC: Intel: avs: Add da7219 " Cezary Rojewski
2022-05-26 10:14 ` [PATCH v2 00/14] ASoC: Intel: avs: Machine boards and HDA codec support Cezary Rojewski
2022-05-26 13:59   ` Mark Brown
2022-06-07 10:55 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511162403.3987658-2-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=harshapriya.n@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lma@semihalf.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rad@semihalf.com \
    --cc=tiwai@suse.com \
    --cc=upstream@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.