From: Takashi Iwai Subject: Re: [PATCH 00/12] ASoC: intel: add device_link to HDMI audio Date: Thu, 11 Apr 2019 14:33:00 +0200 Message-ID: References: <1554975299-25343-1-git-send-email-libin.yang@intel.com> <96A12704CE18D347B625EE2D4A099D195281880C@SHSMSX103.ccr.corp.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 B9425F808F6 for ; Thu, 11 Apr 2019 14:33:02 +0200 (CEST) In-Reply-To: <96A12704CE18D347B625EE2D4A099D195281880C@SHSMSX103.ccr.corp.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: "Yang, Libin" Cc: "alsa-devel@alsa-project.org" , "broonie@kernel.org" , "pierre-louis.bossart@linux.intel.com" List-Id: alsa-devel@alsa-project.org On Thu, 11 Apr 2019 14:24:13 +0200, Yang, Libin wrote: > > Hi Takashi, > > >-----Original Message----- > >From: Takashi Iwai [mailto:tiwai@suse.de] > >Sent: Thursday, April 11, 2019 6:10 PM > >To: Yang, Libin > >Cc: alsa-devel@alsa-project.org; broonie@kernel.org; pierre- > >louis.bossart@linux.intel.com > >Subject: Re: [PATCH 00/12] ASoC: intel: add device_link to HDMI audio > > > >On Thu, 11 Apr 2019 11:34:47 +0200, > >libin.yang@intel.com wrote: > >> > >> From: Libin Yang > >> > >> This patchset add the device_link between the machine devices of intel > >> boards and HDMI audio codec. This can make sure that display audio > >> power domain is always turned on before operating on the HDMI audio > >> codecs. > >> > >> patch 2 adds the helper functions in a new created header file. > >> However skl_hda_dsp_generic doesn't use these helper functions because > >> skl_hda_dsp_generic is a special driver, the add link and delete link > >> operations are in different source code files. > >> If it includes the header file, there is compiling warning. > > > >Now I took a look at the core implementation, and wonder whether we may > >drop the device_link_del() call if we create the link with > >DL_FLAG_AUTOREMOVE_CONSUMER? If that works, you don't have to track > >the link pointer, so it can be dropped as well; i.e. the only addition would be > >just the extra call of device_link_add() for each machine driver. > > In the machine drivers, each dai_link will call device_link_add(). So I use > the link pointer to check whether it is already created or not to avoid > creating the link several times. Like the below code: > + if (!(*link)) > + *link = device_link_add(consumer, supplier, DL_FLAG_RPM_ACTIVE); Yes, that's fine. What I meant is the rest part, device_link_del() call and keeping the link pointer. Both look superfluous once when you create a device link with DL_FLAG_AUTOREMOVE_CONSUMER flag, then the device link will be automatically cleaned up at the device removal. thanks, Takashi