diff mbox series

[v2,11/36] coresight: stm: Cleanup device specific data

Message ID 1555344260-12375-12-git-send-email-suzuki.poulose@arm.com
State Superseded
Headers show
Series coresight: Support for ACPI bindings | expand

Commit Message

Suzuki K Poulose April 15, 2019, 4:03 p.m. UTC
Keep track of the STM coresight device which is a child device
of the AMBA device. Since we can get to the coresight_device
from the "device" instance, remove the explicit field.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

---
 drivers/hwtracing/coresight/coresight-stm.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

-- 
2.7.4

Comments

Mathieu Poirier April 18, 2019, 4:50 p.m. UTC | #1
On Mon, Apr 15, 2019 at 05:03:54PM +0100, Suzuki K Poulose wrote:
> Keep track of the STM coresight device which is a child device

> of the AMBA device. Since we can get to the coresight_device

> from the "device" instance, remove the explicit field.

> 

> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>

> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

> ---

>  drivers/hwtracing/coresight/coresight-stm.c | 21 ++++++++++-----------

>  1 file changed, 10 insertions(+), 11 deletions(-)

> 

> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c

> index 9f8a844..8f50484 100644

> --- a/drivers/hwtracing/coresight/coresight-stm.c

> +++ b/drivers/hwtracing/coresight/coresight-stm.c

> @@ -110,7 +110,6 @@ struct channel_space {

>  /**

>   * struct stm_drvdata - specifics associated to an STM 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 STM.

>   * @csdev:		component vitals needed by the framework.

>   * @spinlock:		only one at a time pls.

> @@ -128,7 +127,6 @@ struct channel_space {

>   */

>  struct stm_drvdata {

>  	void __iomem		*base;

> -	struct device		*dev;

>  	struct clk		*atclk;

>  	struct coresight_device	*csdev;

>  	spinlock_t		spinlock;

> @@ -205,13 +203,13 @@ static int stm_enable(struct coresight_device *csdev,

>  	if (val)

>  		return -EBUSY;

>  

> -	pm_runtime_get_sync(drvdata->dev);

> +	pm_runtime_get_sync(csdev->dev.parent);

>  

>  	spin_lock(&drvdata->spinlock);

>  	stm_enable_hw(drvdata);

>  	spin_unlock(&drvdata->spinlock);

>  

> -	dev_dbg(drvdata->dev, "STM tracing enabled\n");

> +	dev_dbg(&csdev->dev, "STM tracing enabled\n");

>  	return 0;

>  }

>  

> @@ -271,10 +269,10 @@ static void stm_disable(struct coresight_device *csdev,

>  		/* Wait until the engine has completely stopped */

>  		coresight_timeout(drvdata->base, STMTCSR, STMTCSR_BUSY_BIT, 0);

>  

> -		pm_runtime_put(drvdata->dev);

> +		pm_runtime_put(csdev->dev.parent);

>  

>  		local_set(&drvdata->mode, CS_MODE_DISABLED);

> -		dev_dbg(drvdata->dev, "STM tracing disabled\n");

> +		dev_dbg(&csdev->dev, "STM tracing disabled\n");

>  	}

>  }

>  

> @@ -763,9 +761,10 @@ static void stm_init_default_data(struct stm_drvdata *drvdata)

>  	bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp);

>  }

>  

> -static void stm_init_generic_data(struct stm_drvdata *drvdata)

> +static void stm_init_generic_data(struct stm_drvdata *drvdata,

> +				  const char *name)

>  {

> -	drvdata->stm.name = dev_name(drvdata->dev);

> +	drvdata->stm.name = name;

>  

>  	/*

>  	 * MasterIDs are assigned at HW design phase. As such the core is

> @@ -807,7 +806,6 @@ static int stm_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);

> @@ -848,7 +846,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)

>  	spin_lock_init(&drvdata->spinlock);

>  

>  	stm_init_default_data(drvdata);

> -	stm_init_generic_data(drvdata);

> +	stm_init_generic_data(drvdata, dev_name(dev));

>  

>  	if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) {

>  		dev_info(dev,

> @@ -870,7 +868,8 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)

>  

>  	pm_runtime_put(&adev->dev);

>  

> -	dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id));

> +	dev_info(&drvdata->csdev->dev, "%s initialized\n",

> +		 (char *)coresight_get_uci_data(id));

>  	return 0;

>  

>  stm_unregister:


Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>


> -- 

> 2.7.4

>
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index 9f8a844..8f50484 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -110,7 +110,6 @@  struct channel_space {
 /**
  * struct stm_drvdata - specifics associated to an STM 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 STM.
  * @csdev:		component vitals needed by the framework.
  * @spinlock:		only one at a time pls.
@@ -128,7 +127,6 @@  struct channel_space {
  */
 struct stm_drvdata {
 	void __iomem		*base;
-	struct device		*dev;
 	struct clk		*atclk;
 	struct coresight_device	*csdev;
 	spinlock_t		spinlock;
@@ -205,13 +203,13 @@  static int stm_enable(struct coresight_device *csdev,
 	if (val)
 		return -EBUSY;
 
-	pm_runtime_get_sync(drvdata->dev);
+	pm_runtime_get_sync(csdev->dev.parent);
 
 	spin_lock(&drvdata->spinlock);
 	stm_enable_hw(drvdata);
 	spin_unlock(&drvdata->spinlock);
 
-	dev_dbg(drvdata->dev, "STM tracing enabled\n");
+	dev_dbg(&csdev->dev, "STM tracing enabled\n");
 	return 0;
 }
 
@@ -271,10 +269,10 @@  static void stm_disable(struct coresight_device *csdev,
 		/* Wait until the engine has completely stopped */
 		coresight_timeout(drvdata->base, STMTCSR, STMTCSR_BUSY_BIT, 0);
 
-		pm_runtime_put(drvdata->dev);
+		pm_runtime_put(csdev->dev.parent);
 
 		local_set(&drvdata->mode, CS_MODE_DISABLED);
-		dev_dbg(drvdata->dev, "STM tracing disabled\n");
+		dev_dbg(&csdev->dev, "STM tracing disabled\n");
 	}
 }
 
@@ -763,9 +761,10 @@  static void stm_init_default_data(struct stm_drvdata *drvdata)
 	bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp);
 }
 
-static void stm_init_generic_data(struct stm_drvdata *drvdata)
+static void stm_init_generic_data(struct stm_drvdata *drvdata,
+				  const char *name)
 {
-	drvdata->stm.name = dev_name(drvdata->dev);
+	drvdata->stm.name = name;
 
 	/*
 	 * MasterIDs are assigned at HW design phase. As such the core is
@@ -807,7 +806,6 @@  static int stm_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);
@@ -848,7 +846,7 @@  static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 	spin_lock_init(&drvdata->spinlock);
 
 	stm_init_default_data(drvdata);
-	stm_init_generic_data(drvdata);
+	stm_init_generic_data(drvdata, dev_name(dev));
 
 	if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) {
 		dev_info(dev,
@@ -870,7 +868,8 @@  static int stm_probe(struct amba_device *adev, const struct amba_id *id)
 
 	pm_runtime_put(&adev->dev);
 
-	dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id));
+	dev_info(&drvdata->csdev->dev, "%s initialized\n",
+		 (char *)coresight_get_uci_data(id));
 	return 0;
 
 stm_unregister: