[10/25] coresight: tpiu: Clean up device specific data
diff mbox series

Message ID 1553107783-3340-11-git-send-email-suzuki.poulose@arm.com
State Superseded
Headers show
Series
  • coresight: Support for ACPI bindings
Related show

Commit Message

Suzuki Kuruppassery Poulose March 20, 2019, 6:49 p.m. UTC
Switch to using the coresight device instead of the parent
amba device.

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

Comments

Mathieu Poirier March 26, 2019, 9:54 p.m. UTC | #1
On Wed, Mar 20, 2019 at 06:49:27PM +0000, Suzuki K Poulose wrote:
> Switch to using the coresight device instead of the parent
> amba device.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-tpiu.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
> index b2f72a1..9763721 100644
> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> @@ -48,15 +48,13 @@
>  
>  /**
>   * @base:	memory mapped base address for this component.
> - * @dev:	the device entity associated to this component.
> + * @dev:	the coresight device entity associated to this component.
>   * @atclk:	optional clock for the core parts of the TPIU.
> - * @csdev:	component vitals needed by the framework.
>   */
>  struct tpiu_drvdata {
>  	void __iomem		*base;
>  	struct device		*dev;
>  	struct clk		*atclk;
> -	struct coresight_device	*csdev;

Here again I would get rid of @dev rather than @csdev to be consistent with what
was done previously.

Mathieu

>  };
>  
>  static void tpiu_enable_hw(struct tpiu_drvdata *drvdata)
> @@ -121,6 +119,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct tpiu_drvdata *drvdata;
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
> +	struct coresight_device *csdev;
>  	struct device_node *np = adev->dev.of_node;
>  
>  	if (np) {
> @@ -134,7 +133,6 @@ static int tpiu_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);
> @@ -160,9 +158,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	desc.ops = &tpiu_cs_ops;
>  	desc.pdata = pdata;
>  	desc.dev = dev;
> -	drvdata->csdev = coresight_register(&desc);
> +	csdev = coresight_register(&desc);
> +	if (!IS_ERR(csdev))
> +		drvdata->dev = &csdev->dev;
>  
> -	return PTR_ERR_OR_ZERO(drvdata->csdev);
> +	return PTR_ERR_OR_ZERO(csdev);
>  }
>  
>  #ifdef CONFIG_PM
> -- 
> 2.7.4
>
Suzuki Kuruppassery Poulose March 27, 2019, 11:52 a.m. UTC | #2
On 03/26/2019 09:54 PM, Mathieu Poirier wrote:
> On Wed, Mar 20, 2019 at 06:49:27PM +0000, Suzuki K Poulose wrote:
>> Switch to using the coresight device instead of the parent
>> amba device.
>>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-tpiu.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
>> index b2f72a1..9763721 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
>> @@ -48,15 +48,13 @@
>>   
>>   /**
>>    * @base:	memory mapped base address for this component.
>> - * @dev:	the device entity associated to this component.
>> + * @dev:	the coresight device entity associated to this component.
>>    * @atclk:	optional clock for the core parts of the TPIU.
>> - * @csdev:	component vitals needed by the framework.
>>    */
>>   struct tpiu_drvdata {
>>   	void __iomem		*base;
>>   	struct device		*dev;
>>   	struct clk		*atclk;
>> -	struct coresight_device	*csdev;
> 
> Here again I would get rid of @dev rather than @csdev to be consistent with what
> was done previously.

Sure, will do.

Cheers
Suzuki

Patch
diff mbox series

diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
index b2f72a1..9763721 100644
--- a/drivers/hwtracing/coresight/coresight-tpiu.c
+++ b/drivers/hwtracing/coresight/coresight-tpiu.c
@@ -48,15 +48,13 @@ 
 
 /**
  * @base:	memory mapped base address for this component.
- * @dev:	the device entity associated to this component.
+ * @dev:	the coresight device entity associated to this component.
  * @atclk:	optional clock for the core parts of the TPIU.
- * @csdev:	component vitals needed by the framework.
  */
 struct tpiu_drvdata {
 	void __iomem		*base;
 	struct device		*dev;
 	struct clk		*atclk;
-	struct coresight_device	*csdev;
 };
 
 static void tpiu_enable_hw(struct tpiu_drvdata *drvdata)
@@ -121,6 +119,7 @@  static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
 	struct tpiu_drvdata *drvdata;
 	struct resource *res = &adev->res;
 	struct coresight_desc desc = { 0 };
+	struct coresight_device *csdev;
 	struct device_node *np = adev->dev.of_node;
 
 	if (np) {
@@ -134,7 +133,6 @@  static int tpiu_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);
@@ -160,9 +158,11 @@  static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
 	desc.ops = &tpiu_cs_ops;
 	desc.pdata = pdata;
 	desc.dev = dev;
-	drvdata->csdev = coresight_register(&desc);
+	csdev = coresight_register(&desc);
+	if (!IS_ERR(csdev))
+		drvdata->dev = &csdev->dev;
 
-	return PTR_ERR_OR_ZERO(drvdata->csdev);
+	return PTR_ERR_OR_ZERO(csdev);
 }
 
 #ifdef CONFIG_PM