Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Jie Yang <yang.jie@linux.intel.com>,
	alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Subject: Re: [PATCH v2] catpt: Switch to use list_entry_is_head() helper
Date: Mon, 28 Dec 2020 17:18:10 +0200	[thread overview]
Message-ID: <20201228151810.GA4077@smile.fi.intel.com> (raw)
In-Reply-To: <20201214172138.44267-1-andriy.shevchenko@linux.intel.com>

On Mon, Dec 14, 2020 at 07:21:38PM +0200, Andy Shevchenko wrote:
> Since we got list_entry_is_head() helper in the generic header,
> we may switch catpt to use it. It removes the need in additional variable.

Mark, should I resend?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
> v2: left the structure definition at its initial location (Cezary)
>  sound/soc/intel/catpt/pcm.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
> index e5d54bb1c42a..9d304b3a817f 100644
> --- a/sound/soc/intel/catpt/pcm.c
> +++ b/sound/soc/intel/catpt/pcm.c
> @@ -331,7 +331,7 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai,
>  {
>  	struct catpt_dev *cdev = dev_get_drvdata(dai->dev);
>  	struct snd_soc_component *component = dai->component;
> -	struct snd_kcontrol *pos, *kctl = NULL;
> +	struct snd_kcontrol *pos;
>  	const char *name;
>  	int ret;
>  	u32 id = stream->info.stream_hw_id;
> @@ -356,17 +356,15 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai,
>  
>  	list_for_each_entry(pos, &component->card->snd_card->controls, list) {
>  		if (pos->private_data == component &&
> -		    !strncmp(name, pos->id.name, sizeof(pos->id.name))) {
> -			kctl = pos;
> +		    !strncmp(name, pos->id.name, sizeof(pos->id.name)))
>  			break;
> -		}
>  	}
> -	if (!kctl)
> +	if (list_entry_is_head(pos, &component->card->snd_card->controls, list))
>  		return -ENOENT;
>  
>  	if (stream->template->type != CATPT_STRM_TYPE_LOOPBACK)
> -		return catpt_set_dspvol(cdev, id, (long *)kctl->private_value);
> -	ret = catpt_ipc_mute_loopback(cdev, id, *(bool *)kctl->private_value);
> +		return catpt_set_dspvol(cdev, id, (long *)pos->private_value);
> +	ret = catpt_ipc_mute_loopback(cdev, id, *(bool *)pos->private_value);
>  	if (ret)
>  		return CATPT_IPC_ERROR(ret);
>  	return 0;
> -- 
> 2.29.2
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-12-28 15:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 17:21 [PATCH v2] catpt: Switch to use list_entry_is_head() helper Andy Shevchenko
2020-12-28 15:18 ` Andy Shevchenko [this message]
2020-12-28 16:03 ` 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=20201228151810.GA4077@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=yang.jie@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox