From patchwork Thu May 30 02:06:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13679640 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2076.outbound.protection.outlook.com [40.107.114.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 C0290208AD; Thu, 30 May 2024 02:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034771; cv=fail; b=KQ7mk8VXVoAxtk1ZwpT9BTNAZrPMNNwc8tlObh0bHs2nLvCgw/Tu+tPFgjLAoEGOPVqvgYmejQyBBYHV7bjQLbfnnihntMPi4E6DuyR+GYAv3f+9NmMF0M6O8sUXR6GBDf4WI21/+4+GGbwHC3+zjRySMvRIgZV3g/r2zfoa9iw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717034771; c=relaxed/simple; bh=wKjEPyL1kLmEa1RWUv0Xk7JzIG9DlELiQlr9OfVxw3c=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=P6Yj+Fi2WNUxX1N1ngrBloVXjDjE/wJj1wx9IoQP+Y5+34EdZU4IuF4vgkqcI19YI5nei2q1nHxkdHCXlGVqJL0YOqZv1kO55WCLnwAo3m8W/uhAUJ2JTzrbUIIL8jgWNu5eDSgLw2f/s2YokE5BBdOoa1Q9tIMyUBWleLJUNMI= 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=UityBz68; arc=fail smtp.client-ip=40.107.114.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="UityBz68" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AWKE6+6uSKg+IqhIpn3Lkd41gMOLARfrruM0uM73Zs0XQad7eb1v3g3PZXQa5EnGZkDLmCQ5dK+nJxlcX1LGJjm1+ajnJ8bWC75WuifxVPI7ayKQY7Wg7yZC9DJSH+DvfnCrSBQ6qUHrbqP9sit+CuB+ibno4ZjZ6ofaTS+KaP6KhnEk2arCdlw251EiI6ba9jI5BeMwMWA/Nds69HHIniHOgXc+yX+kAJVloPsow1GlKWcoYrqup7GUjnZdoJhhG3npu5f9M6lEoRHd3/X7uw547J5aTixZyHEroJLYAaCdAvKWzj6q5XEaduQjf1N3+HxEY3Fk3DRLRIjsQLc2qw== 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=UoNh+nRfGNRs9xN1167FKeh0h0ctgA5zRE537ocfiVUx9tcyquvgUMT7t/QDTs2AVWVsTxJ4VtrxD2Auw8p6/NcLMLtXnHZv5vjrf5FSVCKuDWavP9zFkMkq95FT8cpZP77fBbReVNl+w8Vaih0wTJpocrHVnx0pmEl8ZhF8nbU+XwuKRAwcOeZRl7xCl30Tc54e1XWDjhgUdphVrmqXfpXs7A61imjH9lNcOJhMQ/J50ueMHB+PQiX1objVxSRBU2AD19uAmVzIfZiSNLNvEphs2u5wi0bTV/FsttiWYOcck5iyCrjRqOHmGIkgBlIX96mpru4DcELXYEbnUfx/sA== 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=UityBz682bwzibkssJZ62HkBA1+i/6ZcIZenD5i3ASGhedQ46ZKIjhMLydgO17k190WvxUG0DWhrKcriLhKp1heB2+9DdgFrlY2WGIn255kCExcgF7u2EAgrin0TljLBmEaZdJvOyqSfGsP+v7/JrIjBdx2KBhxM/2LoSeCGJXk= 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 TYWPR01MB10240.jpnprd01.prod.outlook.com (2603:1096:400:1e5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Thu, 30 May 2024 02:06:05 +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.7633.018; Thu, 30 May 2024 02:06:05 +0000 Message-ID: <87fru0oxyq.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 4/9] media: platform: microchip: use for_each_endpoint_of_node() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 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 In-Reply-To: <87le3soy08.wl-kuninori.morimoto.gx@renesas.com> References: <87le3soy08.wl-kuninori.morimoto.gx@renesas.com> Date: Thu, 30 May 2024 02:06:05 +0000 X-ClientProxiedBy: TYCP286CA0118.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29c::11) 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_|TYWPR01MB10240:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f2e7dbf-b581-4eb6-36cf-08dc804d1074 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|376005|7416005|1800799015|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: jGrNdwinyNqNOKWmNq00Qbse5RNM64lzHgcAdmHAAD3b3zTRJlOkrHrWTF/qYl+qkgn4zctj9BA4rB2y5ZuQWGn9o49KIH3Q3eWdKSCGih4BWlY4fh23LxqfOUMqXW+6MVH+Dp40Glph4m7u86DKZgYKoiS3pa9F4v+/n/Dc99H3mf6NadabvhJS3DN8ZMzh0zolaeJ99Ij9lpLxmzyHPchXg/R5VTZnH+1uzbZgH6fcdKIFjrbx5GIQ9o78e93DPfOSTRhiu3ordnIlxzq6CTlgONpz9v56tp33nygCZ8MY5cIteJ1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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)(376005)(7416005)(1800799015)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: phayKQNkx/q9LdipMVJvK9FzTb1jrk44mkahXVIjOTaMqUMBHc/YgdPvAtFp7I7BdVBxZwXPACiVoS7bNfmpaF9mrs31j2WzbIQnknvkedEk7rqPhYPvvyeWLWYwM47O26oVrAqzkCRgbojwLa3beFvgf52BPSWV1ifrm0F+bisZu/cXPTMnmZkcquhdSczMaKkTWULPkuR0ZUOM0fbHf1eitoJCUy0Tf0uoX4ykwXRheu1lfgGZiy96qlDR9ySRRIhiwgEoLhqExnfDYVWgOwk+jRe7TXRu3oFVV6iEsZcChbIjp/zA55VmVETecQVz3/HWvWRXASO8xle4Fs//MVLfuiYsdK27XyVz3MXHgAUKMSciDd2yA4OXvMZFYSeQIo28WC/owQJKxafm97JmIbgHP7ebDrjbUw+PH2LTpHKu/7vUM3NML/t8Gv+ZwuoEOc/ZA0+n7eQU0OHxI1MjaEYoCcl4atgIp/seNHCstdTgoqJP8DqTyQaY4fq4C2bQqcj1l88pRdM6DDn2tZ2B36CbMoa0gUSNWmVBZ1cpU5NCIp3dCPmwIPmBNCyctiQwjtsgCwN5xExFDalurJRvPDRHtXOFwiVvDljL4aMhePpZY2SOBQdvyRaacj5QYzf/0u+4uhvS9GrRrWtHFWtD0Ivck2fc4xN8mOnhuA8xErvfLU3lweVOXRtoQaYweN2kUkeTqozi58KL+u1ePYavaPbz7AHrOHs9hnQCklunkRmUpvsUCFcEAl/KLyzznNoZR6co7688CsnjmYUZ5gWqeE3GsdLIP+b7e3acWTzfVo5WRNuhxATBMwTPrREx/0LJV95Hr51TkgeTgXfY2tozEncVu7GnL2c1+ctiIJCkMD0Rv8i9KinJF7DqLUZCxDt+nXs0yviH+kqtE4dhDHmSL11PQHIONtj3OR1OgVhVqLvTxvHqQp6zAKyHm00UOYARd7vpOL6sbC6S4AabWhnFopCS1bdNiAdDvBVju5zO0ZzSdLd7dHjHTP7LKM6slEZ7HcSyRe12kSeKuacyEFP5NciHkrQ1PquKNdd9EU1w7FWVOSAAHROqZwgdiLo3274HQVlJvenDaMK9Hyfhq+1xSe/HRrLX2doRUBqvn7MvWeKajEuUvbBYB/hREf1wGvWXYiglmuR2zXANZMp32WUzb2COGmQZVwh9cZKiWIQH7CUbrdNyQQmc9n3KteJN0L3joiEjUGyRaUQsIx7lA4E7PbT0YWZ4zkf3EFNc78sa7F7CWGdZ1LNx9tODkaQN/5VQV4rCqTRVhmXOUO0A+mV7lnjvtXKJvAXjl5qEfIk2P7TKyr1h3ipTSUlhYGHvO5KF49BNJvaWyOkLEt1q5HUW8UP9FQXDvCj3/JNG+kNB9VPEWHDHd8DJYfMSeIxLJ92EZiwdAjPbeKMgWOGYs9ioSZ8Te3C84W6ludG446o14OTHckj5E+BzYPfd4sIiOalpjKG8kr7Ny77IrvTAk+HdHEK/IZBoCTIQDsN46Bb3wTE295PU+RazyyrnZJEpaqZoi1I+M164Ct/NNVNkwNwX0rAwHnwWwMvyTTwQcI3wMl4M2dubMAIweYCbsocr8xOK8ETiwtiHhqdu+5287pPurPUvsjuwetq5n5uPq6pJqpM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f2e7dbf-b581-4eb6-36cf-08dc804d1074 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2024 02:06:05.7910 (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: oRSW/hGwduQHN+XcHcN6t56j71DwthOSL5sT1nUDA0FeOQRNiQvSGcoYrk/3bM+lNhSgegGW7mz/HAQHlDBI7fnaDh3y5yOGK+vL2ibEhn3bsv0JCCx05WV5w0UV2Fhb X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB10240 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)