[alsa-devel] [RFC 1/4] ASoc: Use ref_count for soc DAI & component
Vaibhav Agarwal
vaibhav.agarwal at linaro.org
Tue Feb 16 14:27:37 CET 2016
On 15 February 2016 at 19:29, Mark Brown <broonie at kernel.org> wrote:
> 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.
Sure, I'll take care while submitting future patches.
>
>> - 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)?
yes, non-zero check would also solve the purpose of probed flag.
will make this change in next patchset.
More information about the Alsa-devel
mailing list