linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v6 17/57] hwmon: Remove dev_err() usage after platform_get_irq()
@ 2019-07-30 18:44 Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-07-30 18:44 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-kernel, Jean Delvare, linux-hwmon, Greg Kroah-Hartman

On Tue, Jul 30, 2019 at 11:15:17AM -0700, Stephen Boyd wrote:
> We don't need dev_err() messages when platform_get_irq() fails now that
> platform_get_irq() prints an error message itself when something goes
> wrong. Let's remove these prints with a simple semantic patch.
> 
> // <smpl>
> @@
> expression ret;
> struct platform_device *E;
> @@
> 
> ret =
> (
> platform_get_irq(E, ...)
> |
> platform_get_irq_byname(E, ...)
> );
> 
> if ( \( ret < 0 \| ret <= 0 \) )
> {
> (
> -if (ret != -EPROBE_DEFER)
> -{ ...
> -dev_err(...);
> -... }
> |
> ...
> -dev_err(...);
> )
> ...
> }
> // </smpl>
> 
> While we're here, remove braces on if statements that only have one
> statement (manually).
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>

Applied to hwmon-next.

Guenter

> ---
> 
> Please apply directly to subsystem trees
> 
>  drivers/hwmon/jz4740-hwmon.c    | 5 +----
>  drivers/hwmon/npcm750-pwm-fan.c | 4 +---
>  2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c
> index bec5befd1d8b..47bed41b55a1 100644
> --- a/drivers/hwmon/jz4740-hwmon.c
> +++ b/drivers/hwmon/jz4740-hwmon.c
> @@ -93,11 +93,8 @@ static int jz4740_hwmon_probe(struct platform_device *pdev)
>  	hwmon->cell = mfd_get_cell(pdev);
>  
>  	hwmon->irq = platform_get_irq(pdev, 0);
> -	if (hwmon->irq < 0) {
> -		dev_err(&pdev->dev, "Failed to get platform irq: %d\n",
> -			hwmon->irq);
> +	if (hwmon->irq < 0)
>  		return hwmon->irq;
> -	}
>  
>  	hwmon->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(hwmon->base))
> diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
> index 09aaefa6fdb8..11a28609da3c 100644
> --- a/drivers/hwmon/npcm750-pwm-fan.c
> +++ b/drivers/hwmon/npcm750-pwm-fan.c
> @@ -967,10 +967,8 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
>  		spin_lock_init(&data->fan_lock[i]);
>  
>  		data->fan_irq[i] = platform_get_irq(pdev, i);
> -		if (data->fan_irq[i] < 0) {
> -			dev_err(dev, "get IRQ fan%d failed\n", i);
> +		if (data->fan_irq[i] < 0)
>  			return data->fan_irq[i];
> -		}
>  
>  		sprintf(name, "NPCM7XX-FAN-MD%d", i);
>  		ret = devm_request_irq(dev, data->fan_irq[i], npcm7xx_fan_isr,
> -- 
> Sent by a computer through tubes
> 

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

* [PATCH v6 17/57] hwmon: Remove dev_err() usage after platform_get_irq()
  2019-07-30 18:15 [PATCH v6 00/57] Add error message to platform_get_irq*() Stephen Boyd
@ 2019-07-30 18:15 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2019-07-30 18:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jean Delvare, Guenter Roeck, linux-hwmon, Greg Kroah-Hartman

We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

Please apply directly to subsystem trees

 drivers/hwmon/jz4740-hwmon.c    | 5 +----
 drivers/hwmon/npcm750-pwm-fan.c | 4 +---
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c
index bec5befd1d8b..47bed41b55a1 100644
--- a/drivers/hwmon/jz4740-hwmon.c
+++ b/drivers/hwmon/jz4740-hwmon.c
@@ -93,11 +93,8 @@ static int jz4740_hwmon_probe(struct platform_device *pdev)
 	hwmon->cell = mfd_get_cell(pdev);
 
 	hwmon->irq = platform_get_irq(pdev, 0);
-	if (hwmon->irq < 0) {
-		dev_err(&pdev->dev, "Failed to get platform irq: %d\n",
-			hwmon->irq);
+	if (hwmon->irq < 0)
 		return hwmon->irq;
-	}
 
 	hwmon->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hwmon->base))
diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
index 09aaefa6fdb8..11a28609da3c 100644
--- a/drivers/hwmon/npcm750-pwm-fan.c
+++ b/drivers/hwmon/npcm750-pwm-fan.c
@@ -967,10 +967,8 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
 		spin_lock_init(&data->fan_lock[i]);
 
 		data->fan_irq[i] = platform_get_irq(pdev, i);
-		if (data->fan_irq[i] < 0) {
-			dev_err(dev, "get IRQ fan%d failed\n", i);
+		if (data->fan_irq[i] < 0)
 			return data->fan_irq[i];
-		}
 
 		sprintf(name, "NPCM7XX-FAN-MD%d", i);
 		ret = devm_request_irq(dev, data->fan_irq[i], npcm7xx_fan_isr,
-- 
Sent by a computer through tubes


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

end of thread, other threads:[~2019-07-30 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 18:44 [PATCH v6 17/57] hwmon: Remove dev_err() usage after platform_get_irq() Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2019-07-30 18:15 [PATCH v6 00/57] Add error message to platform_get_irq*() Stephen Boyd
2019-07-30 18:15 ` [PATCH v6 17/57] hwmon: Remove dev_err() usage after platform_get_irq() Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).