diff mbox series

[BlueZ,1/1] refactor bearer connected test

Message ID 20240404183050.334414-2-dimitris.on.linux@gmail.com (mailing list archive)
State Accepted
Commit 036583f9bbec8540fbd85b980674aad4916d3093
Headers show
Series V3: Fix busy loop when disabling BT | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Dimitris April 4, 2024, 6:30 p.m. UTC
---
 src/adapter.c | 2 +-
 src/device.c  | 7 ++++++-
 src/device.h  | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com April 4, 2024, 8:07 p.m. UTC | #1
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=841538

---Test result---

Test Summary:
CheckPatch                    PASS      0.29 seconds
GitLint                       PASS      0.21 seconds
BuildEll                      PASS      25.69 seconds
BluezMake                     PASS      1667.53 seconds
MakeCheck                     PASS      13.17 seconds
MakeDistcheck                 PASS      178.45 seconds
CheckValgrind                 PASS      247.55 seconds
CheckSmatch                   PASS      351.41 seconds
bluezmakeextell               PASS      119.51 seconds
IncrementalBuild              PASS      1690.57 seconds
ScanBuild                     PASS      1063.67 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 4bcc464de..017e60233 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7486,7 +7486,7 @@  static void adapter_remove_connection(struct btd_adapter *adapter,
 		device_cancel_authentication(device, TRUE);
 
 	/* If another bearer is still connected */
-	if (btd_device_is_connected(device))
+	if (btd_device_bearer_is_connected(device))
 		return;
 
 	adapter->connections = g_slist_remove(adapter->connections, device);
diff --git a/src/device.c b/src/device.c
index 5e74633c6..74dd67a09 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3273,13 +3273,18 @@  uint8_t btd_device_get_bdaddr_type(struct btd_device *dev)
 
 bool btd_device_is_connected(struct btd_device *dev)
 {
-	if (dev->bredr_state.connected || dev->le_state.connected)
+	if (btd_device_bearer_is_connected(dev))
 		return true;
 
 	return find_service_with_state(dev->services,
 						BTD_SERVICE_STATE_CONNECTED);
 }
 
+bool btd_device_bearer_is_connected(struct btd_device *dev)
+{
+	return dev->bredr_state.connected || dev->le_state.connected;
+}
+
 static void clear_temporary_timer(struct btd_device *dev)
 {
 	if (dev->temporary_timer) {
diff --git a/src/device.h b/src/device.h
index d4e70b7ef..5722ca9ca 100644
--- a/src/device.h
+++ b/src/device.h
@@ -104,6 +104,7 @@  void device_set_rssi(struct btd_device *device, int8_t rssi);
 void device_set_tx_power(struct btd_device *device, int8_t tx_power);
 void device_set_flags(struct btd_device *device, uint8_t flags);
 bool btd_device_is_connected(struct btd_device *dev);
+bool btd_device_bearer_is_connected(struct btd_device *dev);
 uint8_t btd_device_get_bdaddr_type(struct btd_device *dev);
 bool device_is_retrying(struct btd_device *device);
 void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,