-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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: controller: Properly guards calls to ull_adv_sync #30007
Bluetooth: controller: Properly guards calls to ull_adv_sync #30007
Conversation
See https://buildkite.com/zephyr/zephyr/builds/13410#a0617064-8efe-4ebf-8003-c6e86fe5b897 for an example of where this fails |
7546c55
to
879e796
Compare
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.
Fixes #30027
The usual way of doing this in Zephyr is to not have guards around the prototypes in the header files and leave the guards in the C files as they were.
I tried to do so in while working on #29987, but needs changes to all c files that include |
51b07c7
to
6faa2f5
Compare
6faa2f5
to
5ec380c
Compare
@Emil-Gydesen-Bose Structures get included in parent structures, and hence need to be conditionally excluded if features are disabled. By guarding them in header files, there is less chances of redundant RAM usage when features get disabled. |
I understand that guarding fields in structs makes sense, but guarding struct definitions, or function declarations, does not really save any RAM. |
@@ -129,5 +128,4 @@ uint32_t ull_adv_sync_start(struct ll_adv_sync_set *sync, | |||
|
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.
The definition of struct ll_adv_sync_set
in ull_adv_types.h is guarded with CONFIG_BT_CTLR_ADV_PERIODIC
. Don't we need a forward declaration for a compilation without warnings?
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.
Yup, you are right.
I guess this could be handled in different ways:
- Guard the
ull_adv_sync_start
with theCONFIG_BT_CTLR_ADV_PERIODIC
again - Remove the
CONFIG_BT_CTLR_ADV_PERIODIC
guard fromll_adv_sync_set
- Forward declaration
I opted for 2) (removing a guard from a struct definition shouldn't have any side effects).
@cvinayak Please let me know if you disagree with this approach
Two ull_adv_sync function declarations, ull_adv_sync_reset and ull_adv_sync_init was guarded by a #if causing CI issues. Signed-off-by: Emil Gydesen <[email protected]>
5ec380c
to
40e3e91
Compare
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.
LGTM
@cvinayak please take a look |
Two ull_adv_sync functions calls, ull_adv_sync_reset and
ull_adv_sync_init was not properly guarded by a #if.
Signed-off-by: Emil Gydesen [email protected]