From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 4/6] shared/ad: Make bt_ad_has_data return the data
Date: Thu, 15 Jan 2026 15:54:05 -0500 [thread overview]
Message-ID: <20260115205408.1554101-4-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20260115205408.1554101-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes bt_ad_has_data return the data found rather then true of
false.
---
src/device.c | 2 +-
src/shared/ad.c | 9 +++++----
src/shared/ad.h | 3 ++-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/device.c b/src/device.c
index 0842becde195..af8df5f29b97 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1616,7 +1616,7 @@ dev_property_advertising_data_exist(const GDBusPropertyTable *property,
{
struct btd_device *device = data;
- return bt_ad_has_data(device->ad, NULL);
+ return bt_ad_has_data(device->ad, NULL) ? TRUE : FALSE;
}
static bool device_get_wake_support(struct btd_device *device)
diff --git a/src/shared/ad.c b/src/shared/ad.c
index 9e21cbf61a29..ac238014bcea 100644
--- a/src/shared/ad.c
+++ b/src/shared/ad.c
@@ -1229,6 +1229,9 @@ static bool data_match(const void *data, const void *user_data)
const struct bt_ad_data *d1 = data;
const struct bt_ad_data *d2 = user_data;
+ if (!d2)
+ return true;
+
if (d1->type != d2->type)
return false;
@@ -1241,14 +1244,12 @@ static bool data_match(const void *data, const void *user_data)
return !memcmp(d1->data, d2->data, d1->len);
}
-bool bt_ad_has_data(struct bt_ad *ad, const struct bt_ad_data *data)
+struct bt_ad_data *bt_ad_has_data(struct bt_ad *ad,
+ const struct bt_ad_data *data)
{
if (!ad)
return false;
- if (!data)
- return !queue_isempty(ad->data);
-
return queue_find(ad->data, data_match, data);
}
diff --git a/src/shared/ad.h b/src/shared/ad.h
index 7c5d94db0458..71be8727b372 100644
--- a/src/shared/ad.h
+++ b/src/shared/ad.h
@@ -174,7 +174,8 @@ void bt_ad_clear_flags(struct bt_ad *ad);
bool bt_ad_add_data(struct bt_ad *ad, uint8_t type, void *data, size_t len);
-bool bt_ad_has_data(struct bt_ad *ad, const struct bt_ad_data *data);
+struct bt_ad_data *bt_ad_has_data(struct bt_ad *ad,
+ const struct bt_ad_data *data);
void bt_ad_foreach_data(struct bt_ad *ad, bt_ad_func_t func, void *user_data);
--
2.52.0
next prev parent reply other threads:[~2026-01-15 20:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 20:54 [PATCH BlueZ v2 1/6] shared/crypto: Add bt_crypto_rsi Luiz Augusto von Dentz
2026-01-15 20:54 ` [PATCH BlueZ v2 2/6] advertising: Use bt_crypto_rsi to generate RSI Luiz Augusto von Dentz
2026-01-15 20:54 ` [PATCH BlueZ v2 3/6] advtest: " Luiz Augusto von Dentz
2026-01-15 20:54 ` Luiz Augusto von Dentz [this message]
2026-01-15 20:54 ` [PATCH BlueZ v2 5/6] advertising: Fix not verifying if RSI set is valid Luiz Augusto von Dentz
2026-01-15 20:54 ` [PATCH BlueZ v2 6/6] advtest: Fix displaying RSI as a byte array rather then an address Luiz Augusto von Dentz
2026-01-15 21:48 ` [BlueZ,v2,1/6] shared/crypto: Add bt_crypto_rsi bluez.test.bot
2026-01-15 22:40 ` [PATCH BlueZ v2 1/6] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260115205408.1554101-4-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox