drivers/sensor: Convert formatter strings to use PRI defines
To allow for various libc implementations (like newlib) in which the way various {u}int{8,16,32}_t types are defined vary between both libc implementations and across architectures we need to utilize the PRI defines. Change-Id: I69e60e3823028389b314adaf6e279fd47fde1182 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
da8bff6b20
commit
e60af3be66
13 changed files with 23 additions and 22 deletions
|
@ -128,7 +128,7 @@ int bma280_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (id != BMA280_CHIP_ID) {
|
||||
SYS_LOG_DBG("Unexpected chip id (%x)", id);
|
||||
SYS_LOG_DBG("Unexpected chip id (%" PRIx8 ")", id);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
|
@ -499,14 +499,14 @@ static int bmc150_magn_init_chip(struct device *dev)
|
|||
goto err_poweroff;
|
||||
}
|
||||
if (chip_id != BMC150_MAGN_CHIP_ID_VAL) {
|
||||
SYS_LOG_DBG("invalid chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("invalid chip id 0x%" PRIx8, chip_id);
|
||||
goto err_poweroff;
|
||||
}
|
||||
SYS_LOG_DBG("chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("chip id 0x%" PRIx8, chip_id);
|
||||
|
||||
preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET];
|
||||
if (bmc150_magn_set_odr(dev, preset.odr) < 0) {
|
||||
SYS_LOG_DBG("failed to set ODR to %d",
|
||||
SYS_LOG_DBG("failed to set ODR to %" PRIu8,
|
||||
preset.odr);
|
||||
goto err_poweroff;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ static int bmc150_magn_init_chip(struct device *dev)
|
|||
BMC150_MAGN_REG_REP_XY,
|
||||
BMC150_MAGN_REPXY_TO_REGVAL(preset.rep_xy))
|
||||
< 0) {
|
||||
SYS_LOG_DBG("failed to set REP XY to %d",
|
||||
SYS_LOG_DBG("failed to set REP XY to %" PRIu8,
|
||||
preset.rep_xy);
|
||||
goto err_poweroff;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ static int bmc150_magn_init_chip(struct device *dev)
|
|||
if (i2c_reg_write_byte(data->i2c_master, config->i2c_slave_addr,
|
||||
BMC150_MAGN_REG_REP_Z,
|
||||
BMC150_MAGN_REPZ_TO_REGVAL(preset.rep_z)) < 0) {
|
||||
SYS_LOG_DBG("failed to set REP Z to %d",
|
||||
SYS_LOG_DBG("failed to set REP Z to %" PRIu8,
|
||||
preset.rep_z);
|
||||
goto err_poweroff;
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ static int bme280_chip_init(struct device *dev)
|
|||
data->chip_id == BMP280_CHIP_ID_SAMPLE_1) {
|
||||
SYS_LOG_DBG("BMP280 chip detected");
|
||||
} else {
|
||||
SYS_LOG_DBG("bad chip id 0x%x", data->chip_id);
|
||||
SYS_LOG_DBG("bad chip id 0x%" PRIx8, data->chip_id);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
|
@ -290,7 +290,8 @@ int bmg160_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (chip_id != BMG160_CHIP_ID) {
|
||||
SYS_LOG_DBG("Unsupported chip detected (0x%x)!", chip_id);
|
||||
SYS_LOG_DBG("Unsupported chip detected (0x%" PRIx8 ")!",
|
||||
chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
|
@ -848,7 +848,7 @@ int bmi160_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (val != BMI160_CHIP_ID) {
|
||||
SYS_LOG_DBG("Unsupported chip detected (0x%x)!", val);
|
||||
SYS_LOG_DBG("Unsupported chip detected (0x%" PRIx8 ")!", val);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ static int fxas21002_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (whoami != config->whoami) {
|
||||
SYS_LOG_ERR("WHOAMI value received 0x%x, expected 0x%x",
|
||||
SYS_LOG_ERR("WHOAMI value received 0x%" PRIx8 ", expected 0x%x",
|
||||
whoami, config->whoami);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ static int fxos8700_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (whoami != config->whoami) {
|
||||
SYS_LOG_ERR("WHOAMI value received 0x%x, expected 0x%x",
|
||||
SYS_LOG_ERR("WHOAMI value received 0x%" PRIx8 ", expected 0x%x",
|
||||
whoami, FXOS8700_REG_WHOAMI);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -128,11 +128,11 @@ static int lps25hb_init_chip(struct device *dev)
|
|||
goto err_poweroff;
|
||||
}
|
||||
if (chip_id != LPS25HB_VAL_WHO_AM_I) {
|
||||
SYS_LOG_DBG("invalid chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("invalid chip id 0x%" PRIx8, chip_id);
|
||||
goto err_poweroff;
|
||||
}
|
||||
|
||||
SYS_LOG_DBG("chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("chip id 0x%" PRIx8, chip_id);
|
||||
|
||||
if (lps25hb_set_odr_raw(dev, LPS25HB_DEFAULT_SAMPLING_RATE)
|
||||
< 0) {
|
||||
|
|
|
@ -412,10 +412,10 @@ static int lsm6ds0_init_chip(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
if (chip_id != LSM6DS0_VAL_WHO_AM_I) {
|
||||
SYS_LOG_DBG("invalid chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("invalid chip id 0x%" PRIx8, chip_id);
|
||||
return -EIO;
|
||||
}
|
||||
SYS_LOG_DBG("chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("chip id 0x%" PRIx8, chip_id);
|
||||
|
||||
if (lsm6ds0_accel_axis_ctrl(dev, LSM6DS0_ACCEL_ENABLE_X_AXIS,
|
||||
LSM6DS0_ACCEL_ENABLE_Y_AXIS,
|
||||
|
|
|
@ -276,10 +276,10 @@ static int lsm9ds0_gyro_init_chip(struct device *dev)
|
|||
goto err_poweroff;
|
||||
}
|
||||
if (chip_id != LSM9DS0_GYRO_VAL_WHO_AM_I_G) {
|
||||
SYS_LOG_DBG("invalid chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("invalid chip id 0x%" PRIx8, chip_id);
|
||||
goto err_poweroff;
|
||||
}
|
||||
SYS_LOG_DBG("chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("chip id 0x%" PRIx8, chip_id);
|
||||
|
||||
if (lsm9ds0_gyro_set_fs_raw(dev, LSM9DS0_GYRO_DEFAULT_FULLSCALE) < 0) {
|
||||
SYS_LOG_DBG("failed to set full-scale");
|
||||
|
|
|
@ -679,11 +679,11 @@ static int lsm9ds0_mfd_init_chip(struct device *dev)
|
|||
}
|
||||
|
||||
if (chip_id != LSM9DS0_MFD_VAL_WHO_AM_I_XM) {
|
||||
SYS_LOG_DBG("invalid chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("invalid chip id 0x%" PRIx8, chip_id);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
SYS_LOG_DBG("chip id 0x%x", chip_id);
|
||||
SYS_LOG_DBG("chip id 0x%" PRIx8, chip_id);
|
||||
|
||||
#if !defined(LSM9DS0_MFD_ACCEL_DISABLED)
|
||||
if (i2c_reg_update_byte(data->i2c_master, config->i2c_slave_addr,
|
||||
|
|
|
@ -107,7 +107,7 @@ static int max30101_init(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
if (part_id != MAX30101_PART_ID) {
|
||||
SYS_LOG_ERR("Got Part ID 0x%02x, expected 0x%02x",
|
||||
SYS_LOG_ERR("Got Part ID 0x%02" PRIx8 ", expected 0x%02x",
|
||||
part_id, MAX30101_PART_ID);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -88,9 +88,9 @@ static int th02_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_TEMP);
|
||||
|
||||
drv_data->t_sample = get_temp(drv_data->i2c);
|
||||
SYS_LOG_INF("temp: %u", drv_data->t_sample);
|
||||
SYS_LOG_INF("temp: %" PRIu16, drv_data->t_sample);
|
||||
drv_data->rh_sample = get_humi(drv_data->i2c);
|
||||
SYS_LOG_INF("rh: %u", drv_data->rh_sample);
|
||||
SYS_LOG_INF("rh: %" PRIu16, drv_data->rh_sample);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue