From patchwork Tue May 28 23:55:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 799698 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2053.outbound.protection.outlook.com [40.107.114.53]) (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 1D24213E8BE; Tue, 28 May 2024 23:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716940542; cv=fail; b=kJm8PiMUIy2vaj2RDHKIDl7dG8fPIe+m4Ar0Xz93dII1oyveQQ0G9Thxud8g/OXX793SWx5MXQbqxSBRJuzEeeF8uveCEOoJoXN+H8yZBQDQyARD9oZ1P5fDN8XiQcSJYMzYYTyms1rrpvdMjkfME2zeWhV/R8pDkYw/0iNAy24= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716940542; c=relaxed/simple; bh=agzUnacBIJTHPp1hasMuBc5/81NtDGkAmh5A33+QhP4=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=Su1JcJHEsHFxoiVNtP3AoWuO19eCa1C/I6+mLQ8yZmh1mL517yLAGkW6FsUOOCTG6NPYh0h7PJxaEfbbjJd5Pb74vKo0d4esgB3BtEFnxq5qQURUssNmTJToB2nCAbtfbEgrwp1xS3EUi8D7WH3nig9DtaRisFlZSjbNKBWlhTg= 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=Su3+w8Jg; arc=fail smtp.client-ip=40.107.114.53 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="Su3+w8Jg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGjtuQyYvEeZ+gFACLE7Zs7vGLvoVot3LxRppLVWfBVZKGppbjWPc/0C2FmqD7E/ukKzIfcOiaQZQg/BDS8HE86ZUzByO7hSSukBS01O8eKvdWUWjKWXYuaWnMlrzCHyFqpxupYJwW20W3eoHCPc5DfSIbaspK8MIje6c6acqnTf9POlmDaxZDUPwn+mMVGo7EmG07sxY6tECVILN9iZ9ADiHopcMTvAS69hfWIvWX2sFN1oakoHymm+ukstCL7yIsJI8MA1BOMfL4T2BNQM1T9S6Hu4ccYBPEoLea/DEfiIYJcou4CK7NKa454XKsptOSmnD7pSlX5fZHpN0IX+Lw== 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=AflE0wTd/gC2/pi90zV18jpYHBCnhEamyrjrM01l3rM=; b=dqajXulD+ZT58fHCT86Nu4PsVXpPTmRUroh6eWCELn+AO4JAL7JTXtqfGDPvKtDit2Uij17HqPrbvmqFaIGA3qCv6U/6TYvSEgYYG42XYpb+7Ug00XRa34oA+/y4ZSD/PswIJrTZZ4kP2RErhnrqEyCRcP9lJf42MDUsLU3qQ1BLMK4IEy3X1pt1nQ3t1b8hHEXjz08CwjefWgpPfYMvpkHiV+UBAmn7pO2mqgS6G0wfTQ87qhhKeoWsDHr7jsjl3PGmZCJYCqOPnWCIBU+0T/+IglSWq64jUIP3oFEzqsQ7WG0ekplhV+wYyfIDfq5X3o9F6/05aG7fTVSeG8bVRw== 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=AflE0wTd/gC2/pi90zV18jpYHBCnhEamyrjrM01l3rM=; b=Su3+w8JgoPEBO+fKdaASLlfhAW6lAYrK60tf1G0pI0pvtKvvwsYSQyW8NaobWyvnKGWgPjYS3kZ6W65gE3V0seP+7FwPc4kZ9qyiGpKjMVodUY73C0hU/YMdY2RJ+/VW7lI8Mt4dg/iaLFivAIG5UFP+l2Za7GvEHQrDNbeA8Lk= 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 TYCPR01MB11224.jpnprd01.prod.outlook.com (2603:1096:400:3bf::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.17; Tue, 28 May 2024 23:55:37 +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.7611.030; Tue, 28 May 2024 23:55:37 +0000 Message-ID: <87ed9l4hl2.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 resend 3/8] media: platform: microchip: use for_each_endpoint_of_node() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: , Krzysztof Kozlowski , 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-staging@lists.linux.dev In-Reply-To: <87ikyx4hm1.wl-kuninori.morimoto.gx@renesas.com> References: <87ikyx4hm1.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 28 May 2024 23:55:37 +0000 X-ClientProxiedBy: TYCP286CA0010.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::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_|TYCPR01MB11224:EE_ X-MS-Office365-Filtering-Correlation-Id: 06bb3969-0cab-4bca-fd82-08dc7f71ac1a 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|52116005|1800799015|7416005|376005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: e3tIqq8WhRj1tob2yZZGUMU7O02hDB5uTabtBlKDn5PrL9fY1WnXmTAUomT8wlaLFMpKXOX+MHfBmOvKna91lzEI/jb7gnqbl3gpuptLhEhhtBvi/gOonu+WSfYXweXF+ZLklDCFmCXqPxjEUMtINsDZyioalQEHPUV97nG4S8p32yXKfY6EtuZvzaTAgtWXFomULl9CQ5x6l4JFPWeVDFH63IC/Ex0BJZDWUxucBVpOpTPr9nBFf84m98+hnHgP+jhPdtTaErr+REaKdPukfr77sUFTsvw9EzvZAEvQwXlQYaX4G8HdMnmCKD40mjAw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255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(7416005)(376005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1RTikJBgPoxztzZRz5aDYhY/c6oz7j6avPuUVT1+h6E2xGkb9UsxPCJU3IvyaGOkZ98NBEPlkuTdsHVsq+1lfsLM0erZHNJQeq0mVuatGG8nCHRDFXpJ8WTBYGwAfJhvomXiaWetkvKwoMrDV5o6M2SLXPNPQ8GpSEoLw1agDTWZSZ/SVj3n5IY+x5GF6m8R3GEfuqIxU4DZhDM0bWwW6aP8wX3LZODBH57aUXydz3zOoJ2qos5OrL56MxPp7DJVOKlqAWyrvmTVhPALbY4viGgwes+a27qcG8wDYhdrKJjxOSOlxUmjvjuqEnbmq7iFgnydONnGhGA3Na0fnYChrHmncbOxtmuOktkUCebVfwwxUHunzL6g/El75rOWZWcoCE8HhIYVIdNzxfT0hS/JPWZN2vRtFyWrlJqbsf20DPPus4f6wssY1Wb1lYjkiHYg+g7ShROz8tnf28ctvNMIcgO7rIzC58/wlgPNm+L0/xKCS6l0dM2zI0q6GVfZrSpOvvT/ScvHViI3/bnt6zKjNJnmFfWh1OpHsl6CG1lW+PkzN8CkAnClEf3ELEALrZaDLTl3MKH+d4XgnJFEBcOOqF4YJa4rXeF4pCtfP4o02iESxXoGR00gcqoP+dB63gO3WYBMUqAZMXYDBhCap4Y0kQsMuk1anw5qTXFIuZ6cuWdUenQjGAsvqjzTij8+QZ9hJEKeE+uiX1hTBvf8sZfZY8gKWq8hueaXNmtgq54n02F9vZoHmVcu0FEmWvFfjnMBOcCxpL/Uj1vwRMzUEWdUGuY1dTLaVEin8v8Cgvf4Irh7n/4P3LDfzwIIgwQlpR954AG3j56hEFRYeXjfPnedvME9hYxTW493VPmNQxOmUJb/VSvk/8nfEOzj/r4haMQXjbT2e9e4xDH5ZOaN1C+RJLAMQ38QkEZp8Exf1yFbfZUpYgdVelwDuNrT+lHTiwQvMMEvYpt88IGL6M3Bqgh7wIDWXs0O5qHTexNG9+3tRNAeOOzFneYxBUynj3Slxrrblca11IIkP2WvYtXiq4bpUm6uwbYnZ2l9OgNrRlf3X4Br5hjnibHSpQhYvepmYlySZFfWryH8zzeGFu8YqcqvqIJJHNYE+MyMq2XZKPTIvxOebVSjGcidqr3jjv7wcI21uD7/FhgGIAkWKU6f4IUGAjK/9pur3Nnp+CNbDz9D97m5kVVXprb6wj3fByD9qQd4KJ6eq4gcf4Ug7lMszKaKFw02tZWm3cGuQbzoI7a6yDtZse3krEim6HGJujWlokxZoR+0E5xoOc4Zcz6xyIwYrZ1AZQOek9MM9llsNgG8haDsDjmkSKPqKR7QA7IAhmvO2FFO0Q6Vr/VV5FSgBQorjd9uayH1PY+7wCO471CjpsAzRKg3EJXyL49AaTqExDmErvLUdHQK3xqIcpFMXcYGQMGOGjXQyqlt9Cw6rZECUA7QwYt7v1c5C0+TEcO81Oqk+y4eCOQ31p2nbh/6m38PvJRA+i71VRGSw1uHzycJMovLmuhU/oabLy5bRfvgxqwlGoj4KkfaD7g1Ww8qyang5KJMGtTPDct+95gCI33Y9gN1sW7aYCQhImF3AErYZbSUiXXzL7Fz0sjMWe8jAsOy20AA3b3ZUjqhrvedeXnCLX0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06bb3969-0cab-4bca-fd82-08dc7f71ac1a X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 23:55:37.6473 (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: K3YK9mkXRyQPL2kurtKM5nVINNo9CEvzCMJ8x1Bk/0vgtqWEXtdlHTfkejw8+G1b8t/JtfaysUpV5y6fsgDzZwc38ammYtTrzrTCEEmSk+mrI7+Rkcnq8EvFY1Pv1qIZ X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB11224 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 5ac149cf3647f..d9298771f5097 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 73445f33d26ba..36204fee10aa2 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)