Skip to content

Commit

Permalink
sensors: lis2dh: compile lis2dh_reg_field_update() unconditionally
Browse files Browse the repository at this point in the history
There is little reason to compile lis2dh_reg_field_update() function
conditionally, based on enabled features. If it is not used, then linker
will drop it anyway.

Signed-off-by: Marcin Niestroj <[email protected]>
  • Loading branch information
mniestroj authored and galak committed Nov 5, 2019
1 parent 320755b commit d3f2878
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions drivers/sensor/lis2dh/lis2dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ int lis2dh_spi_access(struct lis2dh_data *ctx, u8_t cmd,
}
#endif

#if defined(CONFIG_LIS2DH_TRIGGER) || defined(CONFIG_LIS2DH_ACCEL_RANGE_RUNTIME)
int lis2dh_reg_field_update(struct device *dev, u8_t reg_addr,
u8_t pos, u8_t mask, u8_t val)
{
Expand All @@ -63,7 +62,6 @@ int lis2dh_reg_field_update(struct device *dev, u8_t reg_addr,
return lis2dh_reg_write_byte(dev, reg_addr,
(old_val & ~mask) | ((val << pos) & mask));
}
#endif

static void lis2dh_convert(s16_t raw_val, u16_t scale,
struct sensor_value *val)
Expand Down
6 changes: 3 additions & 3 deletions drivers/sensor/lis2dh/lis2dh.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,16 @@ static inline int lis2dh_reg_write_byte(struct device *dev, u8_t reg_addr,
#endif
}

int lis2dh_reg_field_update(struct device *dev, u8_t reg_addr,
u8_t pos, u8_t mask, u8_t val);

#ifdef CONFIG_LIS2DH_TRIGGER
int lis2dh_trigger_set(struct device *dev,
const struct sensor_trigger *trig,
sensor_trigger_handler_t handler);

int lis2dh_init_interrupt(struct device *dev);

int lis2dh_reg_field_update(struct device *dev, u8_t reg_addr,
u8_t pos, u8_t mask, u8_t val);

int lis2dh_acc_slope_config(struct device *dev, enum sensor_attribute attr,
const struct sensor_value *val);
#endif
Expand Down

0 comments on commit d3f2878

Please sign in to comment.