From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 1/2] ALSA: hda: fix unregister device twice on ASoC driver Date: Mon, 29 Apr 2019 09:12:25 +0200 Message-ID: References: <20190427205340.8830-1-yung-chuan.liao@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C0CA5F806E7 for ; Mon, 29 Apr 2019 09:12:26 +0200 (CEST) In-Reply-To: <20190427205340.8830-1-yung-chuan.liao@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Bard liao Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com List-Id: alsa-devel@alsa-project.org On Sat, 27 Apr 2019 22:53:39 +0200, Bard liao wrote: > > snd_hda_codec_device_new() is used by both legacy HDA and ASoC > driver. However, we will call snd_hdac_device_unregister() in > snd_hdac_ext_bus_device_remove() for ASoC device. This patch uses > the type flag in hdac_device struct to determine is it a ASoC device > or legacy HDA device and call snd_hdac_device_unregister() in > snd_hda_codec_dev_free() only if it is a legacy HDA device. > > Signed-off-by: Bard liao Applied, thanks. Takashi > --- > sound/pci/hda/hda_codec.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c > index 701a69d856f5..b20eb7fc83eb 100644 > --- a/sound/pci/hda/hda_codec.c > +++ b/sound/pci/hda/hda_codec.c > @@ -832,7 +832,13 @@ static int snd_hda_codec_dev_free(struct snd_device *device) > struct hda_codec *codec = device->device_data; > > codec->in_freeing = 1; > - snd_hdac_device_unregister(&codec->core); > + /* > + * snd_hda_codec_device_new() is used by legacy HDA and ASoC driver. > + * We can't unregister ASoC device since it will be unregistered in > + * snd_hdac_ext_bus_device_remove(). > + */ > + if (codec->core.type == HDA_DEV_LEGACY) > + snd_hdac_device_unregister(&codec->core); > codec_display_power(codec, false); > put_device(hda_codec_dev(codec)); > return 0; > -- > 2.17.1 >