From patchwork Mon Apr 1 00:05:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13612352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C35F3CD128A for ; Mon, 1 Apr 2024 00:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Subject:From: References:In-Reply-To:To:Message-ID:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2fQejRBDlktWro/4/mxNQbsLe4kF0bieOl2JjNI+UFs=; b=lMnyTRBM2hQXrQD6RQ3UM0Ffsb 2cibgCS0n7hn2gejBvy5tZudhY9++LiPUTI448iLy0NbYQU6udpk1bP3oG2T33biYfxYeJheVc7sy 1/nJeevmq+HUtFo5uMY75zDr4RdBfj/fYnmvXe8YFARvPBm1y9y86cq20wFhmcZZGEq2s+97uULAo Ym+ccp2YegIQ3DYGHgqFJQkC8ht/MQrTdGFE89HRQ7GqwIb/5lAagCO+LzkvSRz9Yk3CR7cZckOJ0 e7AL9d9xQziOWO+eAWf6q6zQbLfAhFSCb2oUG+Oas28Vhb8sNNqgAZjI6o+BgxrFkIK8sqo9vu4E4 +S4aWX/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rr5Bb-00000006WDu-0ABf; Mon, 01 Apr 2024 00:06:03 +0000 Received: from mail-os0jpn01on20700.outbound.protection.outlook.com ([2a01:111:f403:201a::700] helo=JPN01-OS0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rr5BX-00000006WCJ-3reZ for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2024 00:06:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VGazy9fsTdMeACToC9ne+78DlPGaRioJt/maIKMqt2GPVJPnapvKUeLz4GEUVGjgL4IyzUcTcoYuloOAgo6xHacCZdHwJDwzO8kuzwfSts8Kr0PqKPC4oaBklxGuJMY/ISGt8jCaQGgHGE8b8jg5+27P9OkA0buYsmvf8woHnX7O6QO2UKttmntEgx9pYuUdnlNmqBfeOKc4q+fNays1FL10NyQbt/i+/1BQ4KXPJ5AnO4x5WN9nHGH+QodyNjoA5siocrwcyJ5eOZVDjQL8i2Hm7G2G9p0HcjyJHI5xfzBY3J8vEimT0cxuLR4Cvk2D6gxdEb8AWoxyTJbzWHjKng== 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=dyRXIBsVOEuvEsI+HIz1KBO2P7gmWNbvh+DmO4P6oN0=; b=D5eVUUmo7Nx8l0j2Q9d+DmDXhHtuIidg8mNA5Vt8lyB2GgxAaBOQymHVoRQx5yo4CBJkAqfbzvpGXlzHqGbhqgcgZghneZjxt2a71KhiP2qos41BIXsByBn4YEcJVMxzk6hiuTeI7zFjaNzRmbcJIImoTDXU2HFMvYJe2jC0d2vKISUzUIWSYhRHEfBWPu73NRLhVn8MxkhvdWvcq8Dci2WZRCpKilK+SxPAjKhgC1ibXKqvKEUKJj8WSHMexanSpiUMJUcLJG32FaYPvZui01iTVNB3N3a0woSp/V2hoe9L7O1JxLK5mWAQYgEkFhs/D29A6O6DXJ5z+mTYwuling== 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=dyRXIBsVOEuvEsI+HIz1KBO2P7gmWNbvh+DmO4P6oN0=; b=XhJzAbYoFF4r2DmnszfQiaoReVE48EA+3uEch5oGF5Fo9thFxqJENUU9g8s5xUpArxaO+AN9hsl+Sh/dzul4FxkOlqaNVxyrWAkge1F6Aalm5NtpJxhtpnNxP0OKo0Mr89dUKcDdslZNHRQ1ZrdAO4QRd3McV6ZEDH+h8XkWCro= Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OS3PR01MB7826.jpnprd01.prod.outlook.com (2603:1096:604:177::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 1 Apr 2024 00:05:54 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b%7]) with mapi id 15.20.7386.025; Mon, 1 Apr 2024 00:05:54 +0000 Message-ID: <878r1yueu6.wl-kuninori.morimoto.gx@renesas.com> 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 In-Reply-To: <87cyrauf0x.wl-kuninori.morimoto.gx@renesas.com> References: <87cyrauf0x.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 3/8] media: platform: microchip: use for_each_endpoint_of_node() Date: Mon, 1 Apr 2024 00:05:54 +0000 X-ClientProxiedBy: TYCP286CA0151.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::8) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB7826:EE_ 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; X-Microsoft-Antispam-Message-Info: CwSm7xsiX1NZ6fCy5313Lmt2v5cv8ZlZcHAiR4uf30MDjYYNmj8kL4YnIFvBrm58VdXdoTDWfhRjXmeArXTd/TWFGGNfIwXz4kiPOtv5e6oMo/SERVSSCgm8IM3ghlRKvxyIjvxWtc4HSvA4ovNaahE5yB+uQ5vvnW8oHHGCKVolwsOG0l9vSxdwi5+PhJuO14J9Rysj+E8ZUKbZXcPe8PTJfaax2pDHcgOqi+jTD/FZTMkWIdTsyVcwY6mBZSSPRVGzgFEAcrtzQTZs5vWSyTMOAfCWhjHcu7K/dUy5ptu27vrmykZtlh5VwDSvSROI4cz/ymMAtP5Y2+C/uEH3Ua9qfMVYtZ5oxmgO1V9OjiGmiUavVMyvdZabKG8QUWDRNFYif6f7s7y/vU5M8bnLr7eqfYa18pf1Vtpd37FjVWHE74QmL585xhxWNbDneRVm/h7il/zlJClsigUT37SRLqx78bbcjFe4Oq8doyOPsf5Naix8oULJoowDPXnFMKiyhhFPIVe0ooN15jTKJDEYaFKl6BECCUKCkBTdIpxnaDt3hrUjMgINKEr7q+4Gku4plFRNsrueykJ9M2hdOmsiiQYsps2e0y3WhlAX5ouQXyUyWUNR0DPIj9ApYxTDLCaiM+RxGsOhWgVnAfdOi2lHLlYiTCLsZKNJHy36H4No6t/8sfY2VPz0RkV4rxtBEzsCDUoTwPcCDHLJAMCgH+qng1+z1MPgPMK/Edgu/QGhIcY= 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:(13230031)(7416005)(376005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ugaFha11OrynSRHxVm952CU29Hl0dl4obe2Ig2xEtzZKGPjOBvmF8Nc/JiLWBoxOtJe17Yle4a0dOcPjt7yTL0TEK7Hph4MC2sBgGaInRNrvdsQX4LQWWvsoINSbftd/vCzW28MaXfNL3WfqMjqmBG19Mshj5LLvwdV5pG27HXsOE5v9YUIX1ZGjLixSagVkPtTEsToMm5PNRudLdZOIcpRFDINiJwJT6rmN0q1blYO2M/1XHpJtHka0V6vJKoHu7+C7VHEWMnBYaPOJA3LbM/ciMLREThn6SzrfpQR4bhgw+UHFMb4G+CQONkHhuGnXPyYxMqXXE7tUS7F6Rmy6kfxMT5hexGZXMu97KCQ0WZGWvZl6TZhV5GOSAQzwC3FPaV2DzwzfjFG/D2I1qh05jFZc5AGizINAIHfjWMvXkYULXnkXsZBFk0danVfB8xrL+fCw7xXaCEu/d77f90Qy5VM7zoMdqNU/I05rTG8BtSWS2lo20zO6EU0aGm++OKI4vlTrac85kjWQ2zugplIC7RBsWTYUDuKBA0mCa7nJ33wM00DRHQhMBfAqyQDzUJW7aCB8GPKL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-CrossTenant-Network-Message-Id: add25e60-5fc7-4ad9-ab2f-08dc51df7fb2 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2024 00:05:54.3268 (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: uhLXQqeWEQxTA0OWHrHUkVxqYK6kVVnFXEJPDY73oLnwQwo0++ok/2Plbss2q/dQUSUR9//33V8wy9JpgjYPgsNslhlvZePp9VWgeT0lo/9HHOpe+ZCkSQFUjWshi34X X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7826 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240331_170559_978430_CA1452AA X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We already have for_each_endpoint_of_node(), don't use of_graph_get_next_endpoint() directly. Replace it. Signed-off-by: Kuninori Morimoto --- .../microchip/microchip-sama5d2-isc.c | 19 +++++++------------ .../microchip/microchip-sama7g5-isc.c | 19 +++++++------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c index 5ac149cf3647..d9298771f509 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -356,30 +356,26 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc) struct device_node *epn = NULL; struct isc_subdev_entity *subdev_entity; unsigned int flags; - int ret; INIT_LIST_HEAD(&isc->subdev_entities); - while (1) { + for_each_endpoint_of_node(np, epn) { struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 }; - - epn = of_graph_get_next_endpoint(np, epn); - if (!epn) - return 0; + int ret; ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn), &v4l2_epn); if (ret) { - ret = -EINVAL; + of_node_put(epn); dev_err(dev, "Could not parse the endpoint\n"); - break; + return -EINVAL; } subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity), GFP_KERNEL); if (!subdev_entity) { - ret = -ENOMEM; - break; + of_node_put(epn); + return -ENOMEM; } subdev_entity->epn = epn; @@ -400,9 +396,8 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc) list_add_tail(&subdev_entity->list, &isc->subdev_entities); } - of_node_put(epn); - return ret; + return 0; } static int microchip_isc_probe(struct platform_device *pdev) diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c index 73445f33d26b..36204fee10aa 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -339,33 +339,29 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc) struct device_node *epn = NULL; struct isc_subdev_entity *subdev_entity; unsigned int flags; - int ret; bool mipi_mode; INIT_LIST_HEAD(&isc->subdev_entities); mipi_mode = of_property_read_bool(np, "microchip,mipi-mode"); - while (1) { + for_each_endpoint_of_node(np, epn) { struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 }; - - epn = of_graph_get_next_endpoint(np, epn); - if (!epn) - return 0; + int ret; ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn), &v4l2_epn); if (ret) { - ret = -EINVAL; + of_node_put(epn); dev_err(dev, "Could not parse the endpoint\n"); - break; + return -EINVAL; } subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity), GFP_KERNEL); if (!subdev_entity) { - ret = -ENOMEM; - break; + of_node_put(epn); + return -ENOMEM; } subdev_entity->epn = epn; @@ -389,9 +385,8 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc) list_add_tail(&subdev_entity->list, &isc->subdev_entities); } - of_node_put(epn); - return ret; + return 0; } static int microchip_xisc_probe(struct platform_device *pdev)