From patchwork Mon Jul 1 02:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13717499 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2044.outbound.protection.outlook.com [40.107.114.44]) (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 0A36CBA20 for ; Mon, 1 Jul 2024 02:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719801167; cv=fail; b=LvgkQr0e7B/GBGs5m8PIpoPy18AuBEXYVuSr7DrwDRZLusxz0i/PVfdOLmbI1JelgUSbNuSX3MMTMDeMulTwmEDhDRTlGHh0PuBec5kP1FmlVZw/eGAkKwrdZk5zPtyazVR2Q/OPJLhHQ09EB/d7D/g80cYUyHwrNoEAhsse+qU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719801167; c=relaxed/simple; bh=MruyyDoRCpS+H2JRsPOF74YJQ2xsUw6IOl/rBHpAACU=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=q/wM3bM8KcHJfY1cE7g+V1KSHuDb16H5p+C7bPMrtq9P0HPmEDL6SKK+OGRzHvaIVSWZr9AWM6c7HzJW2R3TW4ZxyFH80F5aRHvmMZgHkYZx6FmZtSHfqcdRcdophWrr6sqJ/pNIruJoI4dDDUtG3i3VQYUjarhqYqKxMhTyuhE= 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=CVFkWOKU; arc=fail smtp.client-ip=40.107.114.44 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="CVFkWOKU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XP7jzcrF0y+YWFt2PkxriwlVrkfDUfTRIn7tUO3KsgXt0GJRLTjRK5Xz1LttHu/uJcKRj+vAPCN5mZK9qFR2vNhBu2eBKRiasUYVlb0rcL96U3MMj+fFLenwe+INgHXijtBWtzAtMqMW+Jl7X9dRV7O5+SwoQeOcUn+9Z47fuxil6sckv8mJL39RAPTF2RdEGT1xzGJn8VR5ISvZ7WXRWuuUkeXWoH5lwW1ZkKngy8S/fYpyFonczXNtnxOK7LXcmjcUChO7h2WzfxGTEM5dPemMUhZJL+E0pzKGwQvTg9dLH9FkwhtIYYMePyloXHj8pygCOsEQvVlm0afUTbiQ5g== 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=TDYtQKJOJc+EDlCZzEvwK/6q2HUOMib2w9uKHniF1j8=; b=DAlw3Wm4k71aewkxueIR15IVkqS/jrVBJgk6SrZ7G1wMHIPVxzNBbeyHq7TG4GebUapP38UYomyDIqt+sUn8CPttz0EN2JQj4iW5Jg5nqtTQGelFlPN13eZRxnRAD1XTMNJ6dhECcrAhZVr+XmRLTJ5xB8i2DHTqA7ckc6tEyWku8MvkeB9pJuBhwcq1JLmEIHdb9l6RJN/fso/DPL7YfgQcXCfhNC3gR/ZaLN/ZUe8nVdugNOSEfjeWw1dbZFfGet4xp4/78e5zBJk+CjM8fu25p9TKUauzdxJU2I/hxpsf0M1VSNXoQ/WAUSbMgh424WQc3YdkClWx1JdLl6Vg+A== 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=TDYtQKJOJc+EDlCZzEvwK/6q2HUOMib2w9uKHniF1j8=; b=CVFkWOKU3N/IxUFqLRsJ4vLmKhejlJxhgarQJoeXqXSVzQyktRfZfF0+Y3f298STIrnR1mOUZ4oF+n3lARKc7ctK17ut4+7gA1b9CAWnyRltYHuFtZ5OqMOZhGDdRs4yPU5iG9jFSIPtzgBs8g0vEdlnaPvUo4Y1pwnLZWBW7GM= 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 TY3PR01MB9730.jpnprd01.prod.outlook.com (2603:1096:400:22e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Mon, 1 Jul 2024 02:32:42 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7719.029; Mon, 1 Jul 2024 02:32:42 +0000 Message-ID: <877ce59705.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 4/7] media: platform: microchip: use for_each_endpoint_of_node() To: "Lad, Prabhakar" , Alexander Shishkin , Alexandre Belloni , Alexey Brodkin , Claudiu Beznea , Daniel Vetter , David Airlie , Dmitry Baryshkov , Eugen Hristev , Florian Fainelli , Greg Kroah-Hartman , Laurent Pinchart , Maarten Lankhorst , Mauro Carvalho Chehab , Maxime Ripard , Michal Simek , Neil Armstrong , Nicolas Ferre , Suzuki K Poulose , Thomas Zimmermann , Tomi Valkeinen , coresight@lists.linaro.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-staging@lists.linux.dev In-Reply-To: <87cynx971l.wl-kuninori.morimoto.gx@renesas.com> References: <87cynx971l.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 1 Jul 2024 02:32:42 +0000 X-ClientProxiedBy: TYAPR01CA0021.jpnprd01.prod.outlook.com (2603:1096:404::33) 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_|TY3PR01MB9730:EE_ X-MS-Office365-Filtering-Correlation-Id: b4b5d8b3-f0a2-454f-120d-08dc99761599 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:13230040|376014|52116014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: +smDaZwwrq/3sKCp+/M+nu1y+Ts/R/mHI9b1mxU/T3v2tDgXTwHpuEkBpasTM2g87bk5AM6pPmO6J2c4nrv4xJGCP/MkCMmFoNdGpyG2/hPEfz3V4Fx/vHLaNJFoMIwFEOXBA4ppROcOr06+d2A6mBr/AxQPfaRHThgQHRJmsnESrgTVvoTBOQFDpbJZpTbCg6uckDuK86TO3t9yEX/+DgGMrCIoO3ZPJWfhfx013ag88r0VQ5v985dB3A+z9fRcMqzF5+SWj6F42vCml5E/msIasdub3SV5l9R5uGO4v+TeQRyEg7Ne+Q6i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U48cozC0gwvANg5GOes7hgwrkB6LrIZsR/jwRoNi5n/K4DAgvf4+PiFU2LSpCsU= 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:(13230040)(376014)(52116014)(7416014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RoiObshygGhjiKFYlrtFaVmXNsC9mSMWtCYccZgLkhriHk9PI2YeuO5RzryBeBFSbeTOwjotFmXY3eiqYEcNa9YUqZyS6vD0nk6+g3Joeu/8bd9Ai8ie2iv+KqXtZu6FJ9OASuri3VOgPZc6qpgFmJ54bOU78Whz2CfyGzkQSkiOHgRGxNSCMHCspkr0t71jrvwmX20GO5Q80PVWiGPUilwF2DWw2W3skryKRUzXIXRrmYUvxHWUciX7k8dAG5h/eLrDsWQemK7zjuM/sjRTAHzrk3YwqX66E9Jv2iH6a7YwN5LtNEX7w+0FZhkwJJTUc/9G+XJggOMkn0aPBIKK1c2VcozsOUcqc09prdIZjT6tMvt0ACyvtKxczuGyLYnHmeVPVV/85eDM552jU2K7uXqXYanZocjPSgUxj9BHt2ihonIEHCB9Y/w4z5rTkycYcd6FRy54XHEDc0vpQ9FmSJ6bHMSez6AMp47soWPvYb4RMBkBPPv7j6c2E2RBreVnKtW54EWmpx1t7DkSrAZessruoUjJhjzHNXec85LqQJoRuNNptp/oTABW+J5dxqtUiiCFByNxm+3eB375xY1VX9qHUDWl5GxsvBZThEiJAPueux4MwdTTjZKQT3wepXihLTF6arHUovBCxGcqXykbUQPqepCCDxTJvzd21xKuCaeJAuHir/TerrKj0KpFw/xT2CagIUL0bdx8tdfaGJZ0RV1PmgJLZKPbaDun2FVVwRSmgYQvPf+3saMfVug8D2Ki3XuExRfhpulCxRx1VqJT96GyoqiJlSiJwpwvG/8vMH5COuasp2qCjXdspXH2l7BtsBV1Gw+1h/WdxWCPhMTy8Osa4xkBvq1CgdqFN0gLARoVeMcakR6AQ6F26I0+gZfYTH2OnIH71R0kzOZkyz/GT4Suou03/PK7e5kDFidkxCMNMO35tv82/u8henlwQwhANikuXgCWcdo91vMqpUtCx8+ATTXHcEqY0OkAJNbU2z+SKdQ/vEnPm07hivL8v+GzBn2Yh2gQ7UQCk6Ms1wv0V0twIIj8MWaIwWXivnt8Ge9E3LnirwA1VbDrlo8R62pWwVZS2d6HLeD62aNnng2NYSADo0wfaV2KDoxUtoFfjmgv6Tv3+2J4cMaBOeI1uE7TSo7RYyLuqwb98GIhXw38mG7iuR77jP2t5CQCeA/Btn1MK7O1n1rS9Ia1pBnVhD+QkJRmvvlVudrF6nAJPlqPGTZRrsK9F1uawtn+Dd8falPxReBOyVTx7vLStMr6HPBZagS0u9E6tEzPfjdUUxe2oMI1FaPEBTa4rTc5e6DsTBql8PtWLdw+pdiqSZA3GJ+1UsoBjOSF89C1ng9khNMM1eQVNEw99Z8gbxn2Rq5rVPKFXeHBH5VnD52CQfK4zfboDsDZg9jCTsSATp9XfGne87e1s/skYFlN0w9qDsWLtvs6J9gkHO09mn5+hj5JDWC9Dw+8eRkbogJIGjlTC9RURIt8qIncOFpiZmgyosXWcKW+2u2GD4ADvq6wzdWN22lfTt05h+D61Iw3Jgpv+/g4AByI53rVDaY8Z6WP3ZIgejprd/S1Nq49GnYemC5OTfZn+/h+N35P6MsONWhCE6tN7Q1LKnAhI5r2F3v+PX0V6n4= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4b5d8b3-f0a2-454f-120d-08dc99761599 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2024 02:32:42.8261 (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: 3ZIaKOSk9LS822DFhTXzvCh/VgYOTSlpu89amdIMvlflFDla7VIjmOyEpgUQ3l+Tfd4vNJBkfMT8k7qNytLYIuz3kbBaER2XxlE4uPd3OL2hvfYFmo/8yU+/XYZdd8q2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3PR01MB9730 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 --- .../microchip/microchip-sama5d2-isc.c | 21 +++++++------------ .../microchip/microchip-sama7g5-isc.c | 21 +++++++------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c index 5ac149cf3647..60b6d922d764 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -353,33 +353,29 @@ static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = { static int isc_parse_dt(struct device *dev, struct isc_device *isc) { struct device_node *np = dev->of_node; - struct device_node *epn = NULL; + struct device_node *epn; 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..e97abe3e35af 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -336,36 +336,32 @@ static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = { static int xisc_parse_dt(struct device *dev, struct isc_device *isc) { struct device_node *np = dev->of_node; - struct device_node *epn = NULL; + struct device_node *epn; 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)