From patchwork Sun Jan 3 23:12:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 11996031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80606C43332 for ; Sun, 3 Jan 2021 23:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A672207D1 for ; Sun, 3 Jan 2021 23:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727896AbhACXNm (ORCPT ); Sun, 3 Jan 2021 18:13:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbhACXNk (ORCPT ); Sun, 3 Jan 2021 18:13:40 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCE6C0613ED; Sun, 3 Jan 2021 15:13:00 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id y23so17210158wmi.1; Sun, 03 Jan 2021 15:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ehPrHZn7ZZzvSS78OjTsxhmL98CBAFkSirXNPUU4jAA=; b=j0pfKVC/7N7YaIP3FiNaGJehrinCecyLVqkZxBeKcfuftdNjmIbdyXdbNtHeezvXGi wrmAQdmTHF9+lmAFLzxbAlIUvv0ygLyDEcG1LS7PR6W/iUk+1LyttKIICByxMA9PRleh S0aszZtyP4xRM5jFn4irYTcae9yR+7jem7+ao6TTL5YEuZ5kYnRJjqQzLwGYF9zTYzf3 uAUbwbGNPHzPeYCOcRWJgerk5eiPJuefIR0ry2WlXV4mmsUx04VdIvM4GUzbQA1R/iML TN+Bdhfzh9BYN9f/ee+Lf5XQ6Fu6ErlEj4vtY2hMwAtLfWvXkM5UTi+VbIbcFFDY+uzm EqDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ehPrHZn7ZZzvSS78OjTsxhmL98CBAFkSirXNPUU4jAA=; b=S/cUR9NHKdm/6w+SoJ+Smr+K+lN2p/iOxY7yQLxyz1mmgWySOcH2gDZr6TP7R20Ab7 bgI7neaUQLxiFJcAg/DSA1pUs9q2jp9uPMsCk37M8FjFMUs5FliL8xhGc1fI9IRdsMDO iRqrDl2tvHMrlyMIlVj9nTY4+ovd3wgRkC93egTtqm7oqdxMuqjhJkg3vIXP3mZH8qDp po4INhZoEGMvpO+Yhxn/8U+VJ1vcO9LX6puisXFkanlvUnVVpewIeNM9JXHjxKaKIeYV V93TmgbjmISR6dWEMv5EyjFrCk9VY3edXywCmSd4ndxhqFkuWpxAVj3yfjhkFZd6H48i 9MGQ== X-Gm-Message-State: AOAM532BbdX9WPcWESfKtRjQtf0AerDspP7y6RFBmOWJMTiQGjADhK26 hCny4QHiTmrE4R6rql6wAiQ5tJA/KhUIbcTF X-Google-Smtp-Source: ABdhPJyPhaqRj8QfXs6oxohhlgHo/czPiAWUCmg6dJILSsulSRuV6EMerOq4ZN2pY7i7yzb0XZx8Nw== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr24988982wmh.114.1609715579148; Sun, 03 Jan 2021 15:12:59 -0800 (PST) Received: from valhalla.home ([2.29.208.120]) by smtp.gmail.com with ESMTPSA id h9sm32571018wme.11.2021.01.03.15.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 15:12:58 -0800 (PST) From: Daniel Scally To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-media@vger.kernel.org, devel@acpica.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, sergey.senozhatsky@gmail.com, mchehab@kernel.org Cc: lenb@kernel.org, yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, robert.moore@intel.com, erik.kaneda@intel.com, pmladek@suse.com, rostedt@goodmis.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, laurent.pinchart+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, kieran.bingham+renesas@ideasonboard.com, hverkuil-cisco@xs4all.nl, m.felsch@pengutronix.de, niklas.soderlund+renesas@ragnatech.se, slongerbeam@gmail.com, heikki.krogerus@linux.intel.com, linus.walleij@linaro.org, Laurent Pinchart Subject: [PATCH v4 04/15] property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary Date: Sun, 3 Jan 2021 23:12:24 +0000 Message-Id: <20210103231235.792999-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210103231235.792999-1-djrscally@gmail.com> References: <20210103231235.792999-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This function is used to find fwnode endpoints against a device. In some instances those endpoints are software nodes which are children of fwnode->secondary. Add support to fwnode_graph_get_endpoint_by_id() to find those endpoints by recursively calling itself passing the ptr to fwnode->secondary in the event no endpoint is found for the primary. Reviewed-by: Andy Shevchenko Reviewed-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Daniel Scally --- Changes in v4: - None drivers/base/property.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index bc9c634df6df..ddba75d90af2 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1163,7 +1163,14 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, best_ep_id = fwnode_ep.id; } - return best_ep; + if (best_ep) + return best_ep; + + if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary)) + return fwnode_graph_get_endpoint_by_id(fwnode->secondary, port, + endpoint, flags); + + return NULL; } EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);