Commit 72279d17 authored by Luiz Augusto von Dentz's avatar Luiz Augusto von Dentz Committed by Marcel Holtmann

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: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tested-by: default avatarSoenke Huster <soenke.huster@eknoes.de>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 3318ae23
...@@ -2233,11 +2233,7 @@ struct inquiry_info_rssi_pscan { ...@@ -2233,11 +2233,7 @@ struct inquiry_info_rssi_pscan {
} __packed; } __packed;
struct hci_ev_inquiry_result_rssi { struct hci_ev_inquiry_result_rssi {
__u8 num; __u8 num;
struct inquiry_info_rssi info[]; __u8 data[];
} __packed;
struct hci_ev_inquiry_result_rssi_pscan {
__u8 num;
struct inquiry_info_rssi_pscan info[];
} __packed; } __packed;
#define HCI_EV_REMOTE_EXT_FEATURES 0x23 #define HCI_EV_REMOTE_EXT_FEATURES 0x23
......
...@@ -4507,16 +4507,13 @@ static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, void *data, ...@@ -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, static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
struct sk_buff *skb) struct sk_buff *skb)
{ {
union { struct hci_ev_inquiry_result_rssi *ev = edata;
struct hci_ev_inquiry_result_rssi *res1;
struct hci_ev_inquiry_result_rssi_pscan *res2;
} *ev = edata;
struct inquiry_data data; struct inquiry_data data;
int i; 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; return;
if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ)) 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, ...@@ -4524,10 +4521,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
hci_dev_lock(hdev); 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; struct inquiry_info_rssi_pscan *info;
for (i = 0; i < ev->res2->num; i++) { for (i = 0; i < ev->num; i++) {
u32 flags; u32 flags;
info = hci_ev_skb_pull(hdev, skb, 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, ...@@ -4554,10 +4552,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
info->dev_class, info->rssi, info->dev_class, info->rssi,
flags, NULL, 0, NULL, 0); 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; struct inquiry_info_rssi *info;
for (i = 0; i < ev->res1->num; i++) { for (i = 0; i < ev->num; i++) {
u32 flags; u32 flags;
info = hci_ev_skb_pull(hdev, skb, info = hci_ev_skb_pull(hdev, skb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment