[alsa-devel] [RFC 1/4] ASoc: Use ref_count for soc DAI & component

Mark Brown broonie at kernel.org
Mon Feb 15 14:59:41 CET 2016


On Mon, Feb 15, 2016 at 05:49:29PM +0530, Vaibhav Agarwal wrote:
> This is preperation to allow dynamic DAI link insertion &
> removal.

Which there is no proposed user of here...

> Currently, DAI links are added/removed once during soc-card
> instatiate & removal. Thus, irrespective of usage count by multiple
> DAI links, DAIs and components are probed or removed only once
> while maintaining 'probed' flag.
> However, in case of dynamic DAI link insertion/removal we need to
> ensure DAI/components are not unnecessarily probed multiple & not
> removed mistakenly while in use by any other existing DAI link.
> Thus, ref_count is used to maintain their usage count.

Please use normal changelog formatting - either consistent line lengths
or blank lines between paragraphs depending on what you're trying to
accomplish here.

> -	if (!dai->probed && dai->driver->probe_order == order) {
> -		if (dai->driver->probe) {
> -			ret = dai->driver->probe(dai);
> -			if (ret < 0) {
> -				dev_err(dai->dev,
> -					"ASoC: failed to probe DAI %s: %d\n",
> -					dai->name, ret);
> -				return ret;
> +	if (dai->driver->probe_order == order) {
> +		if (!dai->probed) {
> +			if (dai->driver->probe) {
> +				ret = dai->driver->probe(dai);
> +				if (ret < 0) {
> +					dev_err(dai->dev,
> +						"ASoC: failed to probe DAI %s: %d\n",
> +						dai->name, ret);
> +					return ret;
> +				}
>  			}
> -		}
>  
> -		dai->probed = 1;
> +			dai->probed = 1;
> +		}
> +		dai->ref_count++;
>  	}

I don't understand this at all - why the complete reindent and change of
condition, don't we just increase the refcount when we flag as probed
(and why do we still have the probed flag after this)?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160215/4fc568a3/attachment.sig>


More information about the Alsa-devel mailing list