From patchwork Mon Mar 25 03:05:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13601115 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 30A96C47DD9 for ; Mon, 25 Mar 2024 03:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Subject:From: References:In-Reply-To:To:Message-ID:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2fQejRBDlktWro/4/mxNQbsLe4kF0bieOl2JjNI+UFs=; b=LsI07ewGwk0cC6GEUgJMJW/Jvn KULh/Bxrf9dSAcSijxVhsjuMlliD/bdrP9g/y/3XJTdx899+xeCxNAuZqtsOsiJk0OmF2wc9kAngP ePrET+0cdlwnrnOCqpgAYQyt7VxGJl8xC5altvLdvvMfj1KddGPM+yBRF9wrJm+8ovhFe6bYei0Ki Mh7bYIp/6o71wcjkldCH0AXh7CklGtSCQ6nHIqy1jQF84aK/ubT71ueSZJk895vPR4IjQ62hah1UO ppnhxLM0rqVz+lCsf0NeJ2qS2un/oqwYdYqp52rIt2jjwYiykSpBk8Kh97TWzExDz/YMeMLqVesze +iOKEXYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1roafl-0000000Ep86-4AJJ; Mon, 25 Mar 2024 03:06:55 +0000 Received: from mail-os0jpn01on2052.outbound.protection.outlook.com ([40.107.113.52] helo=JPN01-OS0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1roaeY-0000000EodZ-1U1m for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2024 03:05:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kWIrXNmb+I5Fpm/POezXzKVhnDYJZ5RBP7RGjorav7wCHg5iJs7aSWzgkjyVuISbuNzAUY2VH8bQfa5V6BbFSbbu2tdlYWr1+ySVw1AGrafK4/V6QmQwTI6hoXlj3hS08Ghnhp4r3K7N3Y4TgI/sAuSQqmuOFbYmgE4snB4AbNMAJRzx3ak4I2BPrEHd62etPoNjFgsDdJGeSGev578KHnHxDqZ8ZHqaW06PvWPzyLjsKyBmuuEYRdEGcTM9BCohEkzaRaVVbRQuZyITQ1UTAcfu3CZEDsuRllVNi/QBH84a7Ht2P16wsYHEThMYcGpADk9KoNs9zB1ImqxqPiUwVg== 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=dyRXIBsVOEuvEsI+HIz1KBO2P7gmWNbvh+DmO4P6oN0=; b=lZKuC0IdYkXFHZvLBftIzfkAjkfFxBqoZLEK12OnREixOijO4kVQMKPQxZhgf9JLrpkthlqvaTctGiTIRs69g+5FmoxRqLFCMzBXULH8vHylxRuofkT1h/20JFYRtyUfpGq4srcjE2vFKFsAOHwiYom5VgloOzg3YM+z4Bd+/IPjn7maJmpazB6SbRFcW1vDXgkesEQq+6gsP8cYALFZRGCCYs+yG4Lx48n+iLdyHPzT+7kK6EMSWE5Z8hu3uv1hYU1gbp44bVOKpHseL8LJqX22XO11t0XS7zdfwAcWIsQVnE1da7vDAPvUPFFh4JtS/xz40F1l325ndUDNzeuNFw== 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=dyRXIBsVOEuvEsI+HIz1KBO2P7gmWNbvh+DmO4P6oN0=; b=mcaSDjWH3R4LWvfxMhrNtzFrLkw1ZcKVBaKOMnuf4ITuqGdUjYiWc9j0zl65FPd5Wx3lU5kRcFrKzFpdK7PHN2a5xUS7fCmepKb8ODWHvOsfAzN0PsnZ40b2hTLRcjl+Og2SQlzXTQ2T3pU6UsfRmLXfQBfr8JUd1FQIAkmwTnc= 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 OS3PR01MB6966.jpnprd01.prod.outlook.com (2603:1096:604:12d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 03:05:21 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b%7]) with mapi id 15.20.7386.025; Mon, 25 Mar 2024 03:05:21 +0000 Message-ID: <87y1a757v2.wl-kuninori.morimoto.gx@renesas.com> 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: <8734sf6mgn.wl-kuninori.morimoto.gx@renesas.com> References: <8734sf6mgn.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/8] media: platform: microchip: use for_each_endpoint_of_node() Date: Mon, 25 Mar 2024 03:05:21 +0000 X-ClientProxiedBy: TYCPR01CA0016.jpnprd01.prod.outlook.com (2603:1096:405::28) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OS3PR01MB6966:EE_ X-MS-Office365-Filtering-Correlation-Id: 04b73231-50a1-4345-6412-08dc4c7868ce 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; X-Microsoft-Antispam-Message-Info: cc7NZGTUx3A7kgsb8D27sL9mYjy/PZt+/+P79h1lDmap9tZof4EsKbtay6cN5Ra+XQVgcu17JG5RsZiPwIIdxyY3pD329DHGTh3mxFTSpMk7PQhhTFWxmSKomG80AEtgiZQqx1j/+rArU0bt+HyOO8kZ+1e9q68wfseGgQ0LQo1Z8c4PyPQ8OgGlBZCEBG2oJtyU74VDlKtz33dAacjcGCFHMgKDUlRBu5V1WmfYceDZN2YSc36q+y3U22T68+iB1JnTCnAHNF5LLo7mL3Pq5/w95XpkMzOyeZ7Wu+PNHoqn6q/ImUlbNwqRzb2TqWvBkc5exVyJFCA/t81UBcJyfIvxnbOddOMn6IQ9o2LuGQDJCD8feA2pYt0OM1KN+Du2ORHTeTFtDeOhOIRncTYhQGTfvrSypWaRH0Y0BpCE1DZpg/K6Iflo2U34O+khcQZ1T2fIiXqQJ90VLdIC8EHvff5nEhq0kqxljIW/AjZ9YMKlbIlusZmjE+an+yy1/Go/0QCZQo/dQjeFAXn8MDUVvFM0Pt/5Cnalqn8oTyS2EAmoaOBVi1lSE/SZGcP5eeHbMXZMEdHvFGWvrsqEnOddyniRyXj/eiX6d/hZhEFEUXaGEVtV1/hPn7TwZb5NFwYOeGOlmFMSdxi+onu0gx9Wt0nVyUnZQ/Q9yCNRqp6p+BFwyAZD+APoiQXuzBwcSsvBmoPNIB/Jlj48dHzhEl+Djhc6kjyODTsxtiuqFSLnTXk= 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:(13230031)(1800799015)(52116005)(7416005)(366007)(376005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SpI0iEn8LD8frFuyNLj6hrmNMrup4VEfeM2feKQYi0tT2XGSaF3sNduhQzWR0m8owvr1c6Dvsx2T6sdtnK9IgEi3YzsLlnHFfjSjgMyUcNC5PUdMg8x32QrRDnRJ1YpMx3tfQ24GEYnpeDMEc0xxHq+0hj8ImBFL2HB+vTp83sSgDntTMg0MaUDdKnckGiIt9Y9sdAVtxwNI5HPCdGNfD2y+9B8mov7rF469wz1jRJjYqmWO8tdCsdwAG6PGvM0G55M8unk3IYNV7E9AfW836CRedyU8l/rEtIX/klamX2+AcwBUcr72iQidZUlCRoO9CuC1BgQIRWy/c8oUz850IOLkHorhziuApCq0J8cSiRf4E07xNXKtJ1lRxetiO3i7x3x1nWAZ0Z70zJw62W5aLQuxZI2Ocb+3kK6G1hcUCvLXduYAsOEMQStl+S2h7KDWeLtyioxMP5rcKX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lK+dQEfA6Qkgf/GlCsJHwbbQane8UDxusCQy//DGKy64fKvwzNoZsyrvtdytn0+oAy+U8Sri52HNmyWpfhr+EG2NztaZRgp5XM02Bgf0RUpWue+hiZ67deGGqxhYI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04b73231-50a1-4345-6412-08dc4c7868ce X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 03:05:21.8807 (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: CDdqig2Tt7xGNYS/HtgLrjCj9jOJ2qQVrfCnawnU9T8wPBoqxPaIAfNzwKSeO6hZuQUhK9IXPomkf2FmeD4Oo/3k8xIdGTsKSBvVsC0Sl5pn5GZpOkJou8BqUbxa8O3Y X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB6966 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240324_200538_864252_2113CEEA X-CRM114-Status: GOOD ( 11.85 ) 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 --- .../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 5ac149cf3647..d9298771f509 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 73445f33d26b..36204fee10aa 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)