From patchwork Mon Jun 17 00:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 806243 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2075.outbound.protection.outlook.com [40.107.113.75]) (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 5DDDB1C2AD; Mon, 17 Jun 2024 00:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718585959; cv=fail; b=M8YxqK62mujFKvsoSMn7SGBMBQwlE/yXabfFtNGvJKp0JQBDoWjSYAETL8YGm8zXt8nCqkU3NUv7V6WVFNjLRiheUpHZlq1w26FDC13xmuDcFgrq+k8JQ99a3t1nR8LSbFGlZNfH6+/NbORUilrWLGwn/cI3HWR6eqJ0LeQaUpw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718585959; c=relaxed/simple; bh=8ZuGsgrdGcfp+QgOSFkBt0AMtXm/THslfJQyRrMCYYg=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=t+6IFXlSMg+2hjfFHs/G1w2K1R0OBcyTyuxcx7vavzEocXuhMZiiYh11plhz9kxnGYbLi+bJ5ZFF8kI8dtT4BGfU3JT8dApo5HNklQMfCvVFCpPdawQ5qaqVhWPvQD6K8P3UTQmKF9F7582/AvBqJKgBFx43/iUhCj0uas7uKIo= 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=XbJzMLDH; arc=fail smtp.client-ip=40.107.113.75 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="XbJzMLDH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZJcuDX0wh2Bz0jbgdiQY93O5lnMCBWF8XSm/oTIXJibx63kQ/Ho2Hsi3aaE5JyxpgQd/OjkxzqCnx1wKgku14KOYJCEpYYwaNHScSnl3dVqACog4jJJtVWQZCewOPFxitGKeQMSw1oVeTqbknfWmoy/XeXw+n16kt495w8kj2Lc4H1hSpj3x3AbK86KB4NlH+hclGL5kwMcJDxaOhdZtHQuiH3R4dmHbJx4a3IMnZfvg5qiPAbqAh5dOLDtfjlnP7tpkP8LiXvuLZ9rpZsCcJJhV6tZ8lCMzglSYwMG5DZZmAQ7g3KlBdwhXVqMfLTsStXdKd5N+xG1Jelc1pMxQ7g== 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=d8jaddDuFOHl/UjpYWMdK5R+yPVNo37d6zdKH92pgZAMn/FwwvAts1LwwcfaOqlymIcZ2vfKvWHssHvBEmCn8cE5XwX55aCfjYV82mu7YVUWQUSwONYOdub+GLSrUQFB11fVif21mKCtmoNp49MTttGyMc5JspLoQDbtEDnXgLJDm23BWq99h5oKsBrYvQE+5P0yYj6SHGlWc6jaCsxP32ZqfefzEXfDNsCBmTYdQsoW/cfwAeFN76qC3QFA21o0Ws7zfDblMOXqcRi6htxgqFrI9B0KAhKN+XPqvgTRLYsQ2WevHij3M1Sx+26C3Ju1afbRSVYhq3aaH3QoXjl/iw== 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=XbJzMLDHTNLiwQ4FBodmjV1SmwaWfWdQMlAWtIR5sp8EZls0O58/FkK9rtngrVfCOJ05oiOBpqLGXxAob86d+HsHeo8jcT0+qtHRtJV/gHNIs6lbooHsFLQYtbQDc9LM5JFkihl9uKUFySG5BvQXpLviYjyqeMBpDp8BWlyltN4= 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 TYWPR01MB8560.jpnprd01.prod.outlook.com (2603:1096:400:13f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 00:59:15 +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.7677.030; Mon, 17 Jun 2024 00:59:15 +0000 Message-ID: <87o780s7tp.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 resend 5/9] media: platform: ti: use for_each_endpoint_of_node() 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, Sakari Ailus , Hans Verkuil In-Reply-To: <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com> References: <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 17 Jun 2024 00:59:14 +0000 X-ClientProxiedBy: TYCP286CA0073.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::18) 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_|TYWPR01MB8560:EE_ X-MS-Office365-Filtering-Correlation-Id: a438b9b6-1fda-4264-0c8a-08dc8e68b559 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:13230037|366013|52116011|7416011|376011|1800799021|38350700011|921017; X-Microsoft-Antispam-Message-Info: bXu5dPBIJe05RVnrK52g8meObmDqTz+ZSVy8NVyot4qLhjKpegRVmUFLtu7cygv7zEBgpCNRr5FzAHC/x+9zW4CXxFDkwVcdjRN8SNdZBB0MbizF1W4I4dpwK8Cek1164iq0REQFvWsEY39s4pYePIWVtMBpFqeBoAD/J3XJuQEuvMKmylHicrmtFgkWJzXpcau9j8+oC55YJsrhYqjs/5eC1YbR2MypT53m66OVGdxUB45WOZBV/X9cwCEUYwyaNGbgS8oQMxGmthL1/akX2RO0PLOhfLXihR3vm62/grq/9hbPECP69df5aYfbzwJ3xDU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ANpI1v/a X-Forefront-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:(13230037)(366013)(52116011)(7416011)(376011)(1800799021)(38350700011)(921017); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 97gEvx99sWKh7v98i3mozVlAfX8uHeGOTR8mcaZhst80lniAdG7MkEauEnRB+1C5t4wdM6u5MqMv38JVvG9eQfkzeWSGVWRQ1AaX1viFOgZveqe5Hr8b/msviA8WeuKzZAvoyqQUVj57735MbuHAboqP6tClHhystZWWvIAjDUsrdBiC/8p3gnx+JmbDEoisaQ/poNlRd+lSqAWSjupQFhvUhD0Qd3h8WdM6eZGDZ6ZH9+wjFNegC7QdpTFZ9jNYqj5Dkjz1d5hlpJe+TG/cT2MZUB97xa9qOXlXwunxI3aI/C3da68ajLJPZhPpSG+GtxUCatM6PCwvQwhULIvMSFHbR8hpHzSXGAamXCoSsLPfhYfTlxINC+0zFr7CmJbmq2JITfjiuvgxkstzpUQMdRyeg35mZ99rF9yvvbnGpS+p9iW9W6svIfO7TkrFf8s0cnc+eCCAclbk53XX9zXvxK0/AP+XF9QtT91e6Fx7gSQw4OJBJ2JACfTFMUo2wctC1zpDnpEzaPasMBfs7WMzCOpOFYeEL961Q9xnB+V8nZooMB/ovuY+vN35sbuxXqc8aoTbG/UU+e1QG4Bgm7I86SPAERenyeUgxA4+iUT4z+t1JytsFWr24ELF94sG5izLvf9atXYLcZ2ZTKbZQ3bOEQKpcHPQqezqYlHKXvLfAhWc0mDyOAXIxBvrN4GKgIsdng/WiTlO8Nazle3eWqybGx0gOojvXb9oXUrlGZ2VsyhC3GmbIlRwu/VkxVOZUFFFEqq9Km/w3XhN4Asz1Sii1jpQMVzy/rG7Ce4Uc7c2pxkFP/rtqV8qozt2fwVM/NnW5ZB6U09H17VLEx0v3ST+op0z3kz8fMVPu2LWr7Nmqw2Fl5JXs5wVcVt9BlmJybNojOW9IgwwRL+MUDkhTVa7YAfYV05hEQJg09uUM9ntGpheiBLwRkTnyFTg67xzcplywIg+gPZpg8NJ01vjl9ENCn2LW51kNtqyN3YD2jFSmW1KeZUIfkAPuOP/hLbILTbnwZ55kWPGjytFcL+dY1lbzjd+RE3lCUSg50tEDfvs1u+GjmTWV65ua5sf1h3simY6+BHBSJ28U1GJ58tUQHIIKozmBE77nml77VD/SElxfR7dWJ/RjFPeLcYH7wQqzWcKdlRM7gJwtW/eq/pF6IRWxyWU2vur89IxG4ZL0dybVE8ej3erhnUCgide/e6oDSyf3PTqXc7Ppx6CaphNTdjnUtMifS9KeXNo92y4Tob4RSupQuIKjkaQhCNJl3qkATX024mJJ8fLiISKSesXeyajZRQQw2AsnQRUbvQ9Fvc6KCjkVY7DT8e524cpgyAxh/SxDelbq5sbDC2seufi8zd3o3o5HzQkJy/2bCv7a659htRIPt9BAezFu6W5kXvg2io3J5kNN7nDDdFaIjkZp4T+u3UDX0S+uLwaPAPZMf0P9Jk5eR1/Ac9BlzF+ainjs9yg/CfbjkcWrJ9ULAZRbQzOWr5O2fYcdgwo45PEU2MMJ0XuI+keI4dRqxUNEvHWepnW9R+rYShuVUzPgC+eRLZuoAZ/7shyg6S5faHNdcZvrvcKGrZwoPPWo12nfSxn9cWwdbYqXYBRiFZ/HU8gj7sWdSd1P4h+RuYfDSvBRCezc1Y= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: a438b9b6-1fda-4264-0c8a-08dc8e68b559 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 00:59:15.0717 (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: 6ZZK965kHUn/Ui/nrF2LUeeM5+3dOVt5uWL3OpimRilJ1LYALZ48pI84NUKB3HcNxWQjIXH5HbsyIvCaguFn3WjHGf0ROzKsUM/sjDhP4AhlcsAhgE0SYXQH7sCLB7pw X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB8560 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: