alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 5/6] ASoC: soc-pcm: cleanup soc_pcm_params_symmetry()
Date: 18 Dec 2020 15:51:09 +0900	[thread overview]
Message-ID: <87tusjfw9i.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87v9d87uyl.wl-kuninori.morimoto.gx@renesas.com>


Hi Mark

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> soc_pcm_params_symmetry() checks rate/channel/sample_bits state.
> These are very similar but different, thus, it needs to have very
> verbose code.
> This patch use macro for it and make code more simple.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
(snip)
> +#define __soc_pcm_params_symmetry(name, sname)				\
> +	symmetry = rtd->dai_link->symmetric_##sname;			\
> +	for_each_rtd_dais(rtd, i, dai)					\
> +		symmetry |= dai->driver->symmetric_##sname;		\
> +									\
> +	if (symmetry)							\
> +		for_each_rtd_cpu_dais(rtd, i, cpu_dai)			\
> +			if (cpu_dai->name && cpu_dai->name != d.name) {	\
> +				dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %d - %d\n", \
> +					#name, cpu_dai->name, d.name);	\
> +				return -EINVAL;				\
>  			}
> -		}
> -	}
>  
(snip)
> +	/* reject unmatched parameters when applying symmetry */
> +	__soc_pcm_params_symmetry(rate,		rates);
> +	__soc_pcm_params_symmetry(channels,	channels);
> +	__soc_pcm_params_symmetry(sample_bits,	samplebits);

Not a big deal, but I'm happy if we can use same naming rule
for same things.

	rtd->dai_link->symmetric_samplebits;
	                         ^^^^^^^^^^
	dai->driver->symmetric_samplebits;
	                       ^^^^^^^^^^
	cpu_dai->sample_bits
	         ^^^^^^^^^^^

	__soc_pcm_params_symmetry(rate,		rates);
	                          ^^^^^         ^^^^^
	__soc_pcm_params_symmetry(sample_bits,	samplebits);
	                          ^^^^^^^^^^^   ^^^^^^^^^^

Thank you for your help !!

Best regards
---
Kuninori Morimoto

  reply	other threads:[~2020-12-18  6:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  5:54 [PATCH 0/6] ASoC: soc-pcm: cleanup code Kuninori Morimoto
2020-12-11  5:55 ` [PATCH 1/6] ASoC: soc-pcm: move dpcm_set_fe_update_state() Kuninori Morimoto
2020-12-11  5:55 ` [PATCH 2/6] ASoC: soc-pcm: add dpcm_set_be_update_state() Kuninori Morimoto
2020-12-11  5:55 ` [PATCH 3/6] ASoC: soc-pcm: add soc_pcm_set_dai_params() Kuninori Morimoto
2020-12-11  5:55 ` [PATCH 4/6] ASoC: soc-pcm: cleanup soc_pcm_apply_symmetry() Kuninori Morimoto
2020-12-11  5:55 ` [PATCH 5/6] ASoC: soc-pcm: cleanup soc_pcm_params_symmetry() Kuninori Morimoto
2020-12-18  6:51   ` Kuninori Morimoto [this message]
2020-12-11  5:55 ` [PATCH 6/6] ASoC: soc-pcm: setup pcm at one place in soc_new_pcm() Kuninori Morimoto
2021-01-13 15:26 ` (subset) [PATCH 0/6] ASoC: soc-pcm: cleanup code 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=87tusjfw9i.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).