Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp261342imu; Mon, 10 Dec 2018 21:15:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/Va86e9fFtY4DUoEbJtrOMuJua0X2UMVWtglaesu3wJ0GuSEzKQZfbZ4NXG7kQdF2nPjHPc X-Received: by 2002:a17:902:a5c3:: with SMTP id t3mr14551770plq.117.1544505323795; Mon, 10 Dec 2018 21:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544505323; cv=none; d=google.com; s=arc-20160816; b=h9Z5Hpy0Ef83EXi6N0ti0x12/ayDfqdR0CSYmH80YiODRnLpcXK7oL19dUyGr1QgbT NPW6FLrHi8T3TuxN+MFsC+jtMDUjAlEbDKSZgsq0H6Ohu4JwXmvzJ46a2fl/8O04zk4r d4GzcUle6W21QGjvUu/zohBJXtVrYm6j936BxQDOvp2fKU0Zh3WNTfCDgIODxv9vLmci 6RCcNQ4bQcrJhaKgSO3rUsfErdrLIs+zvgXCa4k1axXJ3qDQ+T78kpElFiKnMMAH3A0E CV8fgfNWgXI8324cfNa0Ysba05LynFe9z76ioixcEOsgjrytPzVoFWfIZ//usLBVr1Ly hEsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=G/swwdvuPjcZcR3nABjeer+C13Cik38FJPiqk6o1yVY=; b=U5924ZG5gDfr0Rgs2LmimBCoR25WqafczxV0RMH82O8sTOpPdVD55sGCRELKBT1CJe M+BL5YsXSALCYbMrNNVJNHvIPZCtj0jTNsj+AJtBjPK4L+4eQ64i9fk3Ihb4Q9Ghi7uM I3odhmrFXJJvN/LSZx9ZHcy8N6R2R2MI7ZtMb9uk1JHFQt59mtNKJwkK1okCMNE4LJJl 4rG80Wzms1A/2vOaLpOcAC3lX246ebJro3sPgn46o9GqoMEA+Bzr6BGPIOKUxMKXfPaE ezzG2QFle2k+Xhqxh2bvKu0C8jG/s7cktikb0NZAxwo+xA6Tv1Rbpx0g7MdSOxAW7TwZ jL8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si12124856pfd.142.2018.12.10.21.15.08; Mon, 10 Dec 2018 21:15:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729449AbeLKCGQ (ORCPT + 99 others); Mon, 10 Dec 2018 21:06:16 -0500 Received: from muru.com ([72.249.23.125]:57244 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727485AbeLKCGM (ORCPT ); Mon, 10 Dec 2018 21:06:12 -0500 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id B9EE78132; Tue, 11 Dec 2018 02:06:14 +0000 (UTC) From: Tony Lindgren To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 1/2] ASoC: simple-card-utils: revert port changes to follow graph binding Date: Mon, 10 Dec 2018 18:05:56 -0800 Message-Id: <20181211020557.61783-2-tony@atomide.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211020557.61783-1-tony@atomide.com> References: <20181211020557.61783-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit b6f3fc005a2c ("ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting") changed endpoint parsing for asoc_simple_card_get_dai_id(), but it seems the old code is correct. This code should follow the generic binding documentation for Documentation/devicetree/bindings/graph.txt that allows multiple endpoints for each port. Cc: Kuninori Morimoto Signed-off-by: Tony Lindgren --- sound/soc/generic/simple-card-utils.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -269,19 +269,35 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); static int asoc_simple_card_get_dai_id(struct device_node *ep) { - struct of_endpoint info; + struct device_node *node; + struct device_node *endpoint; + int i, id; int ret; ret = snd_soc_get_dai_id(ep); if (ret != -ENOTSUPP) return ret; + node = of_graph_get_port_parent(ep); + /* * Non HDMI sound case, counting port/endpoint on its DT * is enough. Let's count it. */ - of_graph_parse_endpoint(ep, &info); - return info.port; + i = 0; + id = -1; + for_each_endpoint_of_node(node, endpoint) { + if (endpoint == ep) + id = i; + i++; + } + + of_node_put(node); + + if (id < 0) + return -ENODEV; + + return id; } int asoc_simple_card_parse_graph_dai(struct device_node *ep, -- 2.19.2