From patchwork Mon May 22 17:36:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9741203 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB6CC603F1 for ; Mon, 22 May 2017 17:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C771528521 for ; Mon, 22 May 2017 17:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC2A32873B; Mon, 22 May 2017 17:36:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 680A928589 for ; Mon, 22 May 2017 17:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760389AbdEVRgr (ORCPT ); Mon, 22 May 2017 13:36:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:54290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760689AbdEVRgq (ORCPT ); Mon, 22 May 2017 13:36:46 -0400 Received: from CookieMonster.cookiemonster.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 28A5D239E2; Mon, 22 May 2017 17:36:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28A5D239E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=kbingham@kernel.org From: Kieran Bingham To: sakari.ailus@iki.fi, laurent.pinchart@ideasonboard.com Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, niklas.soderlund@ragnatech.se, kieran.bingham@ideasonboard.com, Kieran Bingham Subject: [PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent Date: Mon, 22 May 2017 18:36:37 +0100 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kieran Bingham Provide a helper to obtain the parent device fwnode without first parsing the remote-endpoint as per fwnode_graph_get_remote_port_parent. Signed-off-by: Kieran Bingham --- v2: - Rebase on top of Sakari's acpi-graph-clean branch and simplify v3: - Fix up kerneldoc - Get the 'port' of the endpoint to find the parent of the port drivers/base/property.c | 15 +++++++++++++++ include/linux/property.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index b311a6fa7d0c..fdbc644fd743 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1169,6 +1169,21 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); /** + * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint + * @endpoint: Endpoint firmware node of the port + * + * Return: the firmware node of the device the @endpoint belongs to. + */ +struct fwnode_handle * +fwnode_graph_get_port_parent(struct fwnode_handle *endpoint) +{ + struct fwnode_handle *port = fwnode_get_next_parent(endpoint); + + return fwnode_call_ptr_op(port, graph_get_port_parent); +} +EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent); + +/** * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device * @fwnode: Endpoint firmware node pointing to the remote endpoint * diff --git a/include/linux/property.h b/include/linux/property.h index b9f4838d9882..af95d5d84192 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -275,6 +275,8 @@ void *device_get_mac_address(struct device *dev, char *addr, int alen); struct fwnode_handle *fwnode_graph_get_next_endpoint( struct fwnode_handle *fwnode, struct fwnode_handle *prev); +struct fwnode_handle *fwnode_graph_get_port_parent( + struct fwnode_handle *fwnode); struct fwnode_handle *fwnode_graph_get_remote_port_parent( struct fwnode_handle *fwnode); struct fwnode_handle *fwnode_graph_get_remote_port(