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: 13717506 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 719C7C27C4F for ; Mon, 1 Jul 2024 02:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date: Content-Type:References:In-Reply-To:To:Subject:From:Message-ID:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TDYtQKJOJc+EDlCZzEvwK/6q2HUOMib2w9uKHniF1j8=; b=RYM6Sf5BE60sFGCtB30yzkszF1 bVIU2jxs1jr+fvmm5xbDJnIc8s4nZ8dqGjihBLfnLsr1y3X+uAK7FFe22szk5pcdWuN22BnnXVhR1 YVJ5ZwrZEICEBViZWnei43OE0dxLtkyUyjJdpdTpKwhLTMAlIf1Cy+a6+ux+HBb2wkUEQeyVlc5QX cbC02VB0QWDDTyqXE6JC0iXk/fX4wiPK3A1JowQO/qFi8S8la66nNTA4ti/VcW6/Zxk83NyitP9Un pKZMD9af7SREvsEDxJH/XcKtjLWSXBgQaEQuiIjkUr32bdhnRXrMPODtTAgmOOGqCzMHwG8wZk1Hl 2G3yZ6gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sO6rD-00000001Tzn-0gyO; Mon, 01 Jul 2024 02:33:31 +0000 Received: from mail-tycjpn01on20601.outbound.protection.outlook.com ([2a01:111:f403:2019::601] helo=JPN01-TYC-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sO6qa-00000001Tm5-2RnK; Mon, 01 Jul 2024 02:32:53 +0000 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) 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+Q6iLSHca4wYt7gyU/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Oes7hgwrkB6LrIZsR/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240630_193252_636197_1D3917BB X-CRM114-Status: GOOD ( 11.64 ) 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 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)