From 5aef8dd1adda047d5028b744536b77001f65fd19 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 10 Nov 2016 14:16:21 +0200 Subject: [PATCH] Bluetooth: conn: Fix using nano_delayed_work API This fixes warnings related to the use of nano_work and nano_delayed_work in bt_conn layer. Note that k_delayed_work takes a timeout in miliseconds rather than in ticks thus the timeout values have been changed. Change-Id: Ia8f34b475051515fd74000cce745ad226aa18aa5 Signed-off-by: Luiz Augusto von Dentz --- subsys/bluetooth/host/conn.c | 11 +++++------ subsys/bluetooth/host/conn_internal.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 6563760d091..94889813176 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -54,7 +53,7 @@ static struct k_fifo dummy; static NET_BUF_POOL(dummy_pool, CONFIG_BLUETOOTH_MAX_CONN, 0, &dummy, NULL, 0); /* How long until we cancel HCI_LE_Create_Connection */ -#define CONN_TIMEOUT (3 * sys_clock_ticks_per_sec) +#define CONN_TIMEOUT (3 * MSEC_PER_SEC) #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) const struct bt_conn_auth_cb *bt_auth; @@ -136,7 +135,7 @@ void notify_le_param_updated(struct bt_conn *conn) } } -static void le_conn_update(struct nano_work *work) +static void le_conn_update(struct k_work *work) { struct bt_conn_le *le = CONTAINER_OF(work, struct bt_conn_le, update_work); @@ -1056,7 +1055,7 @@ struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer) conn->type = BT_CONN_TYPE_LE; conn->le.interval_min = BT_GAP_INIT_CONN_INT_MIN; conn->le.interval_max = BT_GAP_INIT_CONN_INT_MAX; - nano_delayed_work_init(&conn->le.update_work, le_conn_update); + k_delayed_work_init(&conn->le.update_work, le_conn_update); return conn; } @@ -1146,7 +1145,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state) /* Cancel Connection Update if it is pending */ if (conn->type == BT_CONN_TYPE_LE) - nano_delayed_work_cancel(&conn->le.update_work); + k_delayed_work_cancel(&conn->le.update_work); /* Release the reference we took for the very first * state transition. @@ -1370,7 +1369,7 @@ int bt_conn_le_param_update(struct bt_conn *conn, } /* Cancel any pending update */ - nano_delayed_work_cancel(&conn->le.update_work); + k_delayed_work_cancel(&conn->le.update_work); if ((conn->role == BT_HCI_ROLE_SLAVE) && !BT_FEAT_LE_CONN_PARAM_REQ_PROC(bt_dev.le.features)) { diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 2859289fada..51496d78350 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -56,7 +56,7 @@ struct bt_conn_le { struct bt_keys *keys; /* Delayed work for connection update handling */ - struct nano_delayed_work update_work; + struct k_delayed_work update_work; }; #if defined(CONFIG_BLUETOOTH_BREDR)