Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: coresight@lists.linaro.org, linux-kernel@vger.kernel.org,
	mathieu.poirier@linaro.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: [PATCH v4 08/30] coresight: etb10: Clean up device specific data
Date: Wed, 22 May 2019 11:34:41 +0100
Message-ID: <1558521304-27469-9-git-send-email-suzuki.poulose@arm.com> (raw)
In-Reply-To: <1558521304-27469-1-git-send-email-suzuki.poulose@arm.com>

Track the coresight device instead of the real device.

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 32 +++++++++++++--------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index 4ee4c80..3b333fb 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -66,7 +66,6 @@
 /**
  * struct etb_drvdata - specifics associated to an ETB component
  * @base:	memory mapped base address for this component.
- * @dev:	the device entity associated to this component.
  * @atclk:	optional clock for the core parts of the ETB.
  * @csdev:	component vitals needed by the framework.
  * @miscdev:	specifics to handle "/dev/xyz.etb" entry.
@@ -81,7 +80,6 @@
  */
 struct etb_drvdata {
 	void __iomem		*base;
-	struct device		*dev;
 	struct clk		*atclk;
 	struct coresight_device	*csdev;
 	struct miscdevice	miscdev;
@@ -227,7 +225,6 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data)
 static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
 {
 	int ret;
-	struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
 
 	switch (mode) {
 	case CS_MODE_SYSFS:
@@ -244,13 +241,14 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data)
 	if (ret)
 		return ret;
 
-	dev_dbg(drvdata->dev, "ETB enabled\n");
+	dev_dbg(&csdev->dev, "ETB enabled\n");
 	return 0;
 }
 
 static void __etb_disable_hw(struct etb_drvdata *drvdata)
 {
 	u32 ffcr;
+	struct device *dev = &drvdata->csdev->dev;
 
 	CS_UNLOCK(drvdata->base);
 
@@ -263,7 +261,7 @@ static void __etb_disable_hw(struct etb_drvdata *drvdata)
 	writel_relaxed(ffcr, drvdata->base + ETB_FFCR);
 
 	if (coresight_timeout(drvdata->base, ETB_FFCR, ETB_FFCR_BIT, 0)) {
-		dev_err(drvdata->dev,
+		dev_err(dev,
 		"timeout while waiting for completion of Manual Flush\n");
 	}
 
@@ -271,7 +269,7 @@ static void __etb_disable_hw(struct etb_drvdata *drvdata)
 	writel_relaxed(0x0, drvdata->base + ETB_CTL_REG);
 
 	if (coresight_timeout(drvdata->base, ETB_FFSR, ETB_FFSR_BIT, 1)) {
-		dev_err(drvdata->dev,
+		dev_err(dev,
 			"timeout while waiting for Formatter to Stop\n");
 	}
 
@@ -286,6 +284,7 @@ static void etb_dump_hw(struct etb_drvdata *drvdata)
 	u32 read_data, depth;
 	u32 read_ptr, write_ptr;
 	u32 frame_off, frame_endoff;
+	struct device *dev = &drvdata->csdev->dev;
 
 	CS_UNLOCK(drvdata->base);
 
@@ -295,10 +294,10 @@ static void etb_dump_hw(struct etb_drvdata *drvdata)
 	frame_off = write_ptr % ETB_FRAME_SIZE_WORDS;
 	frame_endoff = ETB_FRAME_SIZE_WORDS - frame_off;
 	if (frame_off) {
-		dev_err(drvdata->dev,
+		dev_err(dev,
 			"write_ptr: %lu not aligned to formatter frame size\n",
 			(unsigned long)write_ptr);
-		dev_err(drvdata->dev, "frameoff: %lu, frame_endoff: %lu\n",
+		dev_err(dev, "frameoff: %lu, frame_endoff: %lu\n",
 			(unsigned long)frame_off, (unsigned long)frame_endoff);
 		write_ptr += frame_endoff;
 	}
@@ -365,7 +364,7 @@ static int etb_disable(struct coresight_device *csdev)
 	drvdata->mode = CS_MODE_DISABLED;
 	spin_unlock_irqrestore(&drvdata->spinlock, flags);
 
-	dev_dbg(drvdata->dev, "ETB disabled\n");
+	dev_dbg(&csdev->dev, "ETB disabled\n");
 	return 0;
 }
 
@@ -460,7 +459,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev,
 	 * chance to fix things.
 	 */
 	if (write_ptr % ETB_FRAME_SIZE_WORDS) {
-		dev_err(drvdata->dev,
+		dev_err(&csdev->dev,
 			"write_ptr: %lu not aligned to formatter frame size\n",
 			(unsigned long)write_ptr);
 
@@ -587,7 +586,7 @@ static void etb_dump(struct etb_drvdata *drvdata)
 	}
 	spin_unlock_irqrestore(&drvdata->spinlock, flags);
 
-	dev_dbg(drvdata->dev, "ETB dumped\n");
+	dev_dbg(&drvdata->csdev->dev, "ETB dumped\n");
 }
 
 static int etb_open(struct inode *inode, struct file *file)
@@ -598,7 +597,7 @@ static int etb_open(struct inode *inode, struct file *file)
 	if (local_cmpxchg(&drvdata->reading, 0, 1))
 		return -EBUSY;
 
-	dev_dbg(drvdata->dev, "%s: successfully opened\n", __func__);
+	dev_dbg(&drvdata->csdev->dev, "%s: successfully opened\n", __func__);
 	return 0;
 }
 
@@ -608,6 +607,7 @@ static ssize_t etb_read(struct file *file, char __user *data,
 	u32 depth;
 	struct etb_drvdata *drvdata = container_of(file->private_data,
 						   struct etb_drvdata, miscdev);
+	struct device *dev = &drvdata->csdev->dev;
 
 	etb_dump(drvdata);
 
@@ -616,13 +616,14 @@ static ssize_t etb_read(struct file *file, char __user *data,
 		len = depth * 4 - *ppos;
 
 	if (copy_to_user(data, drvdata->buf + *ppos, len)) {
-		dev_dbg(drvdata->dev, "%s: copy_to_user failed\n", __func__);
+		dev_dbg(dev,
+			"%s: copy_to_user failed\n", __func__);
 		return -EFAULT;
 	}
 
 	*ppos += len;
 
-	dev_dbg(drvdata->dev, "%s: %zu bytes copied, %d bytes left\n",
+	dev_dbg(dev, "%s: %zu bytes copied, %d bytes left\n",
 		__func__, len, (int)(depth * 4 - *ppos));
 	return len;
 }
@@ -633,7 +634,7 @@ static int etb_release(struct inode *inode, struct file *file)
 						   struct etb_drvdata, miscdev);
 	local_set(&drvdata->reading, 0);
 
-	dev_dbg(drvdata->dev, "%s: released\n", __func__);
+	dev_dbg(&drvdata->csdev->dev, "%s: released\n", __func__);
 	return 0;
 }
 
@@ -737,7 +738,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
 	if (!drvdata)
 		return -ENOMEM;
 
-	drvdata->dev = &adev->dev;
 	drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */
 	if (!IS_ERR(drvdata->atclk)) {
 		ret = clk_prepare_enable(drvdata->atclk);
-- 
2.7.4


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

  parent reply index

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 10:34 [PATCH v4 00/30] coresight: Support for ACPI bindings Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 01/30] coresight: funnel: Clean up device book keeping Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 02/30] coresight: replicator: Cleanup device tracking Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 03/30] coresight: tmc: Clean up device specific data Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 04/30] coresight: catu: Cleanup " Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 05/30] coresight: tpiu: Clean up " Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 06/30] coresight: stm: Cleanup " Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 07/30] coresight: etm: Clean up " Suzuki K Poulose
2019-05-22 10:34 ` Suzuki K Poulose [this message]
2019-05-22 10:34 ` [PATCH v4 09/30] coresight: Use coresight device names for sinks in PMU attribute Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 10/30] coresight: Rename of_coresight to coresight-platform Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 11/30] coresight: etm3x: Rearrange cp14 access detection Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 12/30] coresight: stm: Rearrange probing the stimulus area Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 13/30] coresight: tmc-etr: Rearrange probing default buffer size Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 14/30] coresight: platform: Make memory allocation helper generic Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 15/30] coresight: Make sure device uses DT for obsolete compatible check Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 16/30] coresight: Introduce generic platform data helper Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 17/30] coresight: Make device to CPU mapping generic Suzuki K Poulose
2019-06-03 10:07   ` Mike Leach
2019-06-06 12:56     ` Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 18/30] coresight: Remove cpu field from platform data Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 19/30] coresight: Remove name from platform description Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 20/30] coresight: Cleanup coresight_remove_conns Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 21/30] coresight: Reuse platform data structure for connection tracking Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 22/30] coresight: Rearrange platform data probing Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 23/30] coresight: Add support for releasing platform specific data Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 24/30] coresight: platform: Use fwnode handle for device search Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 25/30] coresight: Use fwnode handle instead of device names Suzuki K Poulose
2019-05-22 10:34 ` [PATCH v4 26/30] coresight: Use platform agnostic names Suzuki K Poulose
2019-05-29  9:32   ` Mike Leach
2019-06-03 10:12     ` Suzuki K Poulose
2019-05-22 10:35 ` [PATCH v4 27/30] coresight: stm: ACPI support for parsing stimulus base Suzuki K Poulose
2019-05-22 10:35 ` [PATCH v4 28/30] coresight: Support for ACPI bindings Suzuki K Poulose
2019-05-22 10:35 ` [PATCH v4 29/30] coresight: acpi: Support for AMBA components Suzuki K Poulose
2019-05-22 10:35 ` [PATCH v4 30/30] coresight: acpi: Support for platform devices Suzuki K Poulose
2019-05-22 10:35 ` [TEST PATCH 31/30][EDK2] edk2-platform: juno: Update ACPI CoreSight Bindings Suzuki K Poulose
2019-05-23 13:37 ` [PATCH v4 00/30] coresight: Support for ACPI bindings Suzuki K Poulose
2019-05-23 14:32 ` Leo Yan
2019-05-23 15:31   ` Suzuki K Poulose
2019-05-24  1:38     ` Leo Yan
2019-05-24 13:19     ` Mike Leach
2019-05-28  5:19 ` Leo Yan
2019-05-28  8:08   ` Leo Yan
2019-05-28 14:51   ` Mathieu Poirier
2019-05-29  6:34     ` Leo Yan
2019-05-28 17:32 ` Mathieu Poirier
2019-05-28 17:36   ` Mathieu Poirier
2019-05-28 17:40     ` Suzuki K Poulose

Reply instructions:

You may reply publically 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=1558521304-27469-9-git-send-email-suzuki.poulose@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox