Commit 18f5fb99 authored by Wolfgang Puffitsch's avatar Wolfgang Puffitsch Committed by Anas Nashif
Browse files

Bluetooth: controller: Remove use of lll_stop



Remove use of lll_stop and lll_is_stop and rely on "initiated" flag in
lll_conn struct instead.

Signed-off-by: default avatarWolfgang Puffitsch <wopu@demant.com>
parent 5ce5dc05
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ struct ull_hdr {

struct lll_hdr {
	void *parent;
	uint8_t is_stop:1;
};

struct lll_prepare_param {
@@ -370,17 +369,6 @@ static inline void lll_hdr_init(void *lll, void *parent)
	struct lll_hdr *hdr = lll;

	hdr->parent = parent;
	hdr->is_stop = 0U;
}

static inline int lll_stop(void *lll)
{
	struct lll_hdr *hdr = lll;
	int ret = !!hdr->is_stop;

	hdr->is_stop = 1U;

	return ret;
}

int lll_init(void);
+3 −5
Original line number Diff line number Diff line
@@ -740,10 +740,11 @@ static int prepare_cb(struct lll_prepare_param *p)

	lll = p->param;

#if defined(CONFIG_BT_PERIPHERAL)
	/* Check if stopped (on connection establishment race between LLL and
	 * ULL.
	 */
	if (unlikely(lll_is_stop(lll))) {
	if (unlikely(lll->conn && lll->conn->initiated)) {
		int err;

		err = lll_hfclock_off();
@@ -754,6 +755,7 @@ static int prepare_cb(struct lll_prepare_param *p)
		DEBUG_RADIO_CLOSE_A(0);
		return 0;
	}
#endif /* CONFIG_BT_PERIPHERAL */

	radio_reset();

@@ -1335,7 +1337,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
		   !lll->conn->initiated) {
		struct node_rx_ftr *ftr;
		struct node_rx_pdu *rx;
		int ret;

		if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
			rx = ull_pdu_rx_alloc_peek(4);
@@ -1364,9 +1365,6 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
#endif /* CONFIG_BT_CTLR_CONN_RSSI */

		/* Stop further LLL radio events */
		ret = lll_stop(lll);
		LL_ASSERT(!ret);

		lll->conn->initiated = 1;

		rx = ull_pdu_rx_alloc();
+0 −4
Original line number Diff line number Diff line
@@ -659,7 +659,6 @@ static void isr_tx_connect_rsp(void *param)
	struct node_rx_pdu *rx;
	struct lll_adv *lll;
	bool is_done;
	int ret;

	rx = param;
	ftr = &(rx->hdr.rx_ftr);
@@ -687,9 +686,6 @@ static void isr_tx_connect_rsp(void *param)

	if (is_done) {
		/* Stop further LLL radio events */
		ret = lll_stop(lll);
		LL_ASSERT(!ret);

		lll->conn->initiated = 1;
	}

+0 −6
Original line number Diff line number Diff line
@@ -14,12 +14,6 @@ int lll_is_abort_cb(void *next, int prio, void *curr,
			 lll_prepare_cb_t *resume_cb, int *resume_prio);
void lll_abort_cb(struct lll_prepare_param *prepare_param, void *param);

static inline int lll_is_stop(void *lll)
{
	struct lll_hdr *hdr = lll;

	return !!hdr->is_stop;
}
uint32_t lll_evt_offset_get(struct evt_hdr *evt);
uint32_t lll_preempt_calc(struct evt_hdr *evt, uint8_t ticker_id,
		uint32_t ticks_at_event);
+11 −6
Original line number Diff line number Diff line
@@ -134,10 +134,11 @@ static int prepare_cb(struct lll_prepare_param *p)

	lll = p->param;

#if defined(CONFIG_BT_CENTRAL)
	/* Check if stopped (on connection establishment race between LLL and
	 * ULL.
	 */
	if (unlikely(lll_is_stop(lll))) {
	if (unlikely(lll->conn && lll->conn->initiated)) {
		int err;

		err = lll_hfclock_off();
@@ -148,6 +149,7 @@ static int prepare_cb(struct lll_prepare_param *p)
		DEBUG_RADIO_CLOSE_O(0);
		return 0;
	}
#endif /* CONFIG_BT_CENTRAL */

	/* Initialize scanning state */
	lll->state = 0U;
@@ -355,6 +357,9 @@ static int is_abort_cb(void *next, int prio, void *curr,

static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
{
#if defined(CONFIG_BT_CENTRAL)
	struct lll_scan *lll = param;
#endif /* CONFIG_BT_CENTRAL */
	int err;

	/* NOTE: This is not a prepare being cancelled */
@@ -363,10 +368,14 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
		 * After event has been cleanly aborted, clean up resources
		 * and dispatch event done.
		 */
		if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) && lll_is_stop(param)) {
		if (0) {
#if defined(CONFIG_BT_CENTRAL)
		} else if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT) &&
			   lll->conn && lll->conn->initiated) {
			while (!radio_has_disabled()) {
				cpu_sleep();
			}
#endif /* CONFIG_BT_CENTRAL */
		} else {
			radio_isr_set(isr_abort, param);
			radio_disable();
@@ -782,7 +791,6 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
#if defined(CONFIG_BT_CTLR_PRIVACY)
		bt_addr_t *lrpa;
#endif /* CONFIG_BT_CTLR_PRIVACY */
		int ret;

		if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
			rx = ull_pdu_rx_alloc_peek(4);
@@ -922,9 +930,6 @@ static inline int isr_rx_pdu(struct lll_scan *lll, struct pdu_adv *pdu_adv_rx,
		 */

		/* Stop further LLL radio events */
		ret = lll_stop(lll);
		LL_ASSERT(!ret);

		lll->conn->initiated = 1;

		rx = ull_pdu_rx_alloc();
Loading