Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754825AbdHVH6D (ORCPT ); Tue, 22 Aug 2017 03:58:03 -0400 Received: from regular1.263xmail.com ([211.150.99.141]:59749 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbdHVH6B (ORCPT ); Tue, 22 Aug 2017 03:58:01 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jeffy Chen To: linux-kernel@vger.kernel.org, dgreid@chromium.org, heiko@sntech.de Cc: briannorris@chromium.org, mengdong.lin@linux.intel.com, mka@chromium.org, lars@metafoo.de, dianders@chromium.org, Jeffy Chen , Jaroslav Kysela , alsa-devel@alsa-project.org, Mark Brown , Takashi Iwai , Liam Girdwood Subject: [PATCH v5 2/9] ASoC: soc-core: Allow searching dai driver name in snd_soc_find_dai Date: Tue, 22 Aug 2017 15:57:21 +0800 Message-Id: <20170822075729.8438-3-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170822075729.8438-1-jeffy.chen@rock-chips.com> References: <20170822075729.8438-1-jeffy.chen@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1571 Lines: 46 Currently we are searching dai name in snd_soc_find_dai, which could either be dai driver name or component device name(for legacy naming). Allow searching dai driver name in snd_soc_find_dai too, so that we can use dai driver name to find legacy naming dais. Signed-off-by: Jeffy Chen --- Changes in v5: Allow searching for dai driver name in snd_soc_find_dai, instead of hacking non-zero device id to avoid legay dai naming. Changes in v4: None Changes in v3: None Changes in v2: None sound/soc/soc-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 004daaa82102..77e7e2a11af0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -950,7 +950,7 @@ static struct snd_soc_component *soc_find_component( /** * snd_soc_find_dai - Find a registered DAI * - * @dlc: name of the DAI and optional component info to match + * @dlc: name of the DAI or the DAI driver and optional component info to match * * This function will search all registered components and their DAIs to * find the DAI of the same name. The component's of_node and name @@ -978,7 +978,8 @@ struct snd_soc_dai *snd_soc_find_dai( if (dlc->name && strcmp(component->name, dlc->name)) continue; list_for_each_entry(dai, &component->dai_list, list) { - if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) + if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) + && strcmp(dai->driver->name, dlc->dai_name)) continue; return dai; -- 2.11.0