diff mbox series

[BlueZ,1/4] shared/gatt-db: Make gatt_db_attribute_get_value public

Message ID 20230324233856.3693370-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 7610b9264147c387e0c12d17221ae83f97add776
Headers show
Series [BlueZ,1/4] shared/gatt-db: Make gatt_db_attribute_get_value public | 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 warning CheckSparse WARNING monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1799:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3551:52: warning: array of flexible structuresmonitor/bt.h:3539:40: warning: array of flexible structures
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz March 24, 2023, 11:38 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes gatt_db_attribute_get_value public so it can be used by the
likes of btmon.
---
 src/shared/gatt-db.c | 12 ++++++------
 src/shared/gatt-db.h |  2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

Comments

bluez.test.bot@gmail.com March 25, 2023, 2:27 a.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=733736

---Test result---

Test Summary:
CheckPatch                    PASS      2.00 seconds
GitLint                       PASS      1.35 seconds
BuildEll                      PASS      26.61 seconds
BluezMake                     PASS      775.64 seconds
MakeCheck                     PASS      11.40 seconds
MakeDistcheck                 PASS      150.29 seconds
CheckValgrind                 PASS      242.80 seconds
CheckSmatch                   WARNING   324.85 seconds
bluezmakeextell               PASS      98.44 seconds
IncrementalBuild              PASS      2446.98 seconds
ScanBuild                     PASS      960.47 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1799:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3551:52: warning: array of flexible structuresmonitor/bt.h:3539:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 27, 2023, 9:20 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 24 Mar 2023 16:38:53 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This makes gatt_db_attribute_get_value public so it can be used by the
> likes of btmon.
> ---
>  src/shared/gatt-db.c | 12 ++++++------
>  src/shared/gatt-db.h |  2 ++
>  2 files changed, 8 insertions(+), 6 deletions(-)

Here is the summary with links:
  - [BlueZ,1/4] shared/gatt-db: Make gatt_db_attribute_get_value public
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7610b9264147
  - [BlueZ,2/4] monitor/att: Print value when printing descriptors
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=cf7242815668
  - [BlueZ,3/4] monitor/att: Fix not loading gatt_db for devices using RPA
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2719bb5aaf6d
  - [BlueZ,4/4] monitor: Cache IRK being parsed
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=011e562a98a8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index b696fe33da93..676f963eca94 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1549,7 +1549,7 @@  static int gatt_db_attribute_get_index(const struct gatt_db_attribute *attrib)
 	return -1;
 }
 
-static struct gatt_db_attribute *
+struct gatt_db_attribute *
 gatt_db_attribute_get_value(struct gatt_db_attribute *attrib)
 {
 	struct gatt_db_service *service;
@@ -1559,18 +1559,18 @@  gatt_db_attribute_get_value(struct gatt_db_attribute *attrib)
 		return NULL;
 
 	index = gatt_db_attribute_get_index(attrib);
-	if (index < 0)
+	if (index <= 0)
 		return NULL;
 
 	service = attrib->service;
 
 	if (!bt_uuid_cmp(&characteristic_uuid, &attrib->uuid))
-		index++;
-	else if (bt_uuid_cmp(&characteristic_uuid,
+		return service->attributes[index + 1];
+	else if (!bt_uuid_cmp(&characteristic_uuid,
 				&service->attributes[index - 1]->uuid))
-		return NULL;
+		return service->attributes[index];
 
-	return service->attributes[index];
+	return gatt_db_attribute_get_value(service->attributes[index - 1]);
 }
 
 void gatt_db_service_foreach_desc(struct gatt_db_attribute *attrib,
diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h
index 163a981df233..fb939e40d40e 100644
--- a/src/shared/gatt-db.h
+++ b/src/shared/gatt-db.h
@@ -284,6 +284,8 @@  bool gatt_db_attribute_write(struct gatt_db_attribute *attrib, uint16_t offset,
 bool gatt_db_attribute_write_result(struct gatt_db_attribute *attrib,
 						unsigned int id, int err);
 
+struct gatt_db_attribute *
+gatt_db_attribute_get_value(struct gatt_db_attribute *attrib);
 struct gatt_db_attribute *
 gatt_db_attribute_get_ccc(struct gatt_db_attribute *attrib);