Re: [PATCH] ASoC: core: Make sure component driver names are unique

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
> ---
(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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux