drivers: sensor: bmi160: Rename 'spi' to 'bus'

This member holds the SPI bus pointer. Change its name to make that
more obvious and so that it can be used for an I2C bus also.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-10-08 12:57:11 -06:00 committed by Carles Cufí
commit 1f1f695ae2
2 changed files with 5 additions and 5 deletions

View file

@ -47,10 +47,10 @@ static int bmi160_transceive(const struct device *dev, uint8_t reg,
.count = 2
};
return spi_transceive(data->spi, &cfg->spi_cfg, &tx, &rx);
return spi_transceive(data->bus, &cfg->spi_cfg, &tx, &rx);
}
return spi_write(data->spi, &cfg->spi_cfg, &tx);
return spi_write(data->bus, &cfg->spi_cfg, &tx);
}
int bmi160_read(const struct device *dev, uint8_t reg_addr, void *data,
@ -816,8 +816,8 @@ int bmi160_init(const struct device *dev)
uint8_t val = 0U;
int32_t acc_range, gyr_range;
data->spi = device_get_binding(cfg->bus_label);
if (!data->spi) {
data->bus = device_get_binding(cfg->bus_label);
if (!data->bus) {
LOG_DBG("SPI master controller not found: %s.", cfg->bus_label);
return -EINVAL;
}

View file

@ -457,7 +457,7 @@ struct bmi160_scale {
};
struct bmi160_data {
const struct device *spi;
const struct device *bus;
#if defined(CONFIG_BMI160_TRIGGER)
const struct device *dev;
const struct device *gpio;