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 libin.yang@intel.com 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 libin.yang@intel.com
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