2014-03-25 14:50:18

by Claudio Takahasi

[permalink] [raw]
Subject: [PATCH BlueZ v0 1/2] proximity: Remove att_put_u8() usage

---
profiles/proximity/reporter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/proximity/reporter.c b/profiles/proximity/reporter.c
index 5861923..9be4a95 100644
--- a/profiles/proximity/reporter.c
+++ b/profiles/proximity/reporter.c
@@ -130,7 +130,7 @@ static void register_tx_power(struct btd_adapter *adapter)

/* Power level value */
bt_uuid16_create(&uuid, POWER_LEVEL_CHR_UUID);
- att_put_u8(0x00, &atval[0]);
+ atval[0] = 0x00;
attrib_db_add(adapter, h++, &uuid, ATT_NONE, ATT_NOT_PERMITTED, atval, 1);

/* Client characteristic configuration */
--
1.8.3.1



2014-03-25 15:25:07

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ v0 1/2] proximity: Remove att_put_u8() usage

Hi Claudio,

On Tue, Mar 25, 2014, Claudio Takahasi wrote:
> ---
> profiles/proximity/reporter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Both patches have been applied. Thanks.

Johan

2014-03-25 14:50:19

by Claudio Takahasi

[permalink] [raw]
Subject: [PATCH BlueZ v0 2/2] attrib: Remove att_get_* and att_put_* helpers

---
attrib/att.h | 89 ------------------------------------------------------------
1 file changed, 89 deletions(-)

diff --git a/attrib/att.h b/attrib/att.h
index 28bc944..297c302 100644
--- a/attrib/att.h
+++ b/attrib/att.h
@@ -111,95 +111,6 @@ struct att_range {
uint16_t end;
};

-/* These functions do byte conversion */
-static inline uint8_t att_get_u8(const void *ptr)
-{
- const uint8_t *u8_ptr = ptr;
- return bt_get_unaligned(u8_ptr);
-}
-
-static inline uint16_t att_get_u16(const void *ptr)
-{
- const uint16_t *u16_ptr = ptr;
- return btohs(bt_get_unaligned(u16_ptr));
-}
-
-static inline uint32_t att_get_u32(const void *ptr)
-{
- const uint32_t *u32_ptr = ptr;
- return btohl(bt_get_unaligned(u32_ptr));
-}
-
-static inline uint128_t att_get_u128(const void *ptr)
-{
- const uint128_t *u128_ptr = ptr;
- uint128_t dst;
-
- btoh128(u128_ptr, &dst);
-
- return dst;
-}
-
-static inline void att_put_u8(uint8_t src, void *dst)
-{
- bt_put_unaligned(src, (uint8_t *) dst);
-}
-
-static inline void att_put_u16(uint16_t src, void *dst)
-{
- bt_put_unaligned(htobs(src), (uint16_t *) dst);
-}
-
-static inline void att_put_u32(uint32_t src, void *dst)
-{
- bt_put_unaligned(htobl(src), (uint32_t *) dst);
-}
-
-static inline void att_put_u128(uint128_t src, void *dst)
-{
- uint128_t *d128 = dst;
-
- htob128(&src, d128);
-}
-
-static inline void att_put_uuid16(bt_uuid_t src, void *dst)
-{
- att_put_u16(src.value.u16, dst);
-}
-
-static inline void att_put_uuid128(bt_uuid_t src, void *dst)
-{
- att_put_u128(src.value.u128, dst);
-}
-
-static inline void att_put_uuid(bt_uuid_t src, void *dst)
-{
- if (src.type == BT_UUID16)
- att_put_uuid16(src, dst);
- else
- att_put_uuid128(src, dst);
-}
-
-static inline bt_uuid_t att_get_uuid16(const void *ptr)
-{
- bt_uuid_t uuid;
-
- bt_uuid16_create(&uuid, att_get_u16(ptr));
-
- return uuid;
-}
-
-static inline bt_uuid_t att_get_uuid128(const void *ptr)
-{
- bt_uuid_t uuid;
- uint128_t value;
-
- value = att_get_u128(ptr);
- bt_uuid128_create(&uuid, value);
-
- return uuid;
-}
-
struct att_data_list *att_data_list_alloc(uint16_t num, uint16_t len);
void att_data_list_free(struct att_data_list *list);

--
1.8.3.1