linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/28] coresight: Reuse platform data structure for connection tracking
Date: Wed, 19 Jun 2019 13:52:59 -0600	[thread overview]
Message-ID: <20190619195318.19254-10-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org>

From: Suzuki K Poulose <suzuki.poulose@arm.com>

The platform specific information describes the connections and
the ports of a given coresigh device. This information is also
recorded in the coresight device as separate fields. Let us reuse
the original platform description to streamline the handling
of the data.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 .../hwtracing/coresight/coresight-tmc-etr.c   |  4 +-
 drivers/hwtracing/coresight/coresight.c       | 46 +++++++++----------
 include/linux/coresight.h                     |  8 +---
 3 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 709448cf2dff..ce0114a5435c 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -756,8 +756,8 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata)
 	if (!IS_ENABLED(CONFIG_CORESIGHT_CATU))
 		return NULL;
 
-	for (i = 0; i < etr->nr_outport; i++) {
-		tmp = etr->conns[i].child_dev;
+	for (i = 0; i < etr->pdata->nr_outport; i++) {
+		tmp = etr->pdata->conns[i].child_dev;
 		if (tmp && coresight_is_catu_device(tmp))
 			return tmp;
 	}
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 068bd2fc0985..96e15154a566 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -100,8 +100,8 @@ static int coresight_find_link_inport(struct coresight_device *csdev,
 	int i;
 	struct coresight_connection *conn;
 
-	for (i = 0; i < parent->nr_outport; i++) {
-		conn = &parent->conns[i];
+	for (i = 0; i < parent->pdata->nr_outport; i++) {
+		conn = &parent->pdata->conns[i];
 		if (conn->child_dev == csdev)
 			return conn->child_port;
 	}
@@ -118,8 +118,8 @@ static int coresight_find_link_outport(struct coresight_device *csdev,
 	int i;
 	struct coresight_connection *conn;
 
-	for (i = 0; i < csdev->nr_outport; i++) {
-		conn = &csdev->conns[i];
+	for (i = 0; i < csdev->pdata->nr_outport; i++) {
+		conn = &csdev->pdata->conns[i];
 		if (conn->child_dev == child)
 			return conn->outport;
 	}
@@ -306,10 +306,10 @@ static void coresight_disable_link(struct coresight_device *csdev,
 
 	if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) {
 		refport = inport;
-		nr_conns = csdev->nr_inport;
+		nr_conns = csdev->pdata->nr_inport;
 	} else if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) {
 		refport = outport;
-		nr_conns = csdev->nr_outport;
+		nr_conns = csdev->pdata->nr_outport;
 	} else {
 		refport = 0;
 		nr_conns = 1;
@@ -595,9 +595,10 @@ static void coresight_grab_device(struct coresight_device *csdev)
 {
 	int i;
 
-	for (i = 0; i < csdev->nr_outport; i++) {
-		struct coresight_device *child = csdev->conns[i].child_dev;
+	for (i = 0; i < csdev->pdata->nr_outport; i++) {
+		struct coresight_device *child;
 
+		child  = csdev->pdata->conns[i].child_dev;
 		if (child && child->type == CORESIGHT_DEV_TYPE_HELPER)
 			pm_runtime_get_sync(child->dev.parent);
 	}
@@ -613,9 +614,10 @@ static void coresight_drop_device(struct coresight_device *csdev)
 	int i;
 
 	pm_runtime_put(csdev->dev.parent);
-	for (i = 0; i < csdev->nr_outport; i++) {
-		struct coresight_device *child = csdev->conns[i].child_dev;
+	for (i = 0; i < csdev->pdata->nr_outport; i++) {
+		struct coresight_device *child;
 
+		child  = csdev->pdata->conns[i].child_dev;
 		if (child && child->type == CORESIGHT_DEV_TYPE_HELPER)
 			pm_runtime_put(child->dev.parent);
 	}
@@ -645,9 +647,10 @@ static int _coresight_build_path(struct coresight_device *csdev,
 		goto out;
 
 	/* Not a sink - recursively explore each port found on this element */
-	for (i = 0; i < csdev->nr_outport; i++) {
-		struct coresight_device *child_dev = csdev->conns[i].child_dev;
+	for (i = 0; i < csdev->pdata->nr_outport; i++) {
+		struct coresight_device *child_dev;
 
+		child_dev = csdev->pdata->conns[i].child_dev;
 		if (child_dev &&
 		    _coresight_build_path(child_dev, sink, path) == 0) {
 			found = true;
@@ -1000,8 +1003,8 @@ 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 = 0; i < i_csdev->nr_outport; i++) {
-		conn = &i_csdev->conns[i];
+	for (i = 0; i < i_csdev->pdata->nr_outport; i++) {
+		conn = &i_csdev->pdata->conns[i];
 
 		/* We have found at least one orphan connection */
 		if (conn->child_dev == NULL) {
@@ -1040,8 +1043,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev)
 {
 	int i;
 
-	for (i = 0; i < csdev->nr_outport; i++) {
-		struct coresight_connection *conn = &csdev->conns[i];
+	for (i = 0; i < csdev->pdata->nr_outport; i++) {
+		struct coresight_connection *conn = &csdev->pdata->conns[i];
 		struct device *dev = NULL;
 
 		if (conn->child_name)
@@ -1075,8 +1078,8 @@ 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 = 0; i < iterator->nr_outport; i++) {
-		conn = &iterator->conns[i];
+	for (i = 0; i < iterator->pdata->nr_outport; i++) {
+		conn = &iterator->pdata->conns[i];
 
 		if (conn->child_dev == NULL)
 			continue;
@@ -1108,7 +1111,7 @@ static void coresight_remove_conns(struct coresight_device *csdev)
 	 * doesn't have at least one input port, there is no point
 	 * in searching all the devices.
 	 */
-	if (csdev->nr_inport)
+	if (csdev->pdata->nr_inport)
 		bus_for_each_dev(&coresight_bustype, NULL,
 				 csdev, coresight_remove_match);
 }
@@ -1195,10 +1198,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 
 	csdev->refcnt = refcnts;
 
-	csdev->nr_inport = desc->pdata->nr_inport;
-	csdev->nr_outport = desc->pdata->nr_outport;
-
-	csdev->conns = desc->pdata->conns;
+	csdev->pdata = desc->pdata;
 
 	csdev->type = desc->type;
 	csdev->subtype = desc->subtype;
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index 298db20ba8ce..b67d5074ece0 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -140,9 +140,7 @@ struct coresight_connection {
 
 /**
  * struct coresight_device - representation of a device as used by the framework
- * @conns:	array of coresight_connections associated to this component.
- * @nr_inport:	number of input port associated to this component.
- * @nr_outport:	number of output port associated to this component.
+ * @pdata:	Platform data with device connections associated to this device.
  * @type:	as defined by @coresight_dev_type.
  * @subtype:	as defined by @coresight_dev_subtype.
  * @ops:	generic operations for this component, as defined
@@ -157,9 +155,7 @@ struct coresight_connection {
  * @ea:		Device attribute for sink representation under PMU directory.
  */
 struct coresight_device {
-	struct coresight_connection *conns;
-	int nr_inport;
-	int nr_outport;
+	struct coresight_platform_data *pdata;
 	enum coresight_dev_type type;
 	union coresight_dev_subtype subtype;
 	const struct coresight_ops *ops;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-06-19 19:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 19:52 [PATCH 00/28] coresight: next v5.2-rc5 (V2) Mathieu Poirier
2019-06-19 19:52 ` [PATCH 01/28] coresight: Rename of_coresight to coresight-platform Mathieu Poirier
2019-06-19 19:52 ` [PATCH 02/28] coresight: platform: Make memory allocation helper generic Mathieu Poirier
2019-06-19 19:52 ` [PATCH 03/28] coresight: Make sure device uses DT for obsolete compatible check Mathieu Poirier
2019-06-19 19:52 ` [PATCH 04/28] coresight: Introduce generic platform data helper Mathieu Poirier
2019-06-19 19:52 ` [PATCH 05/28] coresight: Make device to CPU mapping generic Mathieu Poirier
2019-06-19 19:52 ` [PATCH 06/28] coresight: Remove cpu field from platform data Mathieu Poirier
2019-06-19 19:52 ` [PATCH 07/28] coresight: Remove name from platform description Mathieu Poirier
2019-06-19 19:52 ` [PATCH 08/28] coresight: Cleanup coresight_remove_conns Mathieu Poirier
2019-06-19 19:52 ` Mathieu Poirier [this message]
2019-06-19 19:53 ` [PATCH 10/28] coresight: Rearrange platform data probing Mathieu Poirier
2019-06-19 19:53 ` [PATCH 11/28] coresight: Add support for releasing platform specific data Mathieu Poirier
2019-06-19 19:53 ` [PATCH 12/28] coresight: platform: Use fwnode handle for device search Mathieu Poirier
2019-06-19 19:53 ` [PATCH 13/28] coresight: Use fwnode handle instead of device names Mathieu Poirier
2019-06-19 19:53 ` [PATCH 14/28] coresight: Use platform agnostic names Mathieu Poirier
2019-06-19 19:53 ` [PATCH 15/28] coresight: stm: ACPI support for parsing stimulus base Mathieu Poirier
2019-06-19 19:53 ` [PATCH 16/28] coresight: Support for ACPI bindings Mathieu Poirier
2019-06-19 19:53 ` [PATCH 17/28] coresight: acpi: Support for AMBA components Mathieu Poirier
2019-06-19 19:53 ` [PATCH 18/28] coresight: acpi: Support for platform devices Mathieu Poirier
2019-06-19 19:53 ` [PATCH 19/28] coresight: Add dummy definition for of_coresight_get_cpu() Mathieu Poirier
2019-06-19 19:53 ` [PATCH 20/28] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Mathieu Poirier
2019-06-20  6:02   ` Greg KH
2019-06-19 19:53 ` [PATCH 21/28] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id " Mathieu Poirier
2019-06-20  6:03   ` Greg KH
2019-06-19 19:53 ` [PATCH 22/28] coresight: tmc-etf: " Mathieu Poirier
2019-06-20  6:03   ` Greg KH
2019-06-19 19:53 ` [PATCH 23/28] coresight: etb10: " Mathieu Poirier
2019-06-20  6:04   ` Greg KH
2019-06-19 19:53 ` [PATCH 24/28] coresight: Potential uninitialized variable in probe() Mathieu Poirier
2019-06-20  6:04   ` Greg KH
2019-06-19 19:53 ` [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Mathieu Poirier
2019-06-20  6:04   ` Greg KH
2019-06-20 21:38     ` Mathieu Poirier
2019-06-21  6:59       ` Greg KH
2019-06-19 19:53 ` [PATCH 26/28] coresight: tmc: " Mathieu Poirier
2019-06-20  6:05   ` Greg KH
2019-06-20 21:42     ` Mathieu Poirier
2019-06-21  6:59       ` Greg KH
2019-06-19 19:53 ` [PATCH 27/28] coresight: platform: add OF/APCI dependency Mathieu Poirier
2019-06-19 19:53 ` [PATCH 28/28] coresight: replicator: Add terminate entry for acpi_device_id tables Mathieu Poirier
2019-06-20  6:08 ` [PATCH 00/28] coresight: next v5.2-rc5 (V2) Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190619195318.19254-10-mathieu.poirier@linaro.org \
    --to=mathieu.poirier@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).