power: qpnp-bms: use a separate flag to indicate registration

The current code uses the name of the bms power supply to indicate that
it is successfully registered. There is a time window where the name is
set but bms power supply is not registered. Interrupts executing during
this time window will call power supply apis on the bms power supply
since they see the name member initialized. These api calls on a non
registered power supply causes errors, most notably

[] (__queue_work+0x2b8/0x42c) from [] (queue_work_on+0x3c/0x44)
[] (queue_work_on+0x3c/0x44) from [] (queue_work+0x24/0x58)
[] (queue_work+0x24/0x58) from [] (btm_notify_vbat+0xb0/0x534)
[] (btm_notify_vbat+0xb0/0x534) from [] (notify_adc_tm_fn+0x98/0x154)
[] (notify_adc_tm_fn+0x98/0x154) from [] (process_one_work+0x12c/0x4b4)
[] (process_one_work+0x12c/0x4b4) from [] (worker_thread+0x160/0x3d4)
[] (worker_thread+0x160/0x3d4) from [] (kthread+0x84/0x90)
[] (kthread+0x84/0x90) from [] (kernel_thread_exit+0x0/0x8)

Update the code to not use name member and create a separate boolean to
indicate bms power supply is successfully registered.

Change-Id: I09c1d848096f4bd5de4ee4be1e0edeb100bf6113
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed