-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bluetooth: host: Added support for unregistering bt_conn callbacks #18237
Conversation
Added function bt_conn_cb_unregister for unregistering callback from monitoring the state of a connection. Signed-off-by: Morten Priess <mtpr@oticon.com>
{ | ||
struct bt_conn_cb *cb, *prev_cb; | ||
|
||
for (cb = callback_list, prev_cb = NULL; cb; cb = cb->_next) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should convert to use sys_slist_t instead of keeping the custom list implementation, it hasn't been a problem for now since we didn't have to remove items but now that are doing it maybe it is work changing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just going to say the same. The struct size will stay the same and there's no need to go implementing linked list manipulation routines ourselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding and removing should also be protected, since these APIs can be called from a preemptible thread, and callbacks can be called from RX thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your comments. I will check whether I have time for doing this now - in the context of this PR - or if we should create an issue on it.
{ | ||
struct bt_conn_cb *cb, *prev_cb; | ||
|
||
for (cb = callback_list, prev_cb = NULL; cb; cb = cb->_next) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding and removing should also be protected, since these APIs can be called from a preemptible thread, and callbacks can be called from RX thread.
Will not have time to implement suggested changes in the context of this PR. Closing the PR and have created issue #18316 |
Added function bt_conn_cb_unregister for unregistering callback from
monitoring the state of a connection.
Signed-off-by: Morten Priess mtpr@oticon.com