From patchwork Wed Jun 26 01:40:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 1122466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=renesas.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45YQjD3YjSz9s3C for ; Wed, 26 Jun 2019 11:41:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726304AbfFZBlC (ORCPT ); Tue, 25 Jun 2019 21:41:02 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:40514 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726068AbfFZBlC (ORCPT ); Tue, 25 Jun 2019 21:41:02 -0400 Date: 26 Jun 2019 10:40:59 +0900 X-IronPort-AV: E=Sophos;i="5.62,418,1554735600"; d="scan'208";a="19482302" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 26 Jun 2019 10:40:59 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D218D4155066; Wed, 26 Jun 2019 10:40:59 +0900 (JST) Message-ID: <878stpyvky.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] ASoC: soc-core: don't use soc_find_component() at snd_soc_find_dai() User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 To: Dmitry Osipenko , Jon Hunter , Mark Brown Cc: Linux-ALSA , "linux-tegra@vger.kernel.org" MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Kuninori Morimoto commit b9f2e25c599bb ("ASoC: soc-core: use soc_find_component() at snd_soc_find_dai()") used soc_find_component() at snd_soc_find_dai(), but, some CPU driver has CPU component for DAI and Platform component, for example generic DMAEngine component. In such case, CPU component and Platform component have same of_node / name. Here soc_find_component() returns *1st* found component. Thus, we shouldn't use soc_find_component() at snd_soc_find_dai(). This patch fixup this it, and add comment to indicate this limitation. Fixes: commit b9f2e25c599bb ("ASoC: soc-core: use soc_find_component() at snd_soc_find_dai()") Reported-by: Dmitry Osipenko Reported-by: Jon Hunter Signed-off-by: Kuninori Morimoto Tested-by: Dmitry Osipenko Tested-by: Jon Hunter --- sound/soc/soc-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 358f1fb..8ccaf63 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -786,6 +786,14 @@ static struct snd_soc_component *soc_find_component( lockdep_assert_held(&client_mutex); + /* + * NOTE + * + * It returns *1st* found component, but some driver + * has few components by same of_node/name + * ex) + * CPU component and generic DMAEngine component + */ for_each_component(component) if (snd_soc_is_matching_component(dlc, component)) return component; @@ -813,8 +821,9 @@ struct snd_soc_dai *snd_soc_find_dai( lockdep_assert_held(&client_mutex); /* Find CPU DAI from registered DAIs */ - component = soc_find_component(dlc); - if (component) { + for_each_component(component) { + if (!snd_soc_is_matching_component(dlc, component)) + continue; for_each_component_dais(component, dai) { if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) && (!dai->driver->name