aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2011-09-26 19:48:35 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-09-29 14:25:08 -0400
commite95beb414168f8fcae195b5a77be29b3362d6904 (patch)
tree87fc187b71c81699751ec3ca2451a46a309e1c09 /net/bluetooth/hci_event.c
parentb6f98044a6cbeba8234a3d433d715e9ef36880c4 (diff)
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/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 7390ba9d4f6e..d7d96b6b1f0d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2838,19 +2838,17 @@ unlock:
2838static inline void hci_le_adv_report_evt(struct hci_dev *hdev, 2838static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
2839 struct sk_buff *skb) 2839 struct sk_buff *skb)
2840{ 2840{
2841 struct hci_ev_le_advertising_info *ev; 2841 u8 num_reports = skb->data[0];
2842 u8 num_reports; 2842 void *ptr = &skb->data[1];
2843
2844 num_reports = skb->data[0];
2845 ev = (void *) &skb->data[1];
2846 2843
2847 hci_dev_lock(hdev); 2844 hci_dev_lock(hdev);
2848 2845
2849 hci_add_adv_entry(hdev, ev); 2846 while (num_reports--) {
2847 struct hci_ev_le_advertising_info *ev = ptr;
2850 2848
2851 while (--num_reports) {
2852 ev = (void *) (ev->data + ev->length + 1);
2853 hci_add_adv_entry(hdev, ev); 2849 hci_add_adv_entry(hdev, ev);
2850
2851 ptr += sizeof(*ev) + ev->length + 1;
2854 } 2852 }
2855 2853
2856 hci_dev_unlock(hdev); 2854 hci_dev_unlock(hdev);