* [PATCH] Bluetooth: hci_le_adv_report_evt code refactoring
@ 2011-09-26 23:48 Andre Guedes
2011-09-29 18:27 ` Gustavo Padovan
0 siblings, 1 reply; 2+ messages in thread
From: Andre Guedes @ 2011-09-26 23:48 UTC (permalink / raw)
To: linux-bluetooth
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>
---
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 8404cd9..570b57a 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2836,19 +2836,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);
--
1.7.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: hci_le_adv_report_evt code refactoring
2011-09-26 23:48 [PATCH] Bluetooth: hci_le_adv_report_evt code refactoring Andre Guedes
@ 2011-09-29 18:27 ` Gustavo Padovan
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Padovan @ 2011-09-29 18:27 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
* Andre Guedes <andre.guedes@openbossa.org> [2011-09-26 20:48:35 -0300]:
> 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>
> ---
> net/bluetooth/hci_event.c | 14 ++++++--------
> 1 files changed, 6 insertions(+), 8 deletions(-)
Applied, thanks.
Gustavo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-29 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-26 23:48 [PATCH] Bluetooth: hci_le_adv_report_evt code refactoring Andre Guedes
2011-09-29 18:27 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).