File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed
include/zephyr/drivers/bluetooth Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -229,19 +229,7 @@ static void bt_ipc_rx(const uint8_t *data, size_t len)
229
229
230
230
if (buf ) {
231
231
LOG_DBG ("Calling bt_recv(%p)" , buf );
232
-
233
- /* The IPC service does not guarantee that the handler thread
234
- * is cooperative. In particular, the OpenAMP implementation is
235
- * preemtible by default. OTOH, the HCI driver interface requires
236
- * that the bt_recv() function is called from a cooperative
237
- * thread.
238
- *
239
- * Calling `k_sched lock()` has the effect of making the current
240
- * thread cooperative.
241
- */
242
- k_sched_lock ();
243
232
bt_recv (buf );
244
- k_sched_unlock ();
245
233
246
234
LOG_HEXDUMP_DBG (buf -> data , buf -> len , "RX buf payload:" );
247
235
}
Original file line number Diff line number Diff line change @@ -89,8 +89,6 @@ static inline uint8_t bt_hci_evt_get_flags(uint8_t evt)
89
89
* for so-called high priority HCI events, which should instead be delivered to
90
90
* the host stack through bt_recv_prio().
91
91
*
92
- * @note This function must only be called from a cooperative thread.
93
- *
94
92
* @param buf Network buffer containing data from the controller.
95
93
*
96
94
* @return 0 on success or negative error number on failure.
Original file line number Diff line number Diff line change @@ -3854,7 +3854,7 @@ static void rx_queue_put(struct net_buf *buf)
3854
3854
}
3855
3855
#endif /* !CONFIG_BT_RECV_BLOCKING */
3856
3856
3857
- int bt_recv (struct net_buf * buf )
3857
+ static int bt_recv_unsafe (struct net_buf * buf )
3858
3858
{
3859
3859
bt_monitor_send (bt_monitor_opcode (buf ), buf -> data , buf -> len );
3860
3860
@@ -3905,6 +3905,17 @@ int bt_recv(struct net_buf *buf)
3905
3905
}
3906
3906
}
3907
3907
3908
+ int bt_recv (struct net_buf * buf )
3909
+ {
3910
+ int err ;
3911
+
3912
+ k_sched_lock ();
3913
+ err = bt_recv_unsafe (buf );
3914
+ k_sched_unlock ();
3915
+
3916
+ return err ;
3917
+ }
3918
+
3908
3919
int bt_recv_prio (struct net_buf * buf )
3909
3920
{
3910
3921
bt_monitor_send (bt_monitor_opcode (buf ), buf -> data , buf -> len );
You can’t perform that action at this time.
0 commit comments