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: 13612327 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2136.outbound.protection.outlook.com [40.107.113.136]) (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 E8DDD7F; Mon, 1 Apr 2024 00:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.136 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711929959; cv=fail; b=ntKIKsL1DRBqzYWCsxiLHdJGUmRaK5wklwne43+NWwMQDZDsJ2zLJiKPnUEiwUQ8U/FBB1qAXdnAb/TYetvnX+rvZqdzCXbCaDfeRqOpyRr5/8/tgPkk+dNLTzz7ROytcRz6ZmtmCcWBUhcAFXiIKyj27bJgVWUzfFuSLQmLMKk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711929959; c=relaxed/simple; bh=lfnFGW0g1UBMeYtuZh1KvY2Jnm2sDwuI0PU2aSTCw+E=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=mAp55LzGZce+UywiT3y69jc+2ZpU047a2mkEUysRamc7dW0LKrpR210w5Lv0Jhq+S1kYBabW13iR7ruGBkWxqb/0SzzZhF/q89Dp4QSqIAQh8/MXzeiNpnpdicOZ0dIoKQYoCxweTKQKKTQgzlhHP0CCIzkNCUe8cNIxP5pTWHQ= 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=XhJzAbYo; arc=fail smtp.client-ip=40.107.113.136 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="XhJzAbYo" 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) Precedence: bulk X-Mailing-List: linux-fbdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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++OKI4vlTrac85kjWQ2zugplIC7RBsWTYUDuKBA0mCa7nJ33wM00DRHQhMBfAqyQDzUJW7aCB8GPKLU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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 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)