* [PATCH] regulator: ltc3589: Make IRQ optional
@ 2016-02-09 20:14 Bernhard Walle
2016-02-10 9:44 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Walle @ 2016-02-09 20:14 UTC (permalink / raw)
To: lgirdwood, broonie; +Cc: linux-kernel, p.zabel, 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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: ltc3589: Make IRQ optional
2016-02-09 20:14 [PATCH] regulator: ltc3589: Make IRQ optional Bernhard Walle
@ 2016-02-10 9:44 ` Philipp Zabel
2016-02-10 20:36 ` Bernhard Walle
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2016-02-10 9:44 UTC (permalink / raw)
To: Bernhard Walle; +Cc: lgirdwood, broonie, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: ltc3589: Make IRQ optional
2016-02-10 9:44 ` Philipp Zabel
@ 2016-02-10 20:36 ` Bernhard Walle
0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2016-02-10 20:36 UTC (permalink / raw)
To: Philipp Zabel; +Cc: lgirdwood, broonie, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-10 20:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 20:14 [PATCH] regulator: ltc3589: Make IRQ optional Bernhard Walle
2016-02-10 9:44 ` Philipp Zabel
2016-02-10 20:36 ` Bernhard Walle
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.