This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 9f463fd3da190c5a49946bda9c6f73d20b99386a Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Sun Dec 27 18:54:24 2020 +0800 bt_uart_shim: Remove g_lowerstatic static variable let's initialize the callback directly to save the memory Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- drivers/wireless/bluetooth/bt_uart_shim.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/wireless/bluetooth/bt_uart_shim.c b/drivers/wireless/bluetooth/bt_uart_shim.c index 40d7d57..7b91396 100644 --- a/drivers/wireless/bluetooth/bt_uart_shim.c +++ b/drivers/wireless/bluetooth/bt_uart_shim.c @@ -111,22 +111,6 @@ static ssize_t hciuart_write(FAR const struct btuart_lowerhalf_s *lower, static ssize_t hciuart_rxdrain(FAR const struct btuart_lowerhalf_s *lower); /**************************************************************************** - * Private Data - ****************************************************************************/ - -/* This structure is the configuration of the HCI UART shim */ - -static struct btuart_lowerhalf_s g_lowerstatic = -{ - .rxattach = hciuart_rxattach, - .rxenable = hciuart_rxenable, - .setbaud = hciuart_setbaud, - .read = hciuart_read, - .write = hciuart_write, - .rxdrain = hciuart_rxdrain -}; - -/**************************************************************************** * Private Functions ****************************************************************************/ @@ -460,7 +444,12 @@ FAR struct btuart_lowerhalf_s *bt_uart_shim_getdevice(FAR const char *path) /* Hook the routines in */ - memcpy(&n->lower, &g_lowerstatic, sizeof(struct btuart_lowerhalf_s)); + n->lower.rxattach = hciuart_rxattach; + n->lower.rxenable = hciuart_rxenable; + n->lower.setbaud = hciuart_setbaud; + n->lower.read = hciuart_read; + n->lower.write = hciuart_write; + n->lower.rxdrain = hciuart_rxdrain; /* Put materials into poll structure */