Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758904AbcJQIhS (ORCPT ); Mon, 17 Oct 2016 04:37:18 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:40117 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758781AbcJQIgz (ORCPT ); Mon, 17 Oct 2016 04:36:55 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="222518521" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <877f974byv.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 15/23] of_graph: add of_graph_get_top_port() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Rob Herring , Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , Laurent , Guennadi , Grant Likely , Frank Rowand , Linux-DT , Linux-Kernel In-Reply-To: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> References: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Mon, 17 Oct 2016 08:36:50 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0002.jpnprd01.prod.outlook.com (10.161.74.140) To PS1PR0601MB1451.apcprd06.prod.outlook.com (10.165.210.155) X-MS-Office365-Filtering-Correlation-Id: 3f7732c7-8ce6-42c0-a62c-08d3f668be15 X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1451;2:xI1jBJy5G12rvES8SAE3n5ptzusXt0AEFMqkD1mpgRpdCj4t0lVwSDaGDnN+RvQ8nuO/3WWTxsTgsn8YD1WrBMq890cHTGpk8JYOsHXlOj+dsTu+NIgqx+nLWjMu3BuC3m+lkVvcX8XmDu7qbWc29331tWn/u8ES+RPilDtsUaDZqwP9SPtUzEd5V4hr9Co/NwimB8jkbP+b/4L41yfCjA==;3:X3B2SKcn/WmSdvyfss+QWRhwVIw+SlM4iKbEhJ5laTJfZ0U5P5EfS4eR4x6Zkq+sE0jUZJAOaGzA0jXpEq60eTT8Pd0zDHTMrYR+oLuJoZhDNY8X2S3YsjobLr+YC69PxrR+Lt/TsKGQWsU9iYqWng== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1451; X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1451;25:AZiReGP5zgK8NPFWzHPt1sBzmBduanSPKoe5wA4lJFvvGrjUm5o8Cn75l12za3+hbbcv2fvBpHHoSz3RtLZQewaGa0oTe9nLAxfAPoqiyOoazMroUXQTee5T9CuoZP07uVeAq8GUred/r4tdmthVHtGqzpBbi/Y4U5IPTbhwFb1fKpbkfwXpd8iCwGQcbg2kFGxF8RunVx+jwIeoaeoCptneigJSJRVfvsUqYksdh2bxkCZvexmdQcGVH6SV7abR9RAw4YLUbKk08MzszZY44C3HxawtH1LhTWevGhUvD67kaVii5xycpr52oQf7ewo4MFiQa77aTS+ADyfRv48qVzwfi/GzLkLaILm5g6R/4jip6XrA+SOgA0BMO6zWeDEWjSyxjiHc10kAeWvWcjZN/PUUUY0CbEMmn/Hr/EbuoRSR3Su8tczicaTQO+2MrN54DPAmqSvTCQnNOp5nLOHX+f4Ov13egpqtRHiA3nq+PEJER8fPRIXnVMDnrZkS5zhIj3Ym67aAIBv2iuY9H4UQv38FJX6/Mlp2cdrXL76hY6HgmRGhHTFyRfgT0tNzdO15Bg0Hd4zPDTONlh1KJYo1uQi0Wo8nVc450CJJEKuQDhWAWaU567ow2HJFhrcrVIkRczz3qX5eYf7CAb9FY/vRBKYd9z7iRB287GV8qH7IbRmucE+ErShR3PpPEsSn9MFV0Oh4hIAyxwqcEknYBVhGmg== X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1451;31:DxBv8mTBwRLK9Csu21TyzWyftuk+81Hs8GnTlZAdAkmiMuM6lckFTUaFXsnK5l1k8uzJnuy2Dp2LzSMavsXNLH7wpwMR1k4+RWRp5AqKC8qAwFuEtgjg5l2bBDxc+G+zW5aAgGR0WIpmgbkkwnbpoLEqJe7TvkSGgD2fbTD5KJG4kBrdorM+aJMgX6nNStGB+e3uJ/f702rlFgcVLr+BQQC+VyoPjbT8HiwuT3uVQr+qxV687wAkr/JhlEE+dJ7OV48omotnCJU1VHR3ADIc1g==;20:0CydOLK/G97cQClpkwMRxDd+S9C/HarUStAJx5UU5QSncuollq6Q8D9PsZLb6lvA3VzuypXJ2f7Q5TtSqH2rLnHoFiIOqvNLsw7zkD2p/tQ4VyFJZHSgQ8X/B1lTdmna895Cw8d43gIJEZNtwWYejbpqSRKyTqNbKuAjwS2Y12Ft7TWV0slGghQmbIwYSu7yB4p7FgfdL3eCct2uTXiutcRk9fpdP6zUPK/8PE2vPE+rgEu4H1ZG6giU1gQAh1KpXftLaLEJH4JTtWoX8RZShlhOfb8/vJQrRH+d0NQX9BXfUop2oP241NSQLLZ2ae8qT4xqq15l6hdANaeeFP4OOcYsRh9vqWm8fEk5uin1KbB2KGooAO6DK+oKo+fWCf8jibkuL+zTQtJHYNsHx/qRTUoSH1cjSJVwmhH5rdmNDeRjAZlbyZB/6I7lGidEH8JHMT9Rc99eZ7MtE1092M1u4hYzfaSrJitQqOHWApODKSjxmUTf48XzpqZlHEk+Ke84 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026);SRVR:PS1PR0601MB1451;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1451; X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1451;4:flwWn+pf1X2fw8NNZP8pJw+H5TyaxRLFEIR2uqClPeBWdVgt603fICWQ7H3h3y1oMuUCmTAiW67IWnsJMAs4IF7ShFZd/HtRsYcYLB4w8k/hX+apSkLKOY8SZjGznQ9LGwKb9pe+bGNW4HyLCZ2GEi8n6YmJk2zkeYpqnTQw2dMJI8ymJauYk0GkSYBpBRzpfq9sTTSIacaBiDgu+84GHLKnZBVTbDdciD81MdjO14bZBkYMdgXgiEQU82AR8gB3i/+IkqbHxTzjTZEb2nXvYAdVpAVP26/c/8q91AttrIrYbl0359rT4+dW16RJfPD86DkGCZJSbrbTRafC2SvxrvP+xgl0fX3EeGLY0TKCQSmrh6HwLxYmCME9bK/ErmW9eM94N0tLrqdnw5ICl8cacw+hRDUFwMhvhKEXlN50lEs= X-Forefront-PRVS: 0098BA6C6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(81166006)(81156014)(77096005)(36756003)(33646002)(42186005)(105586002)(229853001)(586003)(106356001)(69596002)(4001350100001)(8676002)(101416001)(97736004)(50986999)(2950100002)(76176999)(54356999)(19580405001)(19580395003)(2906002)(47776003)(8666005)(23726003)(83506001)(5660300001)(86362001)(305945005)(5001770100001)(50466002)(92566002)(6116002)(3846002)(7846002)(7416002)(189998001)(66066001)(4326007)(46406003)(7736002)(68736007)(53416004)(7059030)(16060500001);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR0601MB1451;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;PS1PR0601MB1451;23:34bZCl+MTeV0DCIFtIIEXOPkTWjWQgL0e3bS5Ka?= =?us-ascii?Q?mrZcBQy/VmZokchAyIF9sESVFuJKUQJqoCg8GepcPiBcsT2bAeChaau5OGOr?= =?us-ascii?Q?xS4L77BjRlfXEdjt8cLw3FLFh8v3NWQKGN5allwJuUbsvHIE9DnAqdmbshNs?= =?us-ascii?Q?nlnG5fiw0KCoXkjcTsMhwmcxEag5HFyOCxDKFHupLafDJrMVwFXf27tIfnY1?= =?us-ascii?Q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+xx+jzf7OyuhJd5U1Jb8azuJORMSZY69muPOPzZyqMpyKNrLQ033/0y8FJqssPjOEGvtf+ilB1bVYDMJAaehkIfVXP6mQONlw3rJvLWOM5jFhCbIvJoPdRyPYNkBDpA0zMm2icREMPKq2bM0WQ1Ne1gXYZ3NCFUDgO+dRMHwSmTquZbi2FlQosn7gCYctpYg33kYp+TvJmHWXkx8JIfqPITg0XKGrw5TvMuanji9lh3KB45ms2DyRkeoM=;20:cIDI6d0nHvOBl0EX3asCZ7V0rOjeGCmIFJX7/Ts0l54AQ8dniyzpL+wWcmwM41em8x3Sq0C0mFZz+lPjA8Sa8lp5LYwd6/d3SBftO/eYr/tNcb6C64ebQXg7Dr1RCfEOT6bkdDbZsvJJzaAV6yq/GN/BU+JZdyufCJat0tpaQMc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 08:36:50.7135 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1451 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2183 Lines: 69 From: Kuninori Morimoto driver want to get top level of port[s] node. This patch adds of_graph_get_top_port() for this purpose Signed-off-by: Kuninori Morimoto --- drivers/of/base.c | 24 ++++++++++++++++++++++++ include/linux/of_graph.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 9d22391..07b9f68 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2261,6 +2261,30 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) EXPORT_SYMBOL(of_graph_get_port_by_id); /** + * of_graph_get_top_port() - get the top port node + * @dev: pointer to the device + * + * Return: A 'port' node pointer with refcount incremented. The caller + * has to use of_node_put() on it when done. + */ +struct device_node *of_graph_get_top_port(struct device *dev) +{ + struct device_node *np = dev->of_node; + struct device_node *node; + + node = of_get_child_by_name(np, "ports"); + if (node) + return node; + + node = of_get_child_by_name(np, "port"); + if (node) + return node; + + return NULL; +} +EXPORT_SYMBOL(of_graph_get_top_port); + +/** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node * @prev: previous endpoint node, or NULL to get first diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 0f362ed..35e9a6e 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -14,6 +14,7 @@ #ifndef __LINUX_OF_GRAPH_H #define __LINUX_OF_GRAPH_H +#include #include #include @@ -47,6 +48,7 @@ int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); bool of_graph_port_type_is(struct device_node *port, char *type); struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); +struct device_node *of_graph_get_top_port(struct device *dev); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_endpoint_by_regs( -- 1.9.1