power: qpnp-bms: fix unbalanced IRQ enables

After a previous patch, the BMS driver's sw_cc_thr and ocv_thr IRQs were
being enabled twice, causing a warning in the kernel log. This happened
because the bms_irq_disable function was being called after the BMS
driver found the IRQ number but before it was requested.

Disabling the IRQs from the bms driver before they were requested
resulted in a situation where the BMS thinks that the IRQs are disabled
but the request function had reset the IRQs so that they were enabled
once again.

Fix this by adding a ready bit to the bms_irq struct and setting it
after the devm_request_irq call. If an IRQ is not ready, then do not
enable or disable it.

Change-Id: I52dfbe6c21b8c5cadf60874beab0fe1a4ec7a63f
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
1 file changed