From nobody Wed Sep 10 11:03:51 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C081C77B78 for ; Tue, 25 Apr 2023 14:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234280AbjDYOgt (ORCPT ); Tue, 25 Apr 2023 10:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234304AbjDYOgi (ORCPT ); Tue, 25 Apr 2023 10:36:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE3FA13F8B for ; Tue, 25 Apr 2023 07:36:30 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9DA89D75; Tue, 25 Apr 2023 07:37:14 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 176103F587; Tue, 25 Apr 2023 07:36:28 -0700 (PDT) From: James Clark To: coresight@lists.linaro.org, quic_jinlmao@quicinc.com, mike.leach@linaro.org, suzuki.poulose@arm.com Cc: James Clark , Leo Yan , Alexander Shishkin , Greg Kroah-Hartman , Mathieu Poirier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 04/13] coresight: Rename nr_outports to nr_outconns Date: Tue, 25 Apr 2023 15:35:31 +0100 Message-Id: <20230425143542.2305069-5-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230425143542.2305069-1-james.clark@arm.com> References: <20230425143542.2305069-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Rename to avoid confusion between port number and the index in the connection array. The port number is already stored in the connection, and in a later commit the connection array will be appended to, so the length of it will no longer reflect the number of ports. No functional changes. Reviewed-by: Mike Leach Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-core.c | 32 ++++++++--------- .../hwtracing/coresight/coresight-platform.c | 34 +++++++++---------- .../hwtracing/coresight/coresight-tmc-etr.c | 2 +- include/linux/coresight.h | 10 +++--- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index 04c9d52f8f4f..0f6712a6fba3 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -118,7 +118,7 @@ static int coresight_find_link_inport(struct coresight_= device *csdev, int i; struct coresight_connection *conn; =20 - for (i =3D 0; i < parent->pdata->nr_outport; i++) { + for (i =3D 0; i < parent->pdata->nr_outconns; i++) { conn =3D &parent->pdata->out_conns[i]; if (conn->child_dev =3D=3D csdev) return conn->child_port; @@ -136,7 +136,7 @@ static int coresight_find_link_outport(struct coresight= _device *csdev, int i; struct coresight_connection *conn; =20 - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { conn =3D &csdev->pdata->out_conns[i]; if (conn->child_dev =3D=3D child) return conn->outport; @@ -397,9 +397,9 @@ static void coresight_disable_link(struct coresight_dev= ice *csdev, link_subtype =3D csdev->subtype.link_subtype; =20 if (link_subtype =3D=3D CORESIGHT_DEV_SUBTYPE_LINK_MERG) { - nr_conns =3D csdev->pdata->nr_inport; + nr_conns =3D csdev->pdata->nr_inconns; } else if (link_subtype =3D=3D CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) { - nr_conns =3D csdev->pdata->nr_outport; + nr_conns =3D csdev->pdata->nr_outconns; } else { nr_conns =3D 1; } @@ -603,7 +603,7 @@ coresight_find_enabled_sink(struct coresight_device *cs= dev) /* * Recursively explore each port found on this element. */ - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child_dev; =20 child_dev =3D csdev->pdata->out_conns[i].child_dev; @@ -719,7 +719,7 @@ static int coresight_grab_device(struct coresight_devic= e *csdev) { int i; =20 - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child; =20 child =3D csdev->pdata->out_conns[i].child_dev; @@ -749,7 +749,7 @@ static void coresight_drop_device(struct coresight_devi= ce *csdev) int i; =20 coresight_put_ref(csdev); - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child; =20 child =3D csdev->pdata->out_conns[i].child_dev; @@ -791,7 +791,7 @@ static int _coresight_build_path(struct coresight_devic= e *csdev, } =20 /* Not a sink - recursively explore each port found on this element */ - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child_dev; =20 child_dev =3D csdev->pdata->out_conns[i].child_dev; @@ -960,7 +960,7 @@ coresight_find_sink(struct coresight_device *csdev, int= *depth) * Not a sink we want - or possible child sink may be better. * recursively explore each port found on this element. */ - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_device *child_dev, *sink =3D NULL; int child_depth =3D curr_depth; =20 @@ -1333,7 +1333,7 @@ static int coresight_orphan_match(struct device *dev,= void *data) * Circle throuch all the connection of that component. If we find * an orphan connection whose name matches @csdev, link it. */ - for (i =3D 0; i < i_csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < i_csdev->pdata->nr_outconns; i++) { conn =3D &i_csdev->pdata->out_conns[i]; =20 /* Skip the port if FW doesn't describe it */ @@ -1374,7 +1374,7 @@ static int coresight_fixup_device_conns(struct coresi= ght_device *csdev) { int i, ret =3D 0; =20 - for (i =3D 0; i < csdev->pdata->nr_outport; i++) { + for (i =3D 0; i < csdev->pdata->nr_outconns; i++) { struct coresight_connection *conn =3D &csdev->pdata->out_conns[i]; =20 if (!conn->child_fwnode) @@ -1411,7 +1411,7 @@ static int coresight_remove_match(struct device *dev,= void *data) * Circle throuch all the connection of that component. If we find * a connection whose name matches @csdev, remove it. */ - for (i =3D 0; i < iterator->pdata->nr_outport; i++) { + for (i =3D 0; i < iterator->pdata->nr_outconns; i++) { conn =3D &iterator->pdata->out_conns[i]; =20 if (conn->child_dev =3D=3D NULL || conn->child_fwnode =3D=3D NULL) @@ -1446,7 +1446,7 @@ static void coresight_remove_conns(struct coresight_d= evice *csdev) * doesn't have at least one input port, there is no point * in searching all the devices. */ - if (csdev->pdata->nr_inport) + if (csdev->pdata->nr_inconns) bus_for_each_dev(&coresight_bustype, NULL, csdev, coresight_remove_match); } @@ -1545,7 +1545,7 @@ void coresight_release_platform_data(struct coresight= _device *csdev, int i; struct coresight_connection *conns =3D pdata->out_conns; =20 - for (i =3D 0; i < pdata->nr_outport; i++) { + for (i =3D 0; i < pdata->nr_outconns; i++) { /* If we have made the links, remove them now */ if (csdev && conns[i].child_dev) coresight_remove_links(csdev, &conns[i]); @@ -1582,9 +1582,9 @@ struct coresight_device *coresight_register(struct co= resight_desc *desc) link_subtype =3D desc->subtype.link_subtype; =20 if (link_subtype =3D=3D CORESIGHT_DEV_SUBTYPE_LINK_MERG) - nr_refcnts =3D desc->pdata->nr_inport; + nr_refcnts =3D desc->pdata->nr_inconns; else if (link_subtype =3D=3D CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) - nr_refcnts =3D desc->pdata->nr_outport; + nr_refcnts =3D desc->pdata->nr_outconns; } =20 refcnts =3D kcalloc(nr_refcnts, sizeof(*refcnts), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwt= racing/coresight/coresight-platform.c index 5085525a32bb..ed865e0621a9 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -26,8 +26,8 @@ static int coresight_alloc_conns(struct device *dev, struct coresight_platform_data *pdata) { - if (pdata->nr_outport) { - pdata->out_conns =3D devm_kcalloc(dev, pdata->nr_outport, + if (pdata->nr_outconns) { + pdata->out_conns =3D devm_kcalloc(dev, pdata->nr_outconns, sizeof(*pdata->out_conns), GFP_KERNEL); if (!pdata->out_conns) return -ENOMEM; @@ -84,7 +84,7 @@ static inline bool of_coresight_legacy_ep_is_input(struct= device_node *ep) } =20 static void of_coresight_get_ports_legacy(const struct device_node *node, - int *nr_inport, int *nr_outport) + int *nr_inconns, int *nr_outconns) { struct device_node *ep =3D NULL; struct of_endpoint endpoint; @@ -114,8 +114,8 @@ static void of_coresight_get_ports_legacy(const struct = device_node *node, =20 } while (ep); =20 - *nr_inport =3D in; - *nr_outport =3D out; + *nr_inconns =3D in; + *nr_outconns =3D out; } =20 static struct device_node *of_coresight_get_port_parent(struct device_node= *ep) @@ -164,7 +164,7 @@ of_coresight_count_ports(struct device_node *port_paren= t) } =20 static void of_coresight_get_ports(const struct device_node *node, - int *nr_inport, int *nr_outport) + int *nr_inconns, int *nr_outconns) { struct device_node *input_ports =3D NULL, *output_ports =3D NULL; =20 @@ -173,16 +173,16 @@ static void of_coresight_get_ports(const struct devic= e_node *node, =20 if (input_ports || output_ports) { if (input_ports) { - *nr_inport =3D of_coresight_count_ports(input_ports); + *nr_inconns =3D of_coresight_count_ports(input_ports); of_node_put(input_ports); } if (output_ports) { - *nr_outport =3D of_coresight_count_ports(output_ports); + *nr_outconns =3D of_coresight_count_ports(output_ports); of_node_put(output_ports); } } else { /* Fall back to legacy DT bindings parsing */ - of_coresight_get_ports_legacy(node, nr_inport, nr_outport); + of_coresight_get_ports_legacy(node, nr_inconns, nr_outconns); } } =20 @@ -289,10 +289,10 @@ static int of_get_coresight_platform_data(struct devi= ce *dev, struct device_node *node =3D dev->of_node; =20 /* Get the number of input and output port for this component */ - of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport); + of_coresight_get_ports(node, &pdata->nr_inconns, &pdata->nr_outconns); =20 /* If there are no output connections, we are done */ - if (!pdata->nr_outport) + if (!pdata->nr_outconns) return 0; =20 ret =3D coresight_alloc_conns(dev, pdata); @@ -690,7 +690,7 @@ static int acpi_coresight_parse_graph(struct acpi_devic= e *adev, const union acpi_object *graph; struct coresight_connection *conns, *ptr; =20 - pdata->nr_inport =3D pdata->nr_outport =3D 0; + pdata->nr_inconns =3D pdata->nr_outconns =3D 0; graph =3D acpi_get_coresight_graph(adev); if (!graph) return -ENOENT; @@ -718,11 +718,11 @@ static int acpi_coresight_parse_graph(struct acpi_dev= ice *adev, return dir; =20 if (dir =3D=3D ACPI_CORESIGHT_LINK_MASTER) { - if (ptr->outport >=3D pdata->nr_outport) - pdata->nr_outport =3D ptr->outport + 1; + if (ptr->outport >=3D pdata->nr_outconns) + pdata->nr_outconns =3D ptr->outport + 1; ptr++; } else { - WARN_ON(pdata->nr_inport =3D=3D ptr->child_port + 1); + WARN_ON(pdata->nr_inconns =3D=3D ptr->child_port + 1); /* * We do not track input port connections for a device. * However we need the highest port number described, @@ -730,8 +730,8 @@ static int acpi_coresight_parse_graph(struct acpi_devic= e *adev, * record for an output connection. Hence, do not move * the ptr for input connections */ - if (ptr->child_port >=3D pdata->nr_inport) - pdata->nr_inport =3D ptr->child_port + 1; + if (ptr->child_port >=3D pdata->nr_inconns) + pdata->nr_inconns =3D ptr->child_port + 1; } } =20 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtr= acing/coresight/coresight-tmc-etr.c index 86d4a08aa833..4711dfa7418c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -781,7 +781,7 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) return NULL; =20 - for (i =3D 0; i < etr->pdata->nr_outport; i++) { + for (i =3D 0; i < etr->pdata->nr_outconns; i++) { tmp =3D etr->pdata->out_conns[i].child_dev; if (tmp && coresight_is_catu_device(tmp)) return tmp; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index bf621d064ef8..daf392fcb67a 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -102,13 +102,13 @@ union coresight_dev_subtype { * struct coresight_platform_data - data harvested from the firmware * specification. * - * @nr_inport: Number of elements for the input connections. - * @nr_outport: Number of elements for the output connections. - * @out_conns: Sparse array of nr_outport connections from this component. + * @nr_inconns: Number of elements for the input connections. + * @nr_outconns: Number of elements for the output connections. + * @out_conns: Sparse array of nr_outconns connections from this component. */ struct coresight_platform_data { - int nr_inport; - int nr_outport; + int nr_inconns; + int nr_outconns; struct coresight_connection *out_conns; }; =20 --=20 2.34.1