Bluetooth: Remove custom stack macros

Now that log processing happens in a separate thread, the
BT_STACK_EXTRA macro is not needed (since there's no significant
overhead), and therefore the BT_STACK macros become unnecessary as
well.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-07-19 15:17:59 +03:00 committed by Carles Cufí
commit 251d99132d
12 changed files with 16 additions and 29 deletions

View file

@ -38,7 +38,7 @@
#define H4_SCO 0x03
#define H4_EVT 0x04
static BT_STACK_NOINIT(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE);
static struct k_thread rx_thread_data;
static struct {

View file

@ -30,8 +30,8 @@
#include "../util.h"
static BT_STACK_NOINIT(tx_stack, 256);
static BT_STACK_NOINIT(rx_stack, 256);
static K_THREAD_STACK_DEFINE(tx_stack, 256);
static K_THREAD_STACK_DEFINE(rx_stack, 256);
static struct k_thread tx_thread_data;
static struct k_thread rx_thread_data;

View file

@ -72,7 +72,7 @@ static K_SEM_DEFINE(sem_initialised, 0, 1);
static K_SEM_DEFINE(sem_request, 0, 1);
static K_SEM_DEFINE(sem_busy, 1, 1);
static BT_STACK_NOINIT(rx_stack, 448);
static K_THREAD_STACK_DEFINE(rx_stack, 448);
static struct k_thread rx_thread_data;
#if defined(CONFIG_BT_DEBUG_HCI_DRIVER)

View file

@ -48,8 +48,8 @@ struct sockaddr_hci {
#define H4_SCO 0x03
#define H4_EVT 0x04
static BT_STACK_NOINIT(rx_thread_stack,
CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE);
static K_THREAD_STACK_DEFINE(rx_thread_stack,
CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE);
static struct k_thread rx_thread_data;
static int uc_fd = -1;

View file

@ -96,7 +96,7 @@ struct bt_rfcomm_dlc {
/* Stack & kernel data for TX thread */
struct k_thread tx_thread;
BT_STACK(stack, 256);
K_THREAD_STACK_MEMBER(stack, 256);
};
struct bt_rfcomm_server {

View file

@ -99,7 +99,7 @@ static struct spi_config spi_cfg = {
.operation = SPI_WORD_SET(8),
};
static struct device *gpio_dev;
static BT_STACK_NOINIT(bt_tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(bt_tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static struct k_thread bt_tx_thread_data;
static K_SEM_DEFINE(sem_spi_rx, 0, 1);

View file

@ -31,7 +31,7 @@
#include "common/log.h"
static struct device *hci_uart_dev;
static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static struct k_thread tx_thread_data;
/* HCI command buffers */

View file

@ -49,9 +49,6 @@ __printf_like(2, 3) void bt_log(int prio, const char *fmt, ...);
__func__, ##__VA_ARGS__)
#define BT_INFO(fmt, ...) bt_log(BT_LOG_INFO, fmt, ##__VA_ARGS__)
/* Enabling debug increases stack size requirement */
#define BT_STACK_DEBUG_EXTRA 300
#elif defined(CONFIG_BT_DEBUG_LOG)
#if BT_DBG_ENABLED
@ -76,9 +73,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#define BT_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
/* Enabling debug increases stack size requirement considerably */
#define BT_STACK_DEBUG_EXTRA 300
#else
static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
@ -91,8 +85,6 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
#define BT_WARN BT_DBG
#define BT_INFO BT_DBG
#define BT_STACK_DEBUG_EXTRA 0
#endif
#define BT_ASSERT(cond) if (!(cond)) { \
@ -100,11 +92,6 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
k_oops(); \
}
#define BT_STACK(name, size) \
K_THREAD_STACK_MEMBER(name, (size) + BT_STACK_DEBUG_EXTRA)
#define BT_STACK_NOINIT(name, size) \
K_THREAD_STACK_DEFINE(name, (size) + BT_STACK_DEBUG_EXTRA)
/* This helper is only available when BT_DEBUG is enabled */
const char *bt_hex(const void *buf, size_t len);

View file

@ -49,10 +49,10 @@ static K_SEM_DEFINE(sem_prio_recv, 0, UINT_MAX);
static K_FIFO_DEFINE(recv_fifo);
struct k_thread prio_recv_thread_data;
static BT_STACK_NOINIT(prio_recv_thread_stack,
CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE);
static K_THREAD_STACK_DEFINE(prio_recv_thread_stack,
CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE);
struct k_thread recv_thread_data;
static BT_STACK_NOINIT(recv_thread_stack, CONFIG_BT_RX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(recv_thread_stack, CONFIG_BT_RX_STACK_SIZE);
#if defined(CONFIG_INIT_STACKS)
static u32_t prio_ts;

View file

@ -55,10 +55,10 @@
/* Stacks for the threads */
#if !defined(CONFIG_BT_RECV_IS_RX_THREAD)
static struct k_thread rx_thread_data;
static BT_STACK_NOINIT(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(rx_thread_stack, CONFIG_BT_RX_STACK_SIZE);
#endif
static struct k_thread tx_thread_data;
static BT_STACK_NOINIT(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static K_THREAD_STACK_DEFINE(tx_thread_stack, CONFIG_BT_HCI_TX_STACK_SIZE);
static void init_work(struct k_work *work);

View file

@ -36,7 +36,7 @@
#endif
static struct k_thread ecc_thread_data;
static BT_STACK_NOINIT(ecc_thread_stack, 1024);
static K_THREAD_STACK_DEFINE(ecc_thread_stack, 1024);
/* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */
static const u32_t debug_private_key[8] = {

View file

@ -56,7 +56,7 @@
static K_FIFO_DEFINE(adv_queue);
static struct k_thread adv_thread_data;
static BT_STACK_NOINIT(adv_thread_stack, ADV_STACK_SIZE);
static K_THREAD_STACK_DEFINE(adv_thread_stack, ADV_STACK_SIZE);
static const u8_t adv_type[] = {
[BT_MESH_ADV_PROV] = BT_DATA_MESH_PROV,