Bluetooth: HCI: Fix using nano_delayed_work API

This fixes warnings related to the use of nano_work and
nano_delayed_work in HCI layer.

Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeout values have been changed.

Change-Id: I953a82a6aa613bb1072a8ad4b01e0f94e5cd64bd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-11-10 14:20:02 +02:00 committed by Johan Hedberg
commit 203897d04e
2 changed files with 8 additions and 9 deletions

View file

@ -24,7 +24,6 @@
#include <misc/util.h> #include <misc/util.h>
#include <misc/byteorder.h> #include <misc/byteorder.h>
#include <misc/stack.h> #include <misc/stack.h>
#include <misc/nano_work.h>
#include <bluetooth/log.h> #include <bluetooth/log.h>
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
@ -55,8 +54,8 @@
#endif #endif
/* Peripheral timeout to initialize Connection Parameter Update procedure */ /* Peripheral timeout to initialize Connection Parameter Update procedure */
#define CONN_UPDATE_TIMEOUT (5 * sys_clock_ticks_per_sec) #define CONN_UPDATE_TIMEOUT (5 * MSEC_PER_SEC)
#define RPA_TIMEOUT (CONFIG_BLUETOOTH_RPA_TIMEOUT * sys_clock_ticks_per_sec) #define RPA_TIMEOUT (CONFIG_BLUETOOTH_RPA_TIMEOUT * MSEC_PER_SEC)
/* Stacks for the fibers */ /* Stacks for the fibers */
static BT_STACK_NOINIT(rx_fiber_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE); static BT_STACK_NOINIT(rx_fiber_stack, CONFIG_BLUETOOTH_RX_STACK_SIZE);
@ -431,12 +430,12 @@ static int le_set_rpa(void)
} }
/* restart timer even if failed to set new RPA */ /* restart timer even if failed to set new RPA */
nano_delayed_work_submit(&bt_dev.rpa_update, RPA_TIMEOUT); k_delayed_work_submit(&bt_dev.rpa_update, RPA_TIMEOUT);
return err; return err;
} }
static void rpa_timeout(struct nano_work *work) static void rpa_timeout(struct k_work *work)
{ {
BT_DBG(""); BT_DBG("");
@ -664,8 +663,8 @@ static void update_conn_param(struct bt_conn *conn)
* The Peripheral device should not perform a Connection Parameter * The Peripheral device should not perform a Connection Parameter
* Update procedure within 5 s after establishing a connection. * Update procedure within 5 s after establishing a connection.
*/ */
nano_delayed_work_submit(&conn->le.update_work, k_delayed_work_submit(&conn->le.update_work,
conn->role == BT_HCI_ROLE_MASTER ? TICKS_NONE : conn->role == BT_HCI_ROLE_MASTER ? K_NO_WAIT :
CONN_UPDATE_TIMEOUT); CONN_UPDATE_TIMEOUT);
} }
@ -3573,7 +3572,7 @@ static int bt_init(void)
return err; return err;
} }
nano_delayed_work_init(&bt_dev.rpa_update, rpa_timeout); k_delayed_work_init(&bt_dev.rpa_update, rpa_timeout);
#endif #endif
bt_monitor_send(BT_MONITOR_OPEN_INDEX, NULL, 0); bt_monitor_send(BT_MONITOR_OPEN_INDEX, NULL, 0);

View file

@ -129,7 +129,7 @@ struct bt_dev {
uint8_t irk[16]; uint8_t irk[16];
/* Work used for RPA rotation */ /* Work used for RPA rotation */
struct nano_delayed_work rpa_update; struct k_delayed_work rpa_update;
#endif #endif
}; };