All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org
Subject: Re: [PATCH] ASoC: core: Make sure component driver names are unique
Date: 11 May 2020 10:41:53 +0900	[thread overview]
Message-ID: <878shz9rj2.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <20200427193306.31198-1-ranjani.sridharan@linux.intel.com>


Hi Ranjani

> When registering a component, make sure that the driver names
> are unique. This will ensure that the snd_soc_rtdcom_lookup()
> function returns the right component based on the name.
> 
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> ---
(snip)
> +static bool
> +snd_soc_component_driver_name_is_unique(const struct snd_soc_component_driver *component_driver)
> +{
> +	struct snd_soc_component *component;
> +
> +	mutex_lock(&client_mutex);
> +	for_each_component(component)
> +		if (!strcmp(component->driver->name, component_driver->name)) {
> +			mutex_unlock(&client_mutex);
> +			return false;
> +		}
> +
> +	mutex_unlock(&client_mutex);
> +	return true;
> +}

I think it will be more readable if it doesn't have
multiple mutex_unlock().

	{
		int ret = true;

		mutex_lock();
		for_each_component()
			if (...) {
				...
				ret = false;
			}
		mutex_unlock();
		return ret;
	}

Thank you for your help !!

Best regards
---
Kuninori Morimoto

      parent reply	other threads:[~2020-05-11  1:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 19:33 [PATCH] ASoC: core: Make sure component driver names are unique Ranjani Sridharan
2020-04-28 11:40 ` Mark Brown
2020-04-28 16:07   ` Ranjani Sridharan
2020-04-28 16:14     ` Mark Brown
2020-04-28 16:26       ` Ranjani Sridharan
2020-04-28 16:34         ` Mark Brown
2020-05-11  1:41 ` Kuninori Morimoto [this message]

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=878shz9rj2.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ranjani.sridharan@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 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.