Skip to content

Commit

Permalink
smb347-charger: Move IRQ enabling to the end of probe
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
  • Loading branch information
Mika Westerberg authored and Anton Vorontsov committed May 5, 2012
1 parent 055d7f0 commit d72bade
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/power/smb347-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,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;
Expand Down Expand Up @@ -1241,6 +1237,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);
}
}

Expand Down

0 comments on commit d72bade

Please sign in to comment.