iio: chemical: bme680: cleanup bme680_read_calib formatting
Use the full 80 char width to reduce the number of lines taken by function calls. Remove blank lines where it aids clarity by bringing together related code blocks (such as read hi and low bytes and then combine them into one value). Signed-off-by: David Frey <dpfrey@gmail.com> Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com> Tested-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Родитель
8a0ae7d83a
Коммит
6784ba340a
|
@ -102,16 +102,14 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
__le16 buf;
|
||||
|
||||
/* Temperature related coefficients */
|
||||
ret = regmap_bulk_read(data->regmap, BME680_T1_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_T1_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_T1_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
calib->par_t1 = le16_to_cpu(buf);
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_T2_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_T2_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_T2_LSB_REG\n");
|
||||
return ret;
|
||||
|
@ -126,16 +124,14 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
calib->par_t3 = tmp;
|
||||
|
||||
/* Pressure related coefficients */
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P1_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P1_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P1_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
calib->par_p1 = le16_to_cpu(buf);
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P2_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P2_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P2_LSB_REG\n");
|
||||
return ret;
|
||||
|
@ -149,16 +145,14 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
}
|
||||
calib->par_p3 = tmp;
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P4_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P4_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P4_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
calib->par_p4 = le16_to_cpu(buf);
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P5_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P5_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P5_LSB_REG\n");
|
||||
return ret;
|
||||
|
@ -179,16 +173,14 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
}
|
||||
calib->par_p7 = tmp;
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P8_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P8_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P8_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
calib->par_p8 = le16_to_cpu(buf);
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P9_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_P9_LSB_REG, (u8 *) &buf, 2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_P9_LSB_REG\n");
|
||||
return ret;
|
||||
|
@ -208,30 +200,26 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
dev_err(dev, "failed to read BME680_H1_MSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(data->regmap, BME680_H1_LSB_REG, &tmp_lsb);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_H1_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
calib->par_h1 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
|
||||
(tmp_lsb & BME680_BIT_H1_DATA_MSK);
|
||||
(tmp_lsb & BME680_BIT_H1_DATA_MSK);
|
||||
|
||||
ret = regmap_read(data->regmap, BME680_H2_MSB_REG, &tmp_msb);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_H2_MSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(data->regmap, BME680_H2_LSB_REG, &tmp_lsb);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_H2_LSB_REG\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
calib->par_h2 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
|
||||
(tmp_lsb >> BME680_HUM_REG_SHIFT_VAL);
|
||||
(tmp_lsb >> BME680_HUM_REG_SHIFT_VAL);
|
||||
|
||||
ret = regmap_read(data->regmap, BME680_H3_REG, &tmp);
|
||||
if (ret < 0) {
|
||||
|
@ -276,8 +264,8 @@ static int bme680_read_calib(struct bme680_data *data,
|
|||
}
|
||||
calib->par_gh1 = tmp;
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, BME680_GH2_LSB_REG,
|
||||
(u8 *) &buf, 2);
|
||||
ret = regmap_bulk_read(data->regmap, BME680_GH2_LSB_REG, (u8 *) &buf,
|
||||
2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read BME680_GH2_LSB_REG\n");
|
||||
return ret;
|
||||
|
|
Загрузка…
Ссылка в новой задаче