All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling
@ 2026-08-01  9:09 mdshahid03
  2026-08-01  9:09 ` [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: mdshahid03 @ 2026-08-01  9:09 UTC (permalink / raw)
  To: Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
	linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
	Scott Branden, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

Hi,

This series simplifies the probe error handling in bcm_iproc_adc.

Changes in v4:
- Move the redundant iproc_adc_enable() error message removal into the
  cleanup patch as suggested by Joshua Crofts.

Mohammad Shahid (3):
  iio: adc: bcm_iproc_adc: Remove redundant probe error messages
  iio: adc: bcm_iproc_adc: Introduce local device pointer
  iio: adc: bcm_iproc_adc: Convert probe error handling to
    dev_err_probe()

 drivers/iio/adc/bcm_iproc_adc.c | 54 +++++++++++++++------------------
 1 file changed, 24 insertions(+), 30 deletions(-)

-- 
2.43.0


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

* [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages
  2026-08-01  9:09 [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
@ 2026-08-01  9:09 ` mdshahid03
  2026-08-03 12:19   ` Joshua Crofts
  2026-08-01  9:09 ` [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: mdshahid03 @ 2026-08-01  9:09 UTC (permalink / raw)
  To: Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
	linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
	Scott Branden, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

devm_request_threaded_irq() already logs an error when the request
fails, making the explicit dev_err() redundant.

Similarly, iproc_adc_enable() already reports failures, making the
additional dev_err() in the probe path redundant.

Remove both duplicate messages.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 drivers/iio/adc/bcm_iproc_adc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index cf4738b16e62..7c2e2770cd61 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -551,10 +551,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
 				iproc_adc_interrupt_handler,
 				iproc_adc_interrupt_thread,
 				IRQF_SHARED, "iproc-adc", indio_dev);
-	if (ret) {
-		dev_err(&pdev->dev, "request_irq error %d\n", ret);
+	if (ret)
 		return ret;
-	}
 
 	ret = clk_prepare_enable(adc_priv->adc_clk);
 	if (ret) {
@@ -564,10 +562,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
 	}
 
 	ret = iproc_adc_enable(indio_dev);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to enable adc %d\n", ret);
+	if (ret)
 		goto err_adc_enable;
-	}
 
 	indio_dev->name = "iproc-static-adc";
 	indio_dev->info = &iproc_adc_iio_info;
-- 
2.43.0


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

