From patchwork Thu May 30 02:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 801209 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2052.outbound.protection.outlook.com [40.107.114.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 151CE1BF24; Thu, 30 May 2024 02:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034775; cv=fail; b=P/5PauyP8quoVsK6nCgjBp1cA5GFEWmlUnLgzUexyxIUhsRL1sbyps1wCGssxmhCsEN3D9/efcBz+9tV4DObFOvkqBE0x0VkZu3Fz/QbrRxXDQZqdTpI0D/FxC05WdOhfvmNARbVTAKeAwADOZmVfzmJboUy57OOaQ3NqCtdnYQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034775; c=relaxed/simple; bh=8ZuGsgrdGcfp+QgOSFkBt0AMtXm/THslfJQyRrMCYYg=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=oCUUHFcLZ6ifSXI52l+c/zX4ig4gLdK3wiOgoKeZcW1s3sSBA/+/jiY6hdzCmr3vWroIdA/w0XEK9hopwVtJzbO+9PE+Wc8nvdw0PWEW7v6lj/kmuwgJhg5Nvmh+5kC+d+CQzBZeVLiFWUklihY+E1EPSojZeHk2KsBhRZQ/feY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=birZSt60; arc=fail smtp.client-ip=40.107.114.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="birZSt60" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtbjcjPYnl6EZtrGScC2QOSUTH5lc2+bI/ps1nfVGJEp74i+lacPqLZB15Y17aRtkMRaJZPTt+67b3718TqZvLi7A+M3GaE213gW3GgpQQnvTssiB6bKGxRSiU/wLvAgXlFkwguQyTat2K62zH5N7Huvo1L3vTOpVzwAqTWvbYWZ0iRafJO8PEePH2nWbfCSt0S/Wwd8T411PBR2LS3Dxo98rUPrpUX7kZv6yGbObF0hHwJMl78OmYvkaa+6pG86VHooXUO7W3RVgPTsOnn5AWVEgeFGPcS4leta/Iuvb6Eo5itG28ynWGdCi5HjL/maRBAFyaiKmjacmzdRAMwLKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gjGsaR1b+XxwTO9Q3/woPdYTEnq443MXMgIOL4ktaTs=; b=j+g0J3CiU/kxy34tATq2uF6L2ZR4xQd6gXixGGnkR27O3auelcHTN05CJ2qsfygunOhA7832lleUOqspJd3euG64T7Vfj13LFqY7rcJ8D+IH072r9qYyKagY+ZIUXFWUlE3UGv7sRIff5diuM8fX0/VDkM2fIxsFQ4BVlq84c+2sBtViIgsHfHEkjtXRCuIRBd3m4ISwJ82dGakPkAdDfIzz/Dlbof5qglaVCUxHW1vKRXhu1gcieVTRkPxBvqpdRE/IZrKTSoWA/gEmykleGivGZhvbBlzeO/A9dwH5QYgIKF62f25iw8YxGGcRMx4LeTTKK1I3X7kGeBWpGJa6Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gjGsaR1b+XxwTO9Q3/woPdYTEnq443MXMgIOL4ktaTs=; b=birZSt60Lozkygvd/UX6aiOJY/O2vPOm8da3OSjhPU1CKhs0Rd9LCj3JOfOJhKH/dotDXQ4M2cMDr9+OzgUDtaQLZa5d7pYcenQulthuy54RMJo8FJJsB1Yt6qYHkw+GX8BFG6HhxGXrqLv5BvFYgoxgbPPtrylFYMiQXUe/PMs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TYWPR01MB10240.jpnprd01.prod.outlook.com (2603:1096:400:1e5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Thu, 30 May 2024 02:06:11 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.7633.018; Thu, 30 May 2024 02:06:11 +0000 Message-ID: <87ed9koxyl.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 5/9] media: platform: ti: use for_each_endpoint_of_node() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: "Lad Prabhakar" , Alexander Shishkin , Alexandre Belloni , Claudiu Beznea , Daniel Vetter , David Airlie , Eugen Hristev , Greg Kroah-Hartman , Helge Deller , Laurent Pinchart , Maarten Lankhorst , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Nicolas Ferre , Rob Herring , Suzuki K Poulose , Thomas Zimmermann , Tomi Valkeinen , coresight@lists.linaro.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev In-Reply-To: <87le3soy08.wl-kuninori.morimoto.gx@renesas.com> References: <87le3soy08.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 30 May 2024 02:06:10 +0000 X-ClientProxiedBy: TYCP301CA0069.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::9) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB10240:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e270c2a-d1f9-43f2-6499-08dc804d13c9 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|7416005|1800799015|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: A0a16wCTaxgvdcabJ/merXRjFpJiFMPjobF6/vL/2BkaWwJOpQr9cLWw9Y7u8Jnn6T36N9IWMEOKUmokEAIkcQmfaCaM1YZ4MRhmsQl4YqK5mcGbUL5ihRH0L3f6qvqLpU6QQ4Z2MV4/ti6AicO5LQB3b0lOtqLP9gdXDIHrfdQmIypzImfknbbj4pHCC3Fu0X1m1h8ViAUsOwgEM5B1Yw4XXD+oOQOePkoin0ZQYB9ciZpDVu6mRLJyXhij5462e7diiLcJFGHa3Gr50PhtZjvdOPELo8Puahfd+nB21jT/jTStr8QVgWGIF2Nhi5x8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efront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(7416005)(1800799015)(52116005)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kfsNTyfeJVeCUT6v1C4CPGz8Vaq5F2mb7H9RtDCsPTn/63Kv4E+kU2toiTFPZO7VU6wnydNZgUQg6l1j3CsKp22RKjWxRRq9xEXxn0ijDDDO0cT7ok4rPL6QZHhhx4ApLHn87RN4g7QXFto1sSk4+Etwcd04e3z3hEKRGLP5dcLclriMWZint4kd6KogryWvKb2kXLoP+3fIoopqMGVNBG957pd4TkJBaSRcEoW5W+PC6Ii/bZtVis9pTJf5NNxi8OhJfTiLHQCJ0KiBetTEwwZgSzSZs3ovGvkRqCp2GtFIni9IHbMAMfL23FbLVJ87o0DTnSwKA3eZOlip37Cj5J+PkcqrmxXnPKmDOxGZiEoHPk/r7JGd3/OMTLxZuPC29y5icJU0l6H738RHtjjj0T4dr/VOd4gD4ikrqfRx2p/kJdJ/g/ZYQv2wnML1mYxBWekZeGvc6Pt/YPVxSy5dEYTkHBzPS6NfBcWSRf1yxdEhfQ0KqNC7p8/sQ05+lSS56AprVgF/ZHD9XN6fWV2o12cqidnvUQloosIboRxBVBo7M6wy7ji56Wxv9p4Pa7ePA/WS5hs1SQCwerv7FCsIPLsnsR0mSnuAN5KO+pteEU/X+2YfN9iBM1Lkph8/NdT5HmBDuLjHiWDtK+V9acKfwkG5mVOgrDej5XpgXVBE0eR3eO7zFkhnQcH13/8I3JoSTTvAAsDMWyABq4DmjnjqMURt3Id5ODRhqjGZMtrqFV6Pynj101/mdnUvKtBJ8zaJDMFQkV/arpZs16epzOa8JYMD2tMDpoQaumgxn6SAL7YJi8vUzhekFKGjBzH+J0R+EHVz5+Y6u2cn5KTkq18A5swRCmqEQ9ZY52pG2wFi1Jme6zsfTlf5d/DF7GNqGYr4T6FnCM6XMpHNWunpnjZbFwRKnDLQbtaDWxr5Pkz4K/MbKS85LJ02UQON1PQLNxTxExT9d9bozPZfO29fMDmGrac0ecQeW1fGVZHoP2w3Vn4vjc1Sfjph6hTW14EK68Fyr2j0s40FCh5zd3Nr/hMFmRtLRm35UONL99SLohYkO0vy0MhVchVUkzlLoYts1opSemZ0j0GfYK2to/yVroiu+aF/opvdVxFk87T4Z1IPk6qWr+lbm6ckC2GgGap/HAjccC32dG8PE/P0CpN3ThUDR/EYDxUksC2+FPhBxQnFOzwuwaYi0iJtaCvIjRTqD/bFuTplLu9MW/aHAfD0JLLW4KYrFDo7e9OTjAfHDalnkROcdRcRmvOiKO2hcQaHK/GvjGecTEQzWKYATR7H+rICcJDVsv26UQQ0V50If97PwkAcZO8RfQEtMKOaPpAsG+BlvDVn08NPbK9S3UEVsNoEi+VxlGZPpQsaIy845BZ5m396bfwSD43q0YeDOncr+xPWu0CX5njKHM7b5YIycId6roE2+3F4n45UfOaqkgvebe67dM2BOA42XuwbY/hVd/88RL0mssDVDvNqKoV1t6XNKQ55SlIzLFddZZAJGyXlrEVgrkSx6c16BLPS3rQEHzItz2qilQjaltfnqU/mlgI/jSupY6T5HZNX3JtanGD7m1UnuMs168QI81LfQXmeHZ1DPWs+gmyi29GiZ0fToWLjbILs5OLA278kJB6c8QMsqaM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e270c2a-d1f9-43f2-6499-08dc804d13c9 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2024 02:06:11.3906 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AIDJN+GKJv0+tciRAkWrN/bhdmscUzH88HIEtclcROmwQvoWoVmH7HQjoFjNV8kZrVp9KzNC+Qwkvs6LdjTWY6bNfTlnN8HPG9lndboIhXE2XNYzEYU5E6BljPGi68/I X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB10240 We already have for_each_endpoint_of_node(), don't use of_graph_get_next_endpoint() directly. Replace it. Signed-off-by: Kuninori Morimoto Reviewed-by: Laurent Pinchart --- drivers/media/platform/ti/am437x/am437x-vpfe.c | 12 +++++------- drivers/media/platform/ti/davinci/vpif_capture.c | 14 +++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c index 77e12457d1495..009ff68a2b43c 100644 --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c @@ -2287,7 +2287,7 @@ static const struct v4l2_async_notifier_operations vpfe_async_ops = { static struct vpfe_config * vpfe_get_pdata(struct vpfe_device *vpfe) { - struct device_node *endpoint = NULL; + struct device_node *endpoint; struct device *dev = vpfe->pdev; struct vpfe_subdev_info *sdinfo; struct vpfe_config *pdata; @@ -2306,14 +2306,11 @@ vpfe_get_pdata(struct vpfe_device *vpfe) if (!pdata) return NULL; - for (i = 0; ; i++) { + i = 0; + for_each_endpoint_of_node(dev->of_node, endpoint) { struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 }; struct device_node *rem; - endpoint = of_graph_get_next_endpoint(dev->of_node, endpoint); - if (!endpoint) - break; - sdinfo = &pdata->sub_devs[i]; sdinfo->grp_id = 0; @@ -2371,9 +2368,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe) of_node_put(rem); if (IS_ERR(pdata->asd[i])) goto cleanup; + + i++; } - of_node_put(endpoint); return pdata; cleanup: diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c index c28794b6677b7..16326437767f8 100644 --- a/drivers/media/platform/ti/davinci/vpif_capture.c +++ b/drivers/media/platform/ti/davinci/vpif_capture.c @@ -1487,7 +1487,7 @@ static struct vpif_capture_config * vpif_capture_get_pdata(struct platform_device *pdev, struct v4l2_device *v4l2_dev) { - struct device_node *endpoint = NULL; + struct device_node *endpoint; struct device_node *rem = NULL; struct vpif_capture_config *pdata; struct vpif_subdev_info *sdinfo; @@ -1517,16 +1517,12 @@ vpif_capture_get_pdata(struct platform_device *pdev, if (!pdata->subdev_info) return NULL; - for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) { + i = 0; + for_each_endpoint_of_node(pdev->dev.of_node, endpoint) { struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 }; unsigned int flags; int err; - endpoint = of_graph_get_next_endpoint(pdev->dev.of_node, - endpoint); - if (!endpoint) - break; - rem = of_graph_get_remote_port_parent(endpoint); if (!rem) { dev_dbg(&pdev->dev, "Remote device at %pOF not found\n", @@ -1577,6 +1573,10 @@ vpif_capture_get_pdata(struct platform_device *pdev, goto err_cleanup; of_node_put(rem); + + i++; + if (i >= VPIF_CAPTURE_NUM_CHANNELS) + break; } done: