From patchwork Mon Jun 17 00:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 805116 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2076.outbound.protection.outlook.com [40.107.113.76]) (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 9230B4C6F; Mon, 17 Jun 2024 00:59:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718585953; cv=fail; b=UvZiApjd6IJ6ffookb++MCvD6EBnhB4c2EODWV0WtgdHgccrRD4jOPOtk3aBfCbzfMQs9KR9csoQMpeNCQjztpLRP6cm5i4do9L89Pfw16BOyLqoojXIBp5k6kF6UKjgHTdUaoIGa7EuSyjViISdcinBZYms1CApYK9ntZldYJM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718585953; c=relaxed/simple; bh=wKjEPyL1kLmEa1RWUv0Xk7JzIG9DlELiQlr9OfVxw3c=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=HCwgA+d6ujU+aUjOANRdYZQDMCSQFAsnwnpG1l8r+e8taK7wU1t/CgPfcZQkFSDI4lQJ5Fvj3m09XA1LOR56is/1pMyFBGMe2ihH08InIlC8uKCaTMrAIMr5j3M327LzdGkU8w6btyKQRHl+kORB5l86wcNZQEPbWox5pMnG+3g= 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=M7pH3Bk+; arc=fail smtp.client-ip=40.107.113.76 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="M7pH3Bk+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i99YgWDI7zf8jf+CcmEKLockPO/o9sMD2+eXddDNh0fWKVbStDvgNyC3GB+x9fr/1YcTjcuA0uABe9oAQdW5XhCI5iAo74lCtAS5Za1alkIywoVM1dhBlnI97mQ4BxC+lKGU0GmfAqZbTV8NSMLZsZNr6HXySXl6tMfqQgEPK76vuTReJoWej+QCrFG6zNv5w3E9xbXif//PftK3UYi9dim7FzUUGbPdTHGtQFeXZF0yd+G94aoN7l53TG0pwV+8ORJ/oJGm8i5VYkzNsVSwrHMuGHiQ5A0514fkWziIlMSaBZc2amjLkfiEt+3LtGoRVrLJj9kGpM/lBcQB+j8o3Q== 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=9rI+ZNkzrLrVhQsiJK5pQe/ZrYozduef8K4ZYQXjwTg=; b=S3Ce6HNfp9NFn8ghI5vAmg9M9XxZW/8ed87ijgB/0zUgPOAR/MNMipYkcwNCXUa7WhbhDNmiGcqZokEmJHNrFs8g8s2Jqyml90coBQS2mVrExdAwB9qL+ZHXM4E02rlEqJdhB02vZGpKWH0jeVxpl/v+YbWiPMSpS/T5cSwKWMy4ZBP9llHB6i0JEsa88iH+MJsJLyzQ6hQ3YBkSUTwADk2xFJjQD8QHMw3AyZmvSf8fqu8Jks4ljvVeZ+V3zaIWtyGF31n40drqAjG4kUU6yPRAKxWmKj7gSbkys9Z65zYbelytRZvMiV8cHwbXJDmu1lOptdw4/A/kYHxfia+LUA== 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=9rI+ZNkzrLrVhQsiJK5pQe/ZrYozduef8K4ZYQXjwTg=; b=M7pH3Bk+EaFhy5dpe74UF7zX3TrJ/5BBMtEyGzJyvaIokR/C8rosdyzcsrR0pyp4sFRlLHChzTWYbF1b2eiA2oLbHG6hTcgWGV/ZK8WETHmVR4lxNkVDHlLbNamKf7JHgiNayy8f7VpoK/zzbJCd8t+ShGkPQkCZfOZfEHe5Ryg= 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 TYWPR01MB8560.jpnprd01.prod.outlook.com (2603:1096:400:13f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 00:59:09 +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.7677.030; Mon, 17 Jun 2024 00:59:09 +0000 Message-ID: <87plsgs7tv.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v4 resend 4/9] media: platform: microchip: use for_each_endpoint_of_node() 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, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, Sakari Ailus , Hans Verkuil In-Reply-To: <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com> References: <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 17 Jun 2024 00:59:08 +0000 X-ClientProxiedBy: TYAPR01CA0123.jpnprd01.prod.outlook.com (2603:1096:404:2d::15) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYWPR01MB8560:EE_ X-MS-Office365-Filtering-Correlation-Id: bed60a14-dba4-424b-ccb0-08dc8e68b1a3 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:13230037|366013|52116011|7416011|376011|1800799021|38350700011|921017; X-Microsoft-Antispam-Message-Info: JIY/taBUNQe8u5+H6K0260v6FscnJ9Ysf13UjzN8yjwOr9ebacTkE1OLp4DeZ69EK7SOw4/931zjnn1cbBqcKycXFJl8fEELSaGa2V/9S8+4iJ+bdxWi7MXJPeizy2cCigBqsVhii3nPqtMDcBpr0+MXe86AtrMiM73gX0N3VYkvhRRqccEFe3IgS8za90rcdFJm+p2VO3qSbhqrg2cRa8GM8IYKfCP8CedIxxGBNNO8VmTl3SLsHWUQPgtNZBZEkbphiiSd6teXqYf9Q/oD8jmz/HQUfzfQy4jYlTEHaLgKvTeBiQDxzoEqTsRm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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:(13230037)(366013)(52116011)(7416011)(376011)(1800799021)(38350700011)(921017); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vjYk3bcPjoD+ILb17MYtaYSZgJAvb2r9K3f9Edn+8xgR9ilS+OrJQHev69ZP5Jl43w2gmjxQOlpCP0o4aesjrUsVhwCrEoTOUB/9VgL2fLhB5FBuccuED1BqgnXrV8y4Kpaqp2NMgJ28zPKBk7pEpJEBjRxyx1FbM1kQy6Ltj05z/1HQCIZT6VOdtTl5HgHdAy3jJDNi78PmjZyYmFKx+YhtUdimN4JYBt+Ekcuk5AIaP8Z8TD6vFY2BxVriTADQW/kccaJJrc93kZhbVFgqrm5E0UOFWO2Z/1AqubPlTXCjwpni7nKEARZ5c6n1jhXkU6KEuY7welCx2j1QvpCiqb3qFCq8Zf7oneZYbaN/g8fRsLSLsnUcw/TiBWZkwJvfj0ETzUXq02YGMx5377yj4D0i1xAZBa78M6ngQhxxMy2ET1Tlot2ZWYNN+AqPUlLoFyutUtEQiuTRecN9fD/EYVo1rucxJF791juZ997iJ2GptT7btyA5X9TNRAMkLoYh4E9B9cpLjFwgrYzJVXi25q3fk9XuPHZbmeyWo2I2VyRG3+cTe4V3OeVnNCIeRb2DYZxlZjjtT3T//yVKqiz5SrfHOnWi9eCeEeriNouZXyhmHPq0na5ywk99Xh1gAKqgH3/QSZ4H1mZv4qQynGoa81s54agJ6Iibp8d65r14rVitxkookq3I3+Il0+s/Ed7yPH/LftmLUpbk8lY31lv0rU6OuSgjBkr5p8GC0tDBqhdrtSowReWgDidawGFpqpUZ+VKBJTY7DPg9M9XCospw7iDk/bIB/arkYHocJ5LIcU392DivM5M9twtYNjWLq6xx3yObCJyuAup6RYZqxHiEowE4gVywzk+xLFDtp+YnY27e+J9YENjs+pnMcoslruEANyvfJqu/vsSYRhgebLkPCKRsZJagd+/dEKMsv530OEEXPKAgBzs1WT313+fgOjRJ7V0PCwS1dyqshDbyOUe6LaUK08NtpRuazHjRtWXhLarHVcSzoAwIlPVrd5kNsXVHCXIow1H5Aoqp9SiihdgAJRKQLHXSMi6p2XEYhloW1LKm6JOrDy0AH4CSjIei/uiKnqHoPQyRXOqQncxh4WFG9hgmZEIBWcsWRx7GFqsQ60xom4GVXmmGSwxqUJDJXIoBHn1NCDk3et5v6xx5q42dxkW7c8hBgJCHN/9aCyINkpt/bddqPrTprXVpFSZI3FR+C9IaRW2ODRXnzI/15IEli2mPSOYdx3urxvjwkrE/9srBWeK2daKfVDXFd+dr7i/oVHj6XtE0m6zsKRG8iCODaOGYXIur7GL89eO2fmNRNm238hmF+QoR7vTOeOheVdl0T5gA9ahUpjQT8hPOT4cxZS0hTKzF6TMQUYJ87pz4rGcjpoLoHDZ9zp9ATOXeufcLwyEEOvoFJal9UvV54nsIXiKnE6hyBT5FojPQEkbsJ2jYxNmLOMK6rx4QTWaF4AjjvehzNV7gJm3rWZ1rVCzbmaJ7lFirRpgGjxO2PVlNahn/iXYeSLNyCh9YuPh0kWdRI3Wak4jyo+9WQgth8g1jbjmw+cToyps6/6vX/xpkTrODYFAeWh7QYoZg0q04MDFdqwkTAf+G9hq+HWUC9MPCMngQxj9kR6fvy8u+10wsUgA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: bed60a14-dba4-424b-ccb0-08dc8e68b1a3 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 00:59:08.9196 (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: sNb52TTNl8HocuCe6IYBsZP2QUggM1m4K9c5a5k6Kc/nQEiexa8yG0qHvpmWUyL+MEZuKtq6/H9tQ+AIEUq4lO47X+xe/nTGAo6dxCZUH5X7pimszGlwccEeOppJONJ2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB8560 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 5ac149cf3647f..60b6d922d764e 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 73445f33d26ba..e97abe3e35af0 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)