Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

smb347-charger: Move IRQ enabling to the end of probe

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>

authored by

Mika Westerberg and committed by
Anton Vorontsov
d72bade7 055d7f0f

+2 -4
+2 -4
drivers/power/smb347-charger.c
··· 925 925 if (ret < 0) 926 926 goto fail_readonly; 927 927 928 - ret = smb347_irq_enable(smb); 929 - if (ret < 0) 930 - goto fail_readonly; 931 - 932 928 smb347_set_writable(smb, false); 933 929 smb->client->irq = irq; 934 930 return 0; ··· 1237 1241 if (ret < 0) { 1238 1242 dev_warn(dev, "failed to initialize IRQ: %d\n", ret); 1239 1243 dev_warn(dev, "disabling IRQ support\n"); 1244 + } else { 1245 + smb347_irq_enable(smb); 1240 1246 } 1241 1247 } 1242 1248