Unverified Commit 6b809c19 authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "ASoC: soc-pcm: cleanup cppcheck warning" from Kuninori Morimoto...

Merge series "ASoC: soc-pcm: cleanup cppcheck warning" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

Now I'm posting audio-graph-card2 patch-set, but it seems it needs longer
discussion. Thus I want to post more easy patch first, and reduce my
local patches.

These are cppcheck warning cleanup patches for soc-pcm.

Kuninori Morimoto (5):
  ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_apply_msb()
  ASoC: soc-pcm: cleanup cppcheck warning at soc_pcm_components_close()
  ASoC: soc-pcm: cleanup cppcheck warning at soc_get_playback_capture()
  ASoC: soc-pcm: cleanup cppcheck warning at dpcm_be_is_active()
  ASoC: soc-pcm: cleanup cppcheck warning at dpcm_runtime_setup_be_chan()

 sound/soc/soc-pcm.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto
parents 37108ef4 9bdc573d
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -449,13 +449,12 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
	struct snd_soc_dai *cpu_dai;
	struct snd_soc_dai *codec_dai;
	struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
	int stream = substream->stream;
	int i;
	unsigned int bits = 0, cpu_bits = 0;

	for_each_rtd_codec_dais(rtd, i, codec_dai) {
		pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
		struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);

		if (pcm_codec->sig_bits == 0) {
			bits = 0;
@@ -465,7 +464,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
	}

	for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
		pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
		struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);

		if (pcm_cpu->sig_bits == 0) {
			cpu_bits = 0;
@@ -634,10 +633,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
{
	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
	struct snd_soc_component *component;
	int i, r, ret = 0;
	int i, ret = 0;

	for_each_rtd_components(rtd, i, component) {
		r = snd_soc_component_close(component, substream, rollback);
		int r = snd_soc_component_close(component, substream, rollback);
		if (r < 0)
			ret = r; /* use last ret */

@@ -1308,13 +1307,12 @@ void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream,
			      struct snd_soc_dapm_widget_list *list)
{
	struct snd_soc_dapm_widget *widget;
	struct snd_soc_dai *dai;
	unsigned int i;

	/* is there a valid DAI widget for this BE */
	for_each_rtd_dais(dpcm->be, i, dai) {
		widget = snd_soc_dai_get_widget(dai, stream);
		struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(dai, stream);

		/*
		 * The BE is pruned only if none of the dai
@@ -1627,7 +1625,6 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)

	for_each_dpcm_be(fe, stream, dpcm) {
		struct snd_soc_pcm_runtime *be = dpcm->be;
		struct snd_soc_pcm_stream *codec_stream;
		struct snd_soc_pcm_stream *cpu_stream;
		struct snd_soc_dai *dai;
		int i;
@@ -1650,7 +1647,8 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
		 * DAIs connected to a single CPU DAI, use CPU DAI's directly
		 */
		if (be->num_codecs == 1) {
			codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream);
			struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream(
				asoc_rtd_to_codec(be, 0), stream);

			soc_pcm_hw_update_chan(hw, codec_stream);
		}
@@ -2581,9 +2579,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
				    int *playback, int *capture)
{
	struct snd_soc_dai *codec_dai;
	struct snd_soc_dai *cpu_dai;
	int stream;
	int i;

	if (rtd->dai_link->dynamic && rtd->num_cpus > 1) {
@@ -2593,6 +2589,8 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
	}

	if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
		int stream;

		if (rtd->dai_link->dpcm_playback) {
			stream = SNDRV_PCM_STREAM_PLAYBACK;

@@ -2627,6 +2625,8 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
			}
		}
	} else {
		struct snd_soc_dai *codec_dai;

		/* Adapt stream for codec2codec links */
		int cpu_capture = rtd->dai_link->params ?
			SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;