lkml.org 
[lkml]   [2012]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] power-supply: smb347-charger: move IRQ enabling to the end of probe
Date
There is a potential problem if we call smb347_irq_enable() from
smb347_irq_init() because smb347_irq_enable() makes the device registers
read-only once it returns and smb347_irq_init() expects them to still be
read-write. Currently no harm happens because it is the last call we make in
smb347_irq_init().

Anyway a better place for enabling IRQs is at the end of probe function and
this is also symmetric to call smb347_irq_disable() which is done at the
beginning of remove function.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/power/smb347-charger.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c
index d774fd3..781c058 100644
--- a/drivers/power/smb347-charger.c
+++ b/drivers/power/smb347-charger.c
@@ -923,10 +923,6 @@ static int smb347_irq_init(struct smb347_charger *smb)
if (ret < 0)
goto fail_readonly;

- ret = smb347_irq_enable(smb);
- if (ret < 0)
- goto fail_readonly;
-
smb347_set_writable(smb, false);
smb->client->irq = irq;
return 0;
@@ -1233,6 +1229,8 @@ static int smb347_probe(struct i2c_client *client,
if (ret < 0) {
dev_warn(dev, "failed to initialize IRQ: %d\n", ret);
dev_warn(dev, "disabling IRQ support\n");
+ } else {
+ smb347_irq_enable(smb);
}
}

--
1.7.9.1


\
 
 \ /
  Last update: 2012-04-16 10:51    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site