From patchwork Tue Oct 13 13:37:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koro Chen X-Patchwork-Id: 7385501 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ACDC3BEEA4 for ; Tue, 13 Oct 2015 13:39:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C958320800 for ; Tue, 13 Oct 2015 13:39:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EFF8B207FB for ; Tue, 13 Oct 2015 13:39:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zlzni-0003zK-Fm; Tue, 13 Oct 2015 13:39:34 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zlzng-0003tK-58; Tue, 13 Oct 2015 13:39:33 +0000 X-Listener-Flag: 11101 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 723167159; Tue, 13 Oct 2015 21:39:01 +0800 Received: from mtkslt301 (10.21.14.114) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Tue, 13 Oct 2015 21:38:59 +0800 Received: by mtkslt301 (Postfix, from userid 11333) id A67EE183AC6; Tue, 13 Oct 2015 21:38:59 +0800 (CST) From: Koro Chen To: , , , Subject: [RFC PATCH] ASoC: Modify check condition of multiple bindings of components Date: Tue, 13 Oct 2015 21:37:57 +0800 Message-ID: <1444743477-48819-1-git-send-email-koro.chen@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151013_063932_914462_DA6E0048 X-CRM114-Status: GOOD ( 13.19 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, lars@metafoo.de, srv_heupstream@mediatek.com, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, Koro Chen , linux-mediatek@lists.infradead.org, p.zabel@pengutronix.de, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch "ASoC: Prevent components from being bound to multiple cards" adds check to prevent multiple cards from using the same component. However, snd_soc_register_platform() or snd_soc_register_codec() will also create components, and sharing the same platform by multiple cards is then refused. This happens with a platform having multiple independent DAIs that share the same DMA controller. Relax the condition by checking component->registered_as_component, which is only true in case of snd_soc_register_component() and will be false for components created by snd_soc_register_platform() or snd_soc_register_codec(). Signed-off-by: Koro Chen --- sound/soc/soc-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 42575b0..eca169a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1106,7 +1106,8 @@ static int soc_probe_component(struct snd_soc_card *card, return 0; if (component->card) { - if (component->card != card) { + if (component->card != card && + component->registered_as_component) { dev_err(component->dev, "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", card->name, component->card->name);