All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org, rjw@rjwysocki.net,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 22/30] coresight: Rearrange platform data probing
Date: Mon, 13 May 2019 11:21:57 -0600	[thread overview]
Message-ID: <20190513172157.GC16162@xps15> (raw)
In-Reply-To: <1557226378-10131-23-git-send-email-suzuki.poulose@arm.com>

On Tue, May 07, 2019 at 11:52:49AM +0100, Suzuki K Poulose wrote:
> We are about to introduce methods to clean up the platform data
> as we switch to tracking the device reference from "name" to "fwnode
> handles" for device connections. This requires us to drop the fwnode
> handle references when the data is no longer required - i.e, when
> the device probe fails or the device gets unregistered.
> 
> In order to consolidate the invocation of the cleanup, we delay the
> platform probing to the very last minute, possibly before invoking
> the coresight_register. Then, we leave the coresight core code to
> do the clean up. i.e, if the coresight_register fails, it takes
> care of freeing the data. Otherwise, coresight_unregister will
> do the necessary operations.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-catu.c       | 14 +++++++-------
>  drivers/hwtracing/coresight/coresight-etb10.c      | 10 +++++-----
>  drivers/hwtracing/coresight/coresight-etm3x.c      | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-etm4x.c      | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-funnel.c     | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-replicator.c | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-stm.c        | 11 +++++++----
>  drivers/hwtracing/coresight/coresight-tmc.c        | 16 ++++++++--------
>  drivers/hwtracing/coresight/coresight-tpiu.c       | 10 +++++-----
>  9 files changed, 60 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
> index 05c7304..1c1ad12 100644
> --- a/drivers/hwtracing/coresight/coresight-catu.c
> +++ b/drivers/hwtracing/coresight/coresight-catu.c
> @@ -505,13 +505,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct device *dev = &adev->dev;
>  	void __iomem *base;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata)) {
> -		ret = PTR_ERR(pdata);
> -		goto out;
> -	}
> -	dev->platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata) {
>  		ret = -ENOMEM;
> @@ -544,6 +537,13 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (ret)
>  		goto out;
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out;
> +	}
> +	dev->platform_data = pdata;
> +
>  	drvdata->base = base;
>  	catu_desc.pdata = pdata;
>  	catu_desc.dev = dev;
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 5e7ecc6..09df827 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -726,11 +726,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -765,6 +760,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
>  	/* This device is not associated with a session */
>  	drvdata->pid = -1;
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata))
> +		return PTR_ERR(pdata);
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SINK;
>  	desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
>  	desc.ops = &etb_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
> index 101fb01..f2d4616 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x.c
> @@ -795,11 +795,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (!drvdata)
>  		return -ENOMEM;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -
> -	adev->dev.platform_data = pdata;
>  	drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14");
>  	dev_set_drvdata(dev, drvdata);
>  
> @@ -849,6 +844,13 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
>  	etm_init_trace_id(drvdata);
>  	etm_set_default(&drvdata->config);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto err_arch_supported;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
>  	desc.ops = &etm_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
> index 8adc148..1609da1 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
> @@ -1089,11 +1089,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (!drvdata)
>  		return -ENOMEM;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
> -
>  	dev_set_drvdata(dev, drvdata);
>  
>  	/* Validity for the resource is already checked by the AMBA core */
> @@ -1136,6 +1131,13 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
>  	etm4_init_trace_id(drvdata);
>  	etm4_set_default(&drvdata->config);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto err_arch_supported;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
>  	desc.ops = &etm4_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index ded33f5..75fa2d3 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -188,11 +188,6 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  	struct funnel_drvdata *drvdata;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	if (is_of_node(dev_fwnode(dev)) &&
>  	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
>  		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
> @@ -224,6 +219,13 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  
>  	dev_set_drvdata(dev, drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out_disable_clk;
> +	}
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_LINK;
>  	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG;
>  	desc.ops = &funnel_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index f28bafd..64dfde7 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -179,11 +179,6 @@ static int replicator_probe(struct device *dev, struct resource *res)
>  	struct coresight_desc desc = { 0 };
>  	void __iomem *base;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	if (is_of_node(dev_fwnode(dev)) &&
>  	    of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
>  		pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
> @@ -215,6 +210,13 @@ static int replicator_probe(struct device *dev, struct resource *res)
>  
>  	dev_set_drvdata(dev, drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out_disable_clk;
> +	}
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_LINK;
>  	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
>  	desc.ops = &replicator_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
> index 02031d9..03528f3 100644
> --- a/drivers/hwtracing/coresight/coresight-stm.c
> +++ b/drivers/hwtracing/coresight/coresight-stm.c
> @@ -810,10 +810,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  	size_t bitmap_size;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -866,6 +862,13 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  		return -EPROBE_DEFER;
>  	}
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto stm_unregister;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE;
>  	desc.ops = &stm_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
> index 44a5719..212630e 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc.c
> @@ -398,13 +398,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata)) {
> -		ret = PTR_ERR(pdata);
> -		goto out;
> -	}
> -	adev->dev.platform_data = pdata;
> -
>  	ret = -ENOMEM;
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
> @@ -434,7 +427,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  	else
>  		drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;
>  
> -	desc.pdata = pdata;
>  	desc.dev = dev;
>  	desc.groups = coresight_tmc_groups;
>  	desc.name = dev_name(dev);
> @@ -467,6 +459,14 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  		goto out;
>  	}
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out;
> +	}
> +	adev->dev.platform_data = pdata;
> +	desc.pdata = pdata;
> +
>  	drvdata->csdev = coresight_register(&desc);
>  	if (IS_ERR(drvdata->csdev)) {
>  		ret = PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
> index d8a2e39..b699d61 100644
> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> @@ -125,11 +125,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -152,6 +147,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	/* Disable tpiu to support older devices */
>  	tpiu_disable_hw(drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata))
> +		return PTR_ERR(pdata);
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SINK;
>  	desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PORT;
>  	desc.ops = &tpiu_cs_ops;

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

> -- 
> 2.7.4
> 

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

WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, coresight@lists.linaro.org,
	rjw@rjwysocki.net
Subject: Re: [PATCH v3 22/30] coresight: Rearrange platform data probing
Date: Mon, 13 May 2019 11:21:57 -0600	[thread overview]
Message-ID: <20190513172157.GC16162@xps15> (raw)
In-Reply-To: <1557226378-10131-23-git-send-email-suzuki.poulose@arm.com>

On Tue, May 07, 2019 at 11:52:49AM +0100, Suzuki K Poulose wrote:
> We are about to introduce methods to clean up the platform data
> as we switch to tracking the device reference from "name" to "fwnode
> handles" for device connections. This requires us to drop the fwnode
> handle references when the data is no longer required - i.e, when
> the device probe fails or the device gets unregistered.
> 
> In order to consolidate the invocation of the cleanup, we delay the
> platform probing to the very last minute, possibly before invoking
> the coresight_register. Then, we leave the coresight core code to
> do the clean up. i.e, if the coresight_register fails, it takes
> care of freeing the data. Otherwise, coresight_unregister will
> do the necessary operations.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  drivers/hwtracing/coresight/coresight-catu.c       | 14 +++++++-------
>  drivers/hwtracing/coresight/coresight-etb10.c      | 10 +++++-----
>  drivers/hwtracing/coresight/coresight-etm3x.c      | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-etm4x.c      | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-funnel.c     | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-replicator.c | 12 +++++++-----
>  drivers/hwtracing/coresight/coresight-stm.c        | 11 +++++++----
>  drivers/hwtracing/coresight/coresight-tmc.c        | 16 ++++++++--------
>  drivers/hwtracing/coresight/coresight-tpiu.c       | 10 +++++-----
>  9 files changed, 60 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c
> index 05c7304..1c1ad12 100644
> --- a/drivers/hwtracing/coresight/coresight-catu.c
> +++ b/drivers/hwtracing/coresight/coresight-catu.c
> @@ -505,13 +505,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct device *dev = &adev->dev;
>  	void __iomem *base;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata)) {
> -		ret = PTR_ERR(pdata);
> -		goto out;
> -	}
> -	dev->platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata) {
>  		ret = -ENOMEM;
> @@ -544,6 +537,13 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (ret)
>  		goto out;
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out;
> +	}
> +	dev->platform_data = pdata;
> +
>  	drvdata->base = base;
>  	catu_desc.pdata = pdata;
>  	catu_desc.dev = dev;
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 5e7ecc6..09df827 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -726,11 +726,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -765,6 +760,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
>  	/* This device is not associated with a session */
>  	drvdata->pid = -1;
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata))
> +		return PTR_ERR(pdata);
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SINK;
>  	desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER;
>  	desc.ops = &etb_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c
> index 101fb01..f2d4616 100644
> --- a/drivers/hwtracing/coresight/coresight-etm3x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x.c
> @@ -795,11 +795,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (!drvdata)
>  		return -ENOMEM;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -
> -	adev->dev.platform_data = pdata;
>  	drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14");
>  	dev_set_drvdata(dev, drvdata);
>  
> @@ -849,6 +844,13 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
>  	etm_init_trace_id(drvdata);
>  	etm_set_default(&drvdata->config);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto err_arch_supported;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
>  	desc.ops = &etm_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
> index 8adc148..1609da1 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
> @@ -1089,11 +1089,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
>  	if (!drvdata)
>  		return -ENOMEM;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
> -
>  	dev_set_drvdata(dev, drvdata);
>  
>  	/* Validity for the resource is already checked by the AMBA core */
> @@ -1136,6 +1131,13 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
>  	etm4_init_trace_id(drvdata);
>  	etm4_set_default(&drvdata->config);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto err_arch_supported;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC;
>  	desc.ops = &etm4_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index ded33f5..75fa2d3 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -188,11 +188,6 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  	struct funnel_drvdata *drvdata;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	if (is_of_node(dev_fwnode(dev)) &&
>  	    of_device_is_compatible(dev->of_node, "arm,coresight-funnel"))
>  		pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n");
> @@ -224,6 +219,13 @@ static int funnel_probe(struct device *dev, struct resource *res)
>  
>  	dev_set_drvdata(dev, drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out_disable_clk;
> +	}
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_LINK;
>  	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG;
>  	desc.ops = &funnel_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index f28bafd..64dfde7 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -179,11 +179,6 @@ static int replicator_probe(struct device *dev, struct resource *res)
>  	struct coresight_desc desc = { 0 };
>  	void __iomem *base;
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	if (is_of_node(dev_fwnode(dev)) &&
>  	    of_device_is_compatible(dev->of_node, "arm,coresight-replicator"))
>  		pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n");
> @@ -215,6 +210,13 @@ static int replicator_probe(struct device *dev, struct resource *res)
>  
>  	dev_set_drvdata(dev, drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out_disable_clk;
> +	}
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_LINK;
>  	desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT;
>  	desc.ops = &replicator_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
> index 02031d9..03528f3 100644
> --- a/drivers/hwtracing/coresight/coresight-stm.c
> +++ b/drivers/hwtracing/coresight/coresight-stm.c
> @@ -810,10 +810,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  	size_t bitmap_size;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	adev->dev.platform_data = pdata;
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -866,6 +862,13 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id)
>  		return -EPROBE_DEFER;
>  	}
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto stm_unregister;
> +	}
> +	adev->dev.platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>  	desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE;
>  	desc.ops = &stm_cs_ops;
> diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c
> index 44a5719..212630e 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc.c
> @@ -398,13 +398,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata)) {
> -		ret = PTR_ERR(pdata);
> -		goto out;
> -	}
> -	adev->dev.platform_data = pdata;
> -
>  	ret = -ENOMEM;
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
> @@ -434,7 +427,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  	else
>  		drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;
>  
> -	desc.pdata = pdata;
>  	desc.dev = dev;
>  	desc.groups = coresight_tmc_groups;
>  	desc.name = dev_name(dev);
> @@ -467,6 +459,14 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
>  		goto out;
>  	}
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata)) {
> +		ret = PTR_ERR(pdata);
> +		goto out;
> +	}
> +	adev->dev.platform_data = pdata;
> +	desc.pdata = pdata;
> +
>  	drvdata->csdev = coresight_register(&desc);
>  	if (IS_ERR(drvdata->csdev)) {
>  		ret = PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
> index d8a2e39..b699d61 100644
> --- a/drivers/hwtracing/coresight/coresight-tpiu.c
> +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
> @@ -125,11 +125,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	struct resource *res = &adev->res;
>  	struct coresight_desc desc = { 0 };
>  
> -	pdata = coresight_get_platform_data(dev);
> -	if (IS_ERR(pdata))
> -		return PTR_ERR(pdata);
> -	dev->platform_data = pdata;
> -
>  	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>  	if (!drvdata)
>  		return -ENOMEM;
> @@ -152,6 +147,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id)
>  	/* Disable tpiu to support older devices */
>  	tpiu_disable_hw(drvdata);
>  
> +	pdata = coresight_get_platform_data(dev);
> +	if (IS_ERR(pdata))
> +		return PTR_ERR(pdata);
> +	dev->platform_data = pdata;
> +
>  	desc.type = CORESIGHT_DEV_TYPE_SINK;
>  	desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PORT;
>  	desc.ops = &tpiu_cs_ops;

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

> -- 
> 2.7.4
> 

  reply	other threads:[~2019-05-13 17:22 UTC|newest]

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

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=20190513172157.GC16162@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=coresight@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=suzuki.poulose@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.