Skip to content
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

Merged
merged 1 commit into from
Nov 19, 2020

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Nov 13, 2020

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]

@Thalley
Copy link
Collaborator Author

Thalley commented Nov 13, 2020

@Thalley Thalley force-pushed the controller-ci-fixes branch from 7546c55 to 879e796 Compare November 13, 2020 17:45
Copy link
Collaborator

@wopu-ot wopu-ot left a 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.

@cvinayak
Copy link
Contributor

cvinayak commented Nov 16, 2020

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 ull_adv_internal.h to include additional LLL includes.
Maybe we move out the definitions from ull_adv_internal.h into a new ull_sync_internal.h ?

@Thalley
Copy link
Collaborator Author

Thalley commented Nov 16, 2020

@wopu-ot I also think that's the best way of handling this.

@cvinayak Is there a reason to guard the declarations and structs in the first place?

@Thalley Thalley force-pushed the controller-ci-fixes branch 2 times, most recently from 51b07c7 to 6faa2f5 Compare November 16, 2020 09:51
@Thalley Thalley requested a review from wopu-ot November 16, 2020 10:48
@Thalley Thalley force-pushed the controller-ci-fixes branch from 6faa2f5 to 5ec380c Compare November 16, 2020 10:49
@cvinayak
Copy link
Contributor

structs in the first place?

@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.

@Thalley
Copy link
Collaborator Author

Thalley commented Nov 16, 2020

structs in the first place?

@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,

Copy link
Collaborator

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?

Copy link
Collaborator Author

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:

  1. Guard the ull_adv_sync_start with the CONFIG_BT_CTLR_ADV_PERIODIC again
  2. Remove the CONFIG_BT_CTLR_ADV_PERIODIC guard from ll_adv_sync_set
  3. 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]>
@Thalley Thalley force-pushed the controller-ci-fixes branch from 5ec380c to 40e3e91 Compare November 17, 2020 09:13
@Thalley Thalley requested a review from wopu-ot November 17, 2020 09:15
Copy link
Collaborator

@wopu-ot wopu-ot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@carlescufi
Copy link
Member

@cvinayak please take a look

@carlescufi carlescufi merged commit deac6d7 into zephyrproject-rtos:master Nov 19, 2020
@Thalley Thalley deleted the controller-ci-fixes branch June 1, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants