diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2011-09-26 20:48:35 -0300 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-09-29 15:25:08 -0300 |
commit | e95beb414168f8fcae195b5a77be29b3362d6904 (patch) | |
tree | 87fc187b71c81699751ec3ca2451a46a309e1c09 /net | |
parent | b6f98044a6cbeba8234a3d433d715e9ef36880c4 (diff) | |
download | op-kernel-dev-e95beb414168f8fcae195b5a77be29b3362d6904.zip op-kernel-dev-e95beb414168f8fcae195b5a77be29b3362d6904.tar.gz |
Bluetooth: hci_le_adv_report_evt code refactoring
There is no reason to treat the first advertising entry differently
from the potential other ones. Besides, the current implementation
can easily leads to typos.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_event.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 7390ba9..d7d96b6 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2838,19 +2838,17 @@ unlock: static inline void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) { - struct hci_ev_le_advertising_info *ev; - u8 num_reports; - - num_reports = skb->data[0]; - ev = (void *) &skb->data[1]; + u8 num_reports = skb->data[0]; + void *ptr = &skb->data[1]; hci_dev_lock(hdev); - hci_add_adv_entry(hdev, ev); + while (num_reports--) { + struct hci_ev_le_advertising_info *ev = ptr; - while (--num_reports) { - ev = (void *) (ev->data + ev->length + 1); hci_add_adv_entry(hdev, ev); + + ptr += sizeof(*ev) + ev->length + 1; } hci_dev_unlock(hdev); |