public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe()
@ 2026-03-02 19:56 Andrew Davis
  2026-03-02 19:56 ` [PATCH 2/3] remoteproc: da8xx: Remove unused local struct data Andrew Davis
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Davis @ 2026-03-02 19:56 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, Andrew Davis

Simplify the probe() code by using dev_err_probe().

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/remoteproc/da8xx_remoteproc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index e418a2bf5d2ee..41744f3f0252f 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -306,10 +306,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback,
 					handle_event, 0, "da8xx-remoteproc",
 					rproc);
-	if (ret) {
-		dev_err(dev, "devm_request_threaded_irq error: %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "devm_request_threaded_irq error\n");
 
 	/*
 	 * rproc_add() can end up enabling the DSP's clk with the DSP
@@ -327,10 +325,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 	drproc->irq = irq;
 
 	ret = devm_rproc_add(dev, rproc);
-	if (ret) {
-		dev_err(dev, "rproc_add failed: %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "rproc_add failed\n");
 
 	return 0;
 }
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] remoteproc: da8xx: Remove unused local struct data
  2026-03-02 19:56 [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Andrew Davis
@ 2026-03-02 19:56 ` Andrew Davis
  2026-03-02 19:56 ` [PATCH 3/3] remoteproc: da8xx: Reorder resource fetching in probe() Andrew Davis
  2026-03-06 17:34 ` [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Mathieu Poirier
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Davis @ 2026-03-02 19:56 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, Andrew Davis

The member irq is never used and ack_fxn is unneeded as it
is already a part of another member irq_data. Drop those
and their struct docs. While touching the struct docs add
one for dsp_reset which was previously missing.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/remoteproc/da8xx_remoteproc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 41744f3f0252f..f44bee303eb5e 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -57,11 +57,10 @@ struct da8xx_rproc_mem {
  * @mem: internal memory regions data
  * @num_mems: number of internal memory regions
  * @dsp_clk: placeholder for platform's DSP clk
- * @ack_fxn: chip-specific ack function for ack'ing irq
+ * @dsp_reset: control for local reset
  * @irq_data: ack_fxn function parameter
  * @chipsig: virt ptr to DSP interrupt registers (CHIPSIG & CHIPSIG_CLR)
  * @bootreg: virt ptr to DSP boot address register (HOST1CFG)
- * @irq: irq # used by this instance
  */
 struct da8xx_rproc {
 	struct rproc *rproc;
@@ -69,11 +68,9 @@ struct da8xx_rproc {
 	int num_mems;
 	struct clk *dsp_clk;
 	struct reset_control *dsp_reset;
-	void (*ack_fxn)(struct irq_data *data);
 	struct irq_data *irq_data;
 	void __iomem *chipsig;
 	void __iomem *bootreg;
-	int irq;
 };
 
 /**
@@ -122,7 +119,7 @@ static irqreturn_t da8xx_rproc_callback(int irq, void *p)
 		 * we need to ack it after taking down the level else we'll
 		 * be called again immediately after returning.
 		 */
-		drproc->ack_fxn(drproc->irq_data);
+		drproc->irq_data->chip->irq_ack(drproc->irq_data);
 
 		return IRQ_WAKE_THREAD;
 	}
@@ -320,9 +317,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 
 	drproc->chipsig = chipsig;
 	drproc->bootreg = bootreg;
-	drproc->ack_fxn = irq_data->chip->irq_ack;
 	drproc->irq_data = irq_data;
-	drproc->irq = irq;
 
 	ret = devm_rproc_add(dev, rproc);
 	if (ret)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] remoteproc: da8xx: Reorder resource fetching in probe()
  2026-03-02 19:56 [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Andrew Davis
  2026-03-02 19:56 ` [PATCH 2/3] remoteproc: da8xx: Remove unused local struct data Andrew Davis
@ 2026-03-02 19:56 ` Andrew Davis
  2026-03-06 17:34 ` [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Mathieu Poirier
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Davis @ 2026-03-02 19:56 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, Andrew Davis

Currently several resource are fetched before we allocate our instance
data struct. The is unlike most other drivers that fill in the instance
data with resources as they are fetched. Move these down which is more
natural and also removes the need for several temporarily locals.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/remoteproc/da8xx_remoteproc.c | 75 ++++++++++++---------------
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index f44bee303eb5e..ea82500165cb6 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -242,45 +242,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct da8xx_rproc *drproc;
 	struct rproc *rproc;
-	struct irq_data *irq_data;
-	struct clk *dsp_clk;
-	struct reset_control *dsp_reset;
-	void __iomem *chipsig;
-	void __iomem *bootreg;
 	int irq;
 	int ret;
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
-	irq_data = irq_get_irq_data(irq);
-	if (!irq_data)
-		return dev_err_probe(dev, -EINVAL, "irq_get_irq_data(%d): NULL\n", irq);
-
-	bootreg = devm_platform_ioremap_resource_byname(pdev, "host1cfg");
-	if (IS_ERR(bootreg))
-		return PTR_ERR(bootreg);
-
-	chipsig = devm_platform_ioremap_resource_byname(pdev, "chipsig");
-	if (IS_ERR(chipsig))
-		return PTR_ERR(chipsig);
-
-	dsp_clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(dsp_clk))
-		return dev_err_probe(dev, PTR_ERR(dsp_clk), "clk_get error\n");
-
-	dsp_reset = devm_reset_control_get_exclusive(dev, NULL);
-	if (IS_ERR(dsp_reset))
-		return dev_err_probe(dev, PTR_ERR(dsp_reset), "unable to get reset control\n");
-
-	if (dev->of_node) {
-		ret = of_reserved_mem_device_init(dev);
-		if (ret)
-			return dev_err_probe(dev, ret, "device does not have specific CMA pool\n");
-		devm_add_action_or_reset(&pdev->dev, da8xx_rproc_mem_release, &pdev->dev);
-	}
-
 	rproc = devm_rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name,
 				 sizeof(*drproc));
 	if (!rproc)
@@ -291,14 +255,43 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 
 	drproc = rproc->priv;
 	drproc->rproc = rproc;
-	drproc->dsp_clk = dsp_clk;
-	drproc->dsp_reset = dsp_reset;
 	rproc->has_iommu = false;
 
+	drproc->dsp_clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(drproc->dsp_clk))
+		return dev_err_probe(dev, PTR_ERR(drproc->dsp_clk), "clk_get error\n");
+
+	drproc->dsp_reset = devm_reset_control_get_exclusive(dev, NULL);
+	if (IS_ERR(drproc->dsp_reset))
+		return dev_err_probe(dev, PTR_ERR(drproc->dsp_reset), "unable to get reset control\n");
+
+	if (dev->of_node) {
+		ret = of_reserved_mem_device_init(dev);
+		if (ret)
+			return dev_err_probe(dev, ret, "device does not have specific CMA pool\n");
+		devm_add_action_or_reset(&pdev->dev, da8xx_rproc_mem_release, &pdev->dev);
+	}
+
 	ret = da8xx_rproc_get_internal_memories(pdev, drproc);
 	if (ret)
 		return ret;
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	drproc->irq_data = irq_get_irq_data(irq);
+	if (!drproc->irq_data)
+		return dev_err_probe(dev, -EINVAL, "irq_get_irq_data(%d): NULL\n", irq);
+
+	drproc->chipsig = devm_platform_ioremap_resource_byname(pdev, "chipsig");
+	if (IS_ERR(drproc->chipsig))
+		return PTR_ERR(drproc->chipsig);
+
+	drproc->bootreg = devm_platform_ioremap_resource_byname(pdev, "host1cfg");
+	if (IS_ERR(drproc->bootreg))
+		return PTR_ERR(drproc->bootreg);
+
 	/* everything the ISR needs is now setup, so hook it up */
 	ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback,
 					handle_event, 0, "da8xx-remoteproc",
@@ -311,14 +304,10 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 	 * *not* in reset, but da8xx_rproc_start() needs the DSP to be
 	 * held in reset at the time it is called.
 	 */
-	ret = reset_control_assert(dsp_reset);
+	ret = reset_control_assert(drproc->dsp_reset);
 	if (ret)
 		return ret;
 
-	drproc->chipsig = chipsig;
-	drproc->bootreg = bootreg;
-	drproc->irq_data = irq_data;
-
 	ret = devm_rproc_add(dev, rproc);
 	if (ret)
 		return dev_err_probe(dev, ret, "rproc_add failed\n");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe()
  2026-03-02 19:56 [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Andrew Davis
  2026-03-02 19:56 ` [PATCH 2/3] remoteproc: da8xx: Remove unused local struct data Andrew Davis
  2026-03-02 19:56 ` [PATCH 3/3] remoteproc: da8xx: Reorder resource fetching in probe() Andrew Davis
@ 2026-03-06 17:34 ` Mathieu Poirier
  2 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2026-03-06 17:34 UTC (permalink / raw)
  To: Andrew Davis; +Cc: Bjorn Andersson, linux-remoteproc, linux-kernel

On Mon, Mar 02, 2026 at 01:56:14PM -0600, Andrew Davis wrote:
> Simplify the probe() code by using dev_err_probe().
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/remoteproc/da8xx_remoteproc.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>

I have applied this set...
 
> diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
> index e418a2bf5d2ee..41744f3f0252f 100644
> --- a/drivers/remoteproc/da8xx_remoteproc.c
> +++ b/drivers/remoteproc/da8xx_remoteproc.c
> @@ -306,10 +306,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
>  	ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback,
>  					handle_event, 0, "da8xx-remoteproc",
>  					rproc);
> -	if (ret) {
> -		dev_err(dev, "devm_request_threaded_irq error: %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "devm_request_threaded_irq error\n");
>  
>  	/*
>  	 * rproc_add() can end up enabling the DSP's clk with the DSP
> @@ -327,10 +325,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
>  	drproc->irq = irq;
>  
>  	ret = devm_rproc_add(dev, rproc);
> -	if (ret) {
> -		dev_err(dev, "rproc_add failed: %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "rproc_add failed\n");
>  
>  	return 0;
>  }
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-06 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 19:56 [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Andrew Davis
2026-03-02 19:56 ` [PATCH 2/3] remoteproc: da8xx: Remove unused local struct data Andrew Davis
2026-03-02 19:56 ` [PATCH 3/3] remoteproc: da8xx: Reorder resource fetching in probe() Andrew Davis
2026-03-06 17:34 ` [PATCH 1/3] remoteproc: da8xx: Use dev_err_probe() Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox