Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330632 > unrolled thread

[PATCH] regulator: ltc3589: Make IRQ optional

Started byBernhard Walle <bernhard@bwalle.de>
First post2016-02-09 21:20 +0100
Last post2016-02-10 21:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] regulator: ltc3589: Make IRQ optional Bernhard Walle <bernhard@bwalle.de> - 2016-02-09 21:20 +0100
    Re: [PATCH] regulator: ltc3589: Make IRQ optional Philipp Zabel <p.zabel@pengutronix.de> - 2016-02-10 10:50 +0100
      Re: [PATCH] regulator: ltc3589: Make IRQ optional Bernhard Walle <bernhard@bwalle.de> - 2016-02-10 21:40 +0100

#1330632 — [PATCH] regulator: ltc3589: Make IRQ optional

FromBernhard Walle <bernhard@bwalle.de>
Date2016-02-09 21:20 +0100
Subject[PATCH] regulator: ltc3589: Make IRQ optional
Message-ID<r0mVt-wW-31@gated-at.bofh.it>
It's perfectly valid to use the LTC3589 without an interrupt pin
connected to it. Currently, the driver probing fails when client->irq
is 0 (which means "no interrupt"). Don't register the interrupt
handler in that case but successfully finish the device probing instead.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
 drivers/regulator/ltc3589.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c
index 972c386..f2149d07 100644
--- a/drivers/regulator/ltc3589.c
+++ b/drivers/regulator/ltc3589.c
@@ -520,12 +520,14 @@ static int ltc3589_probe(struct i2c_client *client,
 		}
 	}
 
-	ret = devm_request_threaded_irq(dev, client->irq, NULL, ltc3589_isr,
-					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-					client->name, ltc3589);
-	if (ret) {
-		dev_err(dev, "Failed to request IRQ: %d\n", ret);
-		return ret;
+	if (client->irq != 0) {
+		ret = devm_request_threaded_irq(dev, client->irq, NULL, ltc3589_isr,
+						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+						client->name, ltc3589);
+		if (ret) {
+			dev_err(dev, "Failed to request IRQ %d: %d\n", client->irq, ret);
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.7.1

[toc] | [next] | [standalone]


#1330974

FromPhilipp Zabel <p.zabel@pengutronix.de>
Date2016-02-10 10:50 +0100
Message-ID<r0zzk-sv-13@gated-at.bofh.it>
In reply to#1330632
Am Dienstag, den 09.02.2016, 21:14 +0100 schrieb Bernhard Walle:
> It's perfectly valid to use the LTC3589 without an interrupt pin
> connected to it. Currently, the driver probing fails when client->irq
> is 0 (which means "no interrupt"). Don't register the interrupt
> handler in that case but successfully finish the device probing instead.
> 
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

I suggest these small changes:

[...]
> @@ -520,12 +520,14 @@ static int ltc3589_probe(struct i2c_client *client,
>  		}
>  	}
>  
> -	ret = devm_request_threaded_irq(dev, client->irq, NULL, ltc3589_isr,
> -					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> -					client->name, ltc3589);
> -	if (ret) {
> -		dev_err(dev, "Failed to request IRQ: %d\n", ret);
> -		return ret;
> +	if (client->irq != 0) {

How about using
	if (client->irq) {
here ...

> +		ret = devm_request_threaded_irq(dev, client->irq, NULL, ltc3589_isr,

... and reflowing this ...

> +						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> +						client->name, ltc3589);
> +		if (ret) {
> +			dev_err(dev, "Failed to request IRQ %d: %d\n", client->irq, ret);

... and this long line.

regards
Philipp

[toc] | [prev] | [next] | [standalone]


#1331475

FromBernhard Walle <bernhard@bwalle.de>
Date2016-02-10 21:40 +0100
Message-ID<r0JIl-79h-1@gated-at.bofh.it>
In reply to#1330974
Hi,

thanks for the review!

Am 10.02.2016 10:44, schrieb Philipp Zabel:
> 
>> +						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
>> +						client->name, ltc3589);
>> +		if (ret) {
>> +			dev_err(dev, "Failed to request IRQ %d: %d\n", client->irq, ret);
> 
> ... and this long line.

This was actually a mistake because I added the IRQ number to debug my 
problem.

Will send an updated version of the patch just now.


Regards,
Bernhard

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web