Bluetooth: Reorder GATT struct members to avoid padding

This makes sure the bigger members are always list first in non-packed
struct to minimize the use of padding for alignment by the compiler.

Change-Id: I64419e9b27f4e7d3abb4eeb0ef2a88beda5b22e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2015-06-24 11:28:44 +03:00 committed by Anas Nashif
commit 207402006a
2 changed files with 11 additions and 11 deletions

View file

@ -87,12 +87,8 @@
/*! @brief GATT Attribute structure. */ /*! @brief GATT Attribute structure. */
struct bt_gatt_attr { struct bt_gatt_attr {
/*! Attribute handle */
uint16_t handle;
/*! Attribute UUID */ /*! Attribute UUID */
const struct bt_uuid *uuid; const struct bt_uuid *uuid;
/*! Attribute permissions */
uint8_t perm;
/*! Attribute read callback */ /*! Attribute read callback */
int (*read)(const bt_addr_le_t *peer, int (*read)(const bt_addr_le_t *peer,
const struct bt_gatt_attr *attr, const struct bt_gatt_attr *attr,
@ -109,6 +105,10 @@ struct bt_gatt_attr {
uint8_t flags); uint8_t flags);
/*! Attribute user data */ /*! Attribute user data */
void *user_data; void *user_data;
/*! Attribute handle */
uint16_t handle;
/*! Attribute permissions */
uint8_t perm;
}; };
/*! @brief Service Attribute Value. */ /*! @brief Service Attribute Value. */
@ -119,12 +119,12 @@ struct bt_gatt_service {
/*! @brief Include Attribute Value. */ /*! @brief Include Attribute Value. */
struct bt_gatt_include { struct bt_gatt_include {
/*! Service UUID. */
const struct bt_uuid *uuid;
/*! Service start handle. */ /*! Service start handle. */
uint16_t start_handle; uint16_t start_handle;
/*! Service end handle. */ /*! Service end handle. */
uint16_t end_handle; uint16_t end_handle;
/*! Service UUID. */
const struct bt_uuid *uuid;
}; };
/* Characteristic Properties Bitfield values */ /* Characteristic Properties Bitfield values */
@ -183,12 +183,12 @@ struct bt_gatt_include {
/*! @brief Characteristic Attribute Value. */ /*! @brief Characteristic Attribute Value. */
struct bt_gatt_chrc { struct bt_gatt_chrc {
/*! Characteristic properties. */
uint8_t properties;
/*! Characteristic value handle. */
uint16_t value_handle;
/*! Characteristic UUID. */ /*! Characteristic UUID. */
const struct bt_uuid *uuid; const struct bt_uuid *uuid;
/*! Characteristic value handle. */
uint16_t value_handle;
/*! Characteristic properties. */
uint8_t properties;
}; };
/* Characteristic Extended Properties Bitfield values */ /* Characteristic Extended Properties Bitfield values */

View file

@ -294,9 +294,9 @@ int bt_gatt_attr_read_cep(const bt_addr_le_t *peer,
} }
struct notify_data { struct notify_data {
uint8_t handle;
const void *data; const void *data;
size_t len; size_t len;
uint8_t handle;
}; };
static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data) static uint8_t notify_cb(const struct bt_gatt_attr *attr, void *user_data)