/* Helper for converting m/s^2 offset values into register values.  */
static int bma4xx_offset_to_reg_val(const struct sensor_value *val, uint8_t *reg_val)
/* Helper for converting m/s^2 offset values into register values.  */
static int bma4xx_offset_to_reg_val(const struct sensor_value *val, uint8_t *reg_val)
{
	int32_t ug = sensor_ms2_to_ug(val);
	if (ug < BMA4XX_OFFSET_MICROG_MIN || ug > BMA4XX_OFFSET_MICROG_MAX) {
		return -ERANGE;
	}
	*reg_val = ug / BMA4XX_OFFSET_MICROG_PER_BIT;
	return 0;
}