aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-01-05 14:59:53 -0800
committerMarcel Holtmann <marcel@holtmann.org>2022-01-06 14:57:09 +0100
commit72279d17df54d5e4e7910b39c61a3f3464e36633 (patch)
tree9c490940b9433e40735c282c2caba4d7a629fadb /net/bluetooth/hci_event.c
parentBluetooth: btbcm: disable read tx power for MacBook Air 8,1 and 8,2 (diff)
downloadlinux-dev-72279d17df54d5e4e7910b39c61a3f3464e36633.tar.xz
linux-dev-72279d17df54d5e4e7910b39c61a3f3464e36633.zip
Bluetooth: hci_event: Rework hci_inquiry_result_with_rssi_evt
This rework the handling of hci_inquiry_result_with_rssi_evt to not use a union to represent the different inquiry responses. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Tested-by: Soenke Huster <soenke.huster@eknoes.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index f1082b7c0218..fc30f4c03d29 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4507,16 +4507,13 @@ static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, void *data,
static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
struct sk_buff *skb)
{
- union {
- struct hci_ev_inquiry_result_rssi *res1;
- struct hci_ev_inquiry_result_rssi_pscan *res2;
- } *ev = edata;
+ struct hci_ev_inquiry_result_rssi *ev = edata;
struct inquiry_data data;
int i;
- bt_dev_dbg(hdev, "num_rsp %d", ev->res1->num);
+ bt_dev_dbg(hdev, "num_rsp %d", ev->num);
- if (!ev->res1->num)
+ if (!ev->num)
return;
if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))
@@ -4524,10 +4521,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
hci_dev_lock(hdev);
- if (skb->len == flex_array_size(ev, res2->info, ev->res2->num)) {
+ if (skb->len == array_size(ev->num,
+ sizeof(struct inquiry_info_rssi_pscan))) {
struct inquiry_info_rssi_pscan *info;
- for (i = 0; i < ev->res2->num; i++) {
+ for (i = 0; i < ev->num; i++) {
u32 flags;
info = hci_ev_skb_pull(hdev, skb,
@@ -4554,10 +4552,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
info->dev_class, info->rssi,
flags, NULL, 0, NULL, 0);
}
- } else if (skb->len == flex_array_size(ev, res1->info, ev->res1->num)) {
+ } else if (skb->len == array_size(ev->num,
+ sizeof(struct inquiry_info_rssi))) {
struct inquiry_info_rssi *info;
- for (i = 0; i < ev->res1->num; i++) {
+ for (i = 0; i < ev->num; i++) {
u32 flags;
info = hci_ev_skb_pull(hdev, skb,