Thread (39 messages) read the whole thread 39 messages, 4 authors, 2012-01-19

Re: [PATCH 07/15] Bluetooth: Merge device class into the EIR data in mgmt_ev_device_found

From: Andrei Emeltchenko <hidden>
Date: 2012-01-19 09:26:35

Hi Johan,

On Wed, Jan 18, 2012 at 08:51:49PM +0200, Johan Hedberg wrote:
quoted hunk ↗ jump to hunk
From: Johan Hedberg <redacted>

There's no need to have a separate device class field since the same
information can be encoded into the EIR data.

Signed-off-by: Johan Hedberg <redacted>
---
 include/net/bluetooth/hci_core.h |   11 +++++++++++
 include/net/bluetooth/mgmt.h     |    1 -
 net/bluetooth/mgmt.c             |   20 +++++++++++++-------
 3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 393bb73..02aa0f9 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -893,6 +893,17 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
 	return false;
 }
 
+static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
+								u16 data_len)
+{
+	eir[eir_len++] = sizeof(type) + data_len;
+	eir[eir_len++] = type;
Would it be better to use struct eir_info/hdr and assign fields len and
type? I saw already several places where this might improve readability
and remove magic formulas (like "+ 2 - 1").

Best regards 
Andrei Emeltchenko 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help