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

tests: build_all: sensor: enable iis328dq and wsen-pads #78655

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
drivers: sensor: st: iis328dq: Avoiding declaring unused variables
Separating declarations of variables not referenced with #ifdef
when CONFIG_IIS328DQ_THRESHOLD is disabled.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi committed Sep 18, 2024
commit 968150c91f1b94617d4b03087671682e80b0b93e
2 changes: 2 additions & 0 deletions drivers/sensor/st/iis328dq/iis328dq_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ static void iis328dq_handle_interrupt(const struct device *dev)
struct iis328dq_data *data = dev->data;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
iis328dq_status_reg_t status;
#ifdef CONFIG_IIS328DQ_THRESHOLD
Copy link
Collaborator

Choose a reason for hiding this comment

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

The variables should probably be marked as __maybe_unused. See https://www.kernel.org/doc/html/latest/process/coding-style.html section 21.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your review.
I applied your suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

Zephyr convention is to use the ifdef

iis328dq_int1_src_t sources1;
iis328dq_int2_src_t sources2;
#endif

iis328dq_status_reg_get(ctx, &status);

Expand Down