* [PATCH v5] device: Remove device after all bearers are disconnected
@ 2024-09-29 2:22 Cheng Jiang
2024-09-29 4:07 ` [v5] " bluez.test.bot
2024-09-30 19:50 ` [PATCH v5] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Cheng Jiang @ 2024-09-29 2:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: quic_jiaymao
For a dual-mode remote, both BR/EDR and BLE may be connected,
RemoveDevice should be handled after all bearers are disconnects.
Otherwise, if msg is removed, but not all connection are dropped,
this function returns before *remove is updated, then after all
connections are dropped, but device->disconnects is NULL,
remove_device is not updated. Consequently *remove is not set to
true. Remove device is not performed in adapter_remove_connection.
---
src/device.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/device.c b/src/device.c
index f8f61e643..7585184de 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3488,18 +3488,6 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type,
device->connect = NULL;
}
- while (device->disconnects) {
- DBusMessage *msg = device->disconnects->data;
-
- if (dbus_message_is_method_call(msg, ADAPTER_INTERFACE,
- "RemoveDevice"))
- remove_device = true;
-
- g_dbus_send_reply(dbus_conn, msg, DBUS_TYPE_INVALID);
- device->disconnects = g_slist_remove(device->disconnects, msg);
- dbus_message_unref(msg);
- }
-
/* Check paired status of both bearers since it's possible to be
* paired but not connected via link key to LTK conversion.
*/
@@ -3539,6 +3527,19 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type,
g_dbus_emit_property_changed(dbus_conn, device->path,
DEVICE_INTERFACE, "Connected");
+ /* remove device only if both bearers are disconnected */
+ while (device->disconnects) {
+ DBusMessage *msg = device->disconnects->data;
+
+ if (dbus_message_is_method_call(msg, ADAPTER_INTERFACE,
+ "RemoveDevice"))
+ remove_device = true;
+
+ g_dbus_send_reply(dbus_conn, msg, DBUS_TYPE_INVALID);
+ device->disconnects = g_slist_remove(device->disconnects, msg);
+ dbus_message_unref(msg);
+ }
+
if (remove_device)
*remove = remove_device;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [v5] device: Remove device after all bearers are disconnected
2024-09-29 2:22 [PATCH v5] device: Remove device after all bearers are disconnected Cheng Jiang
@ 2024-09-29 4:07 ` bluez.test.bot
2024-09-30 19:50 ` [PATCH v5] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-09-29 4:07 UTC (permalink / raw)
To: linux-bluetooth, quic_chejiang
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=893665
---Test result---
Test Summary:
CheckPatch PASS 0.39 seconds
GitLint PASS 0.26 seconds
BuildEll PASS 24.01 seconds
BluezMake PASS 1596.11 seconds
MakeCheck PASS 12.94 seconds
MakeDistcheck PASS 176.72 seconds
CheckValgrind PASS 252.22 seconds
CheckSmatch PASS 352.81 seconds
bluezmakeextell PASS 117.37 seconds
IncrementalBuild PASS 1490.21 seconds
ScanBuild PASS 1024.31 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5] device: Remove device after all bearers are disconnected
2024-09-29 2:22 [PATCH v5] device: Remove device after all bearers are disconnected Cheng Jiang
2024-09-29 4:07 ` [v5] " bluez.test.bot
@ 2024-09-30 19:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-09-30 19:50 UTC (permalink / raw)
To: Cheng Jiang; +Cc: linux-bluetooth, quic_jiaymao
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sun, 29 Sep 2024 10:22:56 +0800 you wrote:
> For a dual-mode remote, both BR/EDR and BLE may be connected,
> RemoveDevice should be handled after all bearers are disconnects.
> Otherwise, if msg is removed, but not all connection are dropped,
> this function returns before *remove is updated, then after all
> connections are dropped, but device->disconnects is NULL,
> remove_device is not updated. Consequently *remove is not set to
> true. Remove device is not performed in adapter_remove_connection.
>
> [...]
Here is the summary with links:
- [v5] device: Remove device after all bearers are disconnected
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=38734e020513
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-30 19:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 2:22 [PATCH v5] device: Remove device after all bearers are disconnected Cheng Jiang
2024-09-29 4:07 ` [v5] " bluez.test.bot
2024-09-30 19:50 ` [PATCH v5] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox