adapter: Remove temporary devices before power off
authorArchie Pusaka <apusaka@chromium.org>
Wed, 6 Jan 2021 09:26:58 +0000 (17:26 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:34 +0000 (19:08 +0530)
commitaa299fe07e78eeea422c43035be0c2a65f9aa7c0
tree41b9aea8bc22df72d00e81a6d091d5862f99f15e
parent95229d0ba4e09444ef40d784b5308e725380f35c
adapter: Remove temporary devices before power off

If adapter is powered off when a currently connected device is
being removed, there is a possibility that we haven't finish waiting
for the disconnection but the adapter is already powered down.

When this happens, the kernel would fail to clean the device's
information, for example the pairing information. This causes
disagreement between the user space and the kernel about whether the
device is already paired, because the device is successfully removed
from the user space's perspective.

This patch enforces the removal of such devices before allowing the
adapter to power off.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adapter.c