hal-api: power: Use usage_count to support multiple call accepted/tizen/6.5/unified/20211028.115016 accepted/tizen/unified/20210929.022354 submit/tizen/20210928.093203 submit/tizen_6.5/20211028.163201 tizen_6.5.m2_release
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 28 Sep 2021 07:20:40 +0000 (16:20 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 28 Sep 2021 09:31:32 +0000 (18:31 +0900)
commit48e61a5b6c15e1d2bf75d2f15142b50fb30c2b7e
treec9ca0eee5f4e99c1780587992f17c807e8d49d4f
parentbf1745ad2cb4735d9f7410c7634aeaa2a5cb6135
hal-api: power: Use usage_count to support multiple call

The user of hal-api-power such as PASS daemon can execute
the hal_power_get_backend and hal_power_put_backend at multiple times.

Until now, hal-api-power doesn't support the multiple function call
of hal_power_get_backend/put_backend. It cause that return error value
when calling hal_power_put_backend from user of hal-api-power.

In order to fix this issue, use usage_count to put the hal backend
when usage_count is zero.

Change-Id: Idc1aef66e09e335cc158ace4c359673ff45792b8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal-api-power.c