* [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer
  2026-08-01  9:09 [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
  2026-08-01  9:09 ` [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
@ 2026-08-01  9:09 ` mdshahid03
  2026-08-01 14:49   ` David Lechner
  2026-08-03 12:44   ` Markus Elfring
  2026-08-01  9:09 ` [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
  2026-08-02  2:06 ` [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling Jonathan Cameron
  3 siblings, 2 replies; 10+ messages in thread
From: mdshahid03 @ 2026-08-01  9:09 UTC (permalink / raw)
  To: Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
	linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
	Scott Branden, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

Introduce a local 'struct device *dev' variable in iproc_adc_probe()
and use it instead of repeatedly referencing '&pdev->dev'.

This simplifies the code and makes subsequent error handling changes
less verbose.

No functional change intended.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 drivers/iio/adc/bcm_iproc_adc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 7c2e2770cd61..4acd9c3f089b 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -506,9 +506,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
 {
 	struct iproc_adc_priv *adc_priv;
 	struct iio_dev *indio_dev = NULL;
+	struct device *dev = &pdev->dev;
 	int ret;
 
-	indio_dev = devm_iio_device_alloc(&pdev->dev,
+	indio_dev = devm_iio_device_alloc(dev,
 					sizeof(*adc_priv));
 	if (!indio_dev)
 		return -ENOMEM;
@@ -523,14 +524,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
 	adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
 			   "adc-syscon");
 	if (IS_ERR(adc_priv->regmap)) {
-		dev_err(&pdev->dev, "failed to get handle for tsc syscon\n");
+		dev_err(dev, "failed to get handle for tsc syscon\n");
 		ret = PTR_ERR(adc_priv->regmap);
 		return ret;
 	}
 
-	adc_priv->adc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
+	adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
 	if (IS_ERR(adc_priv->adc_clk)) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"failed getting clock tsc_clk\n");
 		ret = PTR_ERR(adc_priv->adc_clk);
 		return ret;
@@ -543,11 +544,11 @@ static int iproc_adc_probe(struct platform_device *pdev)
 	ret = regmap_clear_bits(adc_priv->regmap, IPROC_REGCTL2,
 				IPROC_ADC_AUXIN_SCAN_ENA);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to write IPROC_REGCTL2 %d\n", ret);
+		dev_err(dev, "failed to write IPROC_REGCTL2 %d\n", ret);
 		return ret;
 	}
 
-	ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno,
+	ret = devm_request_threaded_irq(dev, adc_priv->irqno,
 				iproc_adc_interrupt_handler,
 				iproc_adc_interrupt_thread,
 				IRQF_SHARED, "iproc-adc", indio_dev);
@@ -556,7 +557,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
 
 	ret = clk_prepare_enable(adc_priv->adc_clk);
 	if (ret) {
-		dev_err(&pdev->dev,
+		dev_err(dev,
 			"clk_prepare_enable failed %d\n", ret);
 		return ret;
 	}
@@ -573,7 +574,7 @@ static int iproc_adc_probe(struct platform_device *pdev)
 
 	ret = iio_device_register(indio_dev);
 	if (ret) {
-		dev_err(&pdev->dev, "iio_device_register failed:err %d\n", ret);
+		dev_err(dev, "iio_device_register failed:err %d\n", ret);
 		goto err_clk;
 	}
 
-- 
2.43.0


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

* [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
  2026-08-01  9:09 [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
  2026-08-01  9:09 ` [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
  2026-08-01  9:09 ` [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
@ 2026-08-01  9:09 ` mdshahid03
  2026-08-01 14:51   ` David Lechner
  2026-08-03 13:01   ` Markus Elfring
  2026-08-02  2:06 ` [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling Jonathan Cameron
  3 siblings, 2 replies; 10+ messages in thread
From: mdshahid03 @ 2026-08-01  9:09 UTC (permalink / raw)
  To: Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, David Lechner,
	linux-arm-kernel, linux-iio, linux-kernel, Nuno Sá, Ray Jui,
	Scott Branden, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

This simplifies the probe error handling by replacing open-coded
dev_err() and return sequences while preserving the existing
messages.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 drivers/iio/adc/bcm_iproc_adc.c | 39 +++++++++++++++------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 4acd9c3f089b..5fcd528eb88a 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -523,19 +523,16 @@ static int iproc_adc_probe(struct platform_device *pdev)
 
 	adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
 			   "adc-syscon");
-	if (IS_ERR(adc_priv->regmap)) {
-		dev_err(dev, "failed to get handle for tsc syscon\n");
-		ret = PTR_ERR(adc_priv->regmap);
-		return ret;
-	}
+	if (IS_ERR(adc_priv->regmap))
+		return dev_err_probe(dev,
+				     PTR_ERR(adc_priv->regmap),
+				     "failed to get handle for tsc syscon\n");
 
 	adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
-	if (IS_ERR(adc_priv->adc_clk)) {
-		dev_err(dev,
-			"failed getting clock tsc_clk\n");
-		ret = PTR_ERR(adc_priv->adc_clk);
-		return ret;
-	}
+	if (IS_ERR(adc_priv->adc_clk))
+		return dev_err_probe(dev,
+				     PTR_ERR(adc_priv->adc_clk),
+				     "failed getting clock tsc_clk\n");
 
 	adc_priv->irqno = platform_get_irq(pdev, 0);
 	if (adc_priv->irqno < 0)
@@ -543,10 +540,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
 
 	ret = regmap_clear_bits(adc_priv->regmap, IPROC_REGCTL2,
 				IPROC_ADC_AUXIN_SCAN_ENA);
-	if (ret) {
-		dev_err(dev, "failed to write IPROC_REGCTL2 %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev,
+				     ret,
+				     "failed to write IPROC_REGCTL2\n");
 
 	ret = devm_request_threaded_irq(dev, adc_priv->irqno,
 				iproc_adc_interrupt_handler,
@@ -556,11 +553,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	ret = clk_prepare_enable(adc_priv->adc_clk);
-	if (ret) {
-		dev_err(dev,
-			"clk_prepare_enable failed %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev,
+				     ret,
+				     "failed to enable clock\n");
 
 	ret = iproc_adc_enable(indio_dev);
 	if (ret)
@@ -574,7 +570,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
 
 	ret = iio_device_register(indio_dev);
 	if (ret) {
-		dev_err(dev, "iio_device_register failed:err %d\n", ret);
+		dev_err_probe(dev, ret,
+			      "failed to register IIO device\n");
 		goto err_clk;
 	}
 
-- 
2.43.0


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

* Re: [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer
  2026-08-01  9:09 ` [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
@ 2026-08-01 14:49   ` David Lechner
  2026-08-03 12:44   ` Markus Elfring
  1 sibling, 0 replies; 10+ messages in thread
From: David Lechner @ 2026-08-01 14:49 UTC (permalink / raw)
  To: mdshahid03, Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, linux-arm-kernel,
	linux-iio, linux-kernel, Nuno Sá, Ray Jui, Scott Branden

On 8/1/26 4:09 AM, mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> Introduce a local 'struct device *dev' variable in iproc_adc_probe()
> and use it instead of repeatedly referencing '&pdev->dev'.
> 
> This simplifies the code and makes subsequent error handling changes
> less verbose.
> 
> No functional change intended.
> 
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
>  drivers/iio/adc/bcm_iproc_adc.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index 7c2e2770cd61..4acd9c3f089b 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -506,9 +506,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  {
>  	struct iproc_adc_priv *adc_priv;
>  	struct iio_dev *indio_dev = NULL;
> +	struct device *dev = &pdev->dev;
>  	int ret;
>  
> -	indio_dev = devm_iio_device_alloc(&pdev->dev,
> +	indio_dev = devm_iio_device_alloc(dev,
>  					sizeof(*adc_priv));
>  	if (!indio_dev)
>  		return -ENOMEM;
> @@ -523,14 +524,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  	adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>  			   "adc-syscon");
>  	if (IS_ERR(adc_priv->regmap)) {
> -		dev_err(&pdev->dev, "failed to get handle for tsc syscon\n");
> +		dev_err(dev, "failed to get handle for tsc syscon\n");
>  		ret = PTR_ERR(adc_priv->regmap);
>  		return ret;
>  	}
>  
> -	adc_priv->adc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
> +	adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
>  	if (IS_ERR(adc_priv->adc_clk)) {
> -		dev_err(&pdev->dev,
> +		dev_err(dev,
>  			"failed getting clock tsc_clk\n");
>  		ret = PTR_ERR(adc_priv->adc_clk);
>  		return ret;
I imagine some, if not all, of these will fit on one line now
without going over 80 chars.

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

* Re: [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
  2026-08-01  9:09 ` [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
@ 2026-08-01 14:51   ` David Lechner
  2026-08-03 13:01   ` Markus Elfring
  1 sibling, 0 replies; 10+ messages in thread
From: David Lechner @ 2026-08-01 14:51 UTC (permalink / raw)
  To: mdshahid03, Jonathan Cameron, Andy Shevchenko
  Cc: Joshua Crofts, Broadcom internal kernel list, linux-arm-kernel,
	linux-iio, linux-kernel, Nuno Sá, Ray Jui, Scott Branden

On 8/1/26 4:09 AM, mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> This simplifies the probe error handling by replacing open-coded
> dev_err() and return sequences while preserving the existing
> messages.
> 
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
>  drivers/iio/adc/bcm_iproc_adc.c | 39 +++++++++++++++------------------
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index 4acd9c3f089b..5fcd528eb88a 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -523,19 +523,16 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  
>  	adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>  			   "adc-syscon");
> -	if (IS_ERR(adc_priv->regmap)) {
> -		dev_err(dev, "failed to get handle for tsc syscon\n");
> -		ret = PTR_ERR(adc_priv->regmap);
> -		return ret;
> -	}
> +	if (IS_ERR(adc_priv->regmap))
> +		return dev_err_probe(dev,
> +				     PTR_ERR(adc_priv->regmap),

Probably fine to put this on the same line as dev since it won't
be any longer than the text below.

> +				     "failed to get handle for tsc syscon\n");
>  
>  	adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
> -	if (IS_ERR(adc_priv->adc_clk)) {
> -		dev_err(dev,
> -			"failed getting clock tsc_clk\n");
> -		ret = PTR_ERR(adc_priv->adc_clk);
> -		return ret;
> -	}
> +	if (IS_ERR(adc_priv->adc_clk))
> +		return dev_err_probe(dev,
> +				     PTR_ERR(adc_priv->adc_clk),

same

> +				     "failed getting clock tsc_clk\n");
>  
>  	adc_priv->irqno = platform_get_irq(pdev, 0);
>  	if (adc_priv->irqno < 0)
> @@ -543,10 +540,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  
>  	ret = regmap_clear_bits(adc_priv->regmap, IPROC_REGCTL2,
>  				IPROC_ADC_AUXIN_SCAN_ENA);
> -	if (ret) {
> -		dev_err(dev, "failed to write IPROC_REGCTL2 %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev,
> +				     ret,

dev and ret should be on the same line.

> +				     "failed to write IPROC_REGCTL2\n");
>  
>  	ret = devm_request_threaded_irq(dev, adc_priv->irqno,
>  				iproc_adc_interrupt_handler,
> @@ -556,11 +553,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	ret = clk_prepare_enable(adc_priv->adc_clk);
> -	if (ret) {
> -		dev_err(dev,
> -			"clk_prepare_enable failed %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev,
> +				     ret,

same

> +				     "failed to enable clock\n");
>  
>  	ret = iproc_adc_enable(indio_dev);
>  	if (ret)
> @@ -574,7 +570,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  
>  	ret = iio_device_register(indio_dev);
>  	if (ret) {
> -		dev_err(dev, "iio_device_register failed:err %d\n", ret);
> +		dev_err_probe(dev, ret,
> +			      "failed to register IIO device\n");
>  		goto err_clk;
>  	}
>  


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

* Re: [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling
  2026-08-01  9:09 [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
                   ` (2 preceding siblings ...)
  2026-08-01  9:09 ` [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
@ 2026-08-02  2:06 ` Jonathan Cameron
  3 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2026-08-02  2:06 UTC (permalink / raw)
  To: mdshahid03
  Cc: Andy Shevchenko, Joshua Crofts, Broadcom internal kernel list,
	David Lechner, linux-arm-kernel, linux-iio, linux-kernel,
	Nuno Sá, Ray Jui, Scott Branden

On Sat,  1 Aug 2026 14:39:50 +0530
mdshahid03@gmail.com wrote:

> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> Hi,
> 
> This series simplifies the probe error handling in bcm_iproc_adc.
Hi Mohammad

See comments on v3 + slow down. It wastes your time and that of reviewers
if you post new versions too quickly.

Jonathan

> 
> Changes in v4:
> - Move the redundant iproc_adc_enable() error message removal into the
>   cleanup patch as suggested by Joshua Crofts.
> 
> Mohammad Shahid (3):
>   iio: adc: bcm_iproc_adc: Remove redundant probe error messages
>   iio: adc: bcm_iproc_adc: Introduce local device pointer
>   iio: adc: bcm_iproc_adc: Convert probe error handling to
>     dev_err_probe()
> 
>  drivers/iio/adc/bcm_iproc_adc.c | 54 +++++++++++++++------------------
>  1 file changed, 24 insertions(+), 30 deletions(-)
> 


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

* Re: [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages
  2026-08-01  9:09 ` [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
@ 2026-08-03 12:19   ` Joshua Crofts
  0 siblings, 0 replies; 10+ messages in thread
From: Joshua Crofts @ 2026-08-03 12:19 UTC (permalink / raw)
  To: mdshahid03
  Cc: Jonathan Cameron, Andy Shevchenko, Joshua Crofts,
	Broadcom internal kernel list, David Lechner, linux-arm-kernel,
	linux-iio, linux-kernel, Nuno Sá, Ray Jui, Scott Branden

On Sat,  1 Aug 2026 14:39:51 +0530
mdshahid03@gmail.com wrote:

> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> devm_request_threaded_irq() already logs an error when the request
> fails, making the explicit dev_err() redundant.
> 
> Similarly, iproc_adc_enable() already reports failures, making the
> additional dev_err() in the probe path redundant.
> 
> Remove both duplicate messages.
> 
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
>  drivers/iio/adc/bcm_iproc_adc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index cf4738b16e62..7c2e2770cd61 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -551,10 +551,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  				iproc_adc_interrupt_handler,
>  				iproc_adc_interrupt_thread,
>  				IRQF_SHARED, "iproc-adc", indio_dev);
> -	if (ret) {
> -		dev_err(&pdev->dev, "request_irq error %d\n", ret);
> +	if (ret)
>  		return ret;
> -	}
>  
>  	ret = clk_prepare_enable(adc_priv->adc_clk);
>  	if (ret) {
> @@ -564,10 +562,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = iproc_adc_enable(indio_dev);
> -	if (ret) {
> -		dev_err(&pdev->dev, "failed to enable adc %d\n", ret);
> +	if (ret)
>  		goto err_adc_enable;
> -	}
>  
>  	indio_dev->name = "iproc-static-adc";
>  	indio_dev->info = &iproc_adc_iio_info;

This is good.

Side note - I noticed that you added the email joshua.crofts@broadcom.com to the
Cc list, however I don't work at Broadcom - there must've been a mixup when you
were Ccing people as I only use the address this meesage is sent from.

Thanks.

-- 
Kind regards,
Joshua Crofts

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

* Re: [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer
  2026-08-01  9:09 ` [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
  2026-08-01 14:49   ` David Lechner
@ 2026-08-03 12:44   ` Markus Elfring
  1 sibling, 0 replies; 10+ messages in thread
From: Markus Elfring @ 2026-08-03 12:44 UTC (permalink / raw)
  To: Mohammad Shahid, linux-iio, bcm-kernel-feedback-list,
	linux-arm-kernel, Andy Shevchenko, Jonathan Cameron
  Cc: LKML, David Lechner, Joshua Crofts, Nuno Sá, Ray Jui,
	Scott Branden

…
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -506,9 +506,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  {
>  	struct iproc_adc_priv *adc_priv;
>  	struct iio_dev *indio_dev = NULL;
> +	struct device *dev = &pdev->dev;
>  	int ret;
>  
> -	indio_dev = devm_iio_device_alloc(&pdev->dev,
> +	indio_dev = devm_iio_device_alloc(dev,
>  					sizeof(*adc_priv));
…

Would an other adjustment be a bit nicer?

+	indio_dev = devm_iio_device_alloc(dev, sizeof(*adc_priv));


…
> @@ -523,14 +524,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
>  	adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>  			   "adc-syscon");
>  	if (IS_ERR(adc_priv->regmap)) {
> -		dev_err(&pdev->dev, "failed to get handle for tsc syscon\n");
> +		dev_err(dev, "failed to get handle for tsc syscon\n");
>  		ret = PTR_ERR(adc_priv->regmap);
>  		return ret;
>  	}
…

Can further source code refinements become helpful here?

Regards,
Markus

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

* Re: [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
  2026-08-01  9:09 ` [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
  2026-08-01 14:51   ` David Lechner
@ 2026-08-03 13:01   ` Markus Elfring
  1 sibling, 0 replies; 10+ messages in thread
From: Markus Elfring @ 2026-08-03 13:01 UTC (permalink / raw)
  To: Mohammad Shahid, linux-iio, bcm-kernel-feedback-list,
	linux-arm-kernel, Andy Shevchenko, Jonathan Cameron
  Cc: LKML, David Lechner, Nuno Sá, Ray Jui, Scott Branden

> This simplifies the probe error handling by replacing open-coded
> dev_err() and return sequences while preserving the existing
> messages.

See also once more:
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2-rc6#n94

* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2-rc6#n669


Regards,
Markus


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

end of thread, other threads:[~2026-08-03 13:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-01  9:09 [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling mdshahid03
2026-08-01  9:09 ` [PATCH v4 1/3] iio: adc: bcm_iproc_adc: Remove redundant probe error messages mdshahid03
2026-08-03 12:19   ` Joshua Crofts
2026-08-01  9:09 ` [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer mdshahid03
2026-08-01 14:49   ` David Lechner
2026-08-03 12:44   ` Markus Elfring
2026-08-01  9:09 ` [PATCH v4 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe() mdshahid03
2026-08-01 14:51   ` David Lechner
2026-08-03 13:01   ` Markus Elfring
2026-08-02  2:06 ` [PATCH v4 0/3] iio: adc: bcm_iproc_adc: Simplify probe error handling Jonathan Cameron

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.