All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: Re: [PATCH] ASoC: hda: increment codec device refcount when it is added to the card
Date: Fri, 31 May 2019 08:43:53 -0700	[thread overview]
Message-ID: <d62f5761b8fb4c156dc775fb0e0426c262d6bdcc.camel@linux.intel.com> (raw)
In-Reply-To: <s5h5zpqskhw.wl-tiwai@suse.de>

> > Hi Takashi,
> > 
> > No, this actually comes at the second step in the case of SOF (ie
> > after
> > the machine driver is unregistered).
> >  
> > Actually, I just found out what's causing the issue. It is the call
> > to
> > snd_hda_codec_dev_free() which calls put_device() when
> > snd_card_free()
> > is invoked. So, adding a get_device() in snd_hda_codec_device_new()
> > would make the refcount balanced. 
> > 
> > On the other hand, removing the put_device() in
> > snd_hda_codec_dev_free() would also address the problem. I'm not
> > sure
> > which would be the preferred route.
> 
> The latter one, I'd say.
> 
> Actually the difference between ASoC and the legacy HDA bus is who
> releases the device object.  For HDA legacy bus, it's supposed to be
> done via snd_device_free() chain, while ASoC bus releases explicitly
> as shown in my previous post.
> 
> So, if any, I'd paper over it like below.
OK, makes sense. Let me send a V2 with the change. 

Also, should I also look into adding the change to make hdac_hdmi codec
card managed as well?

Thanks,
Ranjani

> 
> 
> thanks,
> 
> Takashi
> 
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -840,7 +840,12 @@ static int snd_hda_codec_dev_free(struct
> snd_device *device)
>  	if (codec->core.type == HDA_DEV_LEGACY)
>  		snd_hdac_device_unregister(&codec->core);
>  	codec_display_power(codec, false);
> -	put_device(hda_codec_dev(codec));
> +	/*
> +	 * again, ASoC HD-audio bus manages differently; it's released
> in
> +	 * snd_hdac_ext_bus_device_remove() explicitly
> +	 */
> +	if (codec->core.type == HDA_DEV_LEGACY)
> +		put_device(hda_codec_dev(codec));
>  	return 0;
>  }
>  

  reply	other threads:[~2019-05-31 15:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 20:18 [PATCH] ASoC: hda: increment codec device refcount when it is added to the card Ranjani Sridharan
2019-05-30 21:00 ` Pierre-Louis Bossart
2019-05-31  6:11   ` Takashi Iwai
2019-05-31 13:18     ` Ranjani Sridharan
2019-05-31 13:25       ` Takashi Iwai
2019-05-31 13:52         ` Ranjani Sridharan
2019-05-31 14:02           ` Takashi Iwai
2019-05-31 14:28             ` Takashi Iwai
2019-05-31 15:20               ` Ranjani Sridharan
2019-05-31 15:37                 ` Takashi Iwai
2019-05-31 15:43                   ` Ranjani Sridharan [this message]
2019-05-31 15:45                     ` Takashi Iwai

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=d62f5761b8fb4c156dc775fb0e0426c262d6bdcc.camel@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /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.