regulator: ltc3589: Make IRQ optional
PATCH 1/1 regulator: ltc3589: Make IRQ optional
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.
--- drivers/regulator/ltc3589.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/regulator/ltc3589.c +8 -6
@@ -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 ;
Signature · 1 line
2.7.1
Am Dienstag, den 09.02.2016, 21:14 +0100 schrieb Bernhard Walle:
Quoted 6 lines
It's perfectly valid to use the LTC3589 without an interrupt pin connected to it. Currently, the driver probing fails when
client->irqis 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 <[email protected]>
I suggest these small changes:
[...]
drivers/regulator/ltc3589.c static int ltc3589_probe(struct i2c_client *client, · line 523
Quoted 11 lines
drivers/regulator/ltc3589.c +1
-6@@ -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 ...
drivers/regulator/ltc3589.c static int ltc3589_probe(struct i2c_client *client, · line 524
Quoted 1 line
drivers/regulator/ltc3589.c +1
-0+ ret = devm_request_threaded_irq(dev, client->irq, NULL, ltc3589_isr,
... and reflowing this ...
drivers/regulator/ltc3589.c static int ltc3589_probe(struct i2c_client *client, · line 528
Quoted 4 lines
drivers/regulator/ltc3589.c +4
-0+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
Hi,
thanks for the review!
Am 10.02.2016 10:44, schrieb Philipp Zabel:
Quoted 7 lines
drivers/regulator/ltc3589.c static int ltc3589_probe(struct i2c_client *client, · line 528
Quoted 5 lines
drivers/regulator/ltc3589.c +4
-0+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