drivers: sensor: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with dev->data and dev->config. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
9b92dfeca8
commit
2c103a25cc
4 changed files with 32 additions and 43 deletions
|
@ -63,11 +63,6 @@ struct bme280_config {
|
|||
const struct bme280_bus_io *bus_io;
|
||||
};
|
||||
|
||||
static inline struct bme280_data *to_data(const struct device *dev)
|
||||
{
|
||||
return dev->data;
|
||||
}
|
||||
|
||||
static inline int bme280_bus_check(const struct device *dev)
|
||||
{
|
||||
const struct bme280_config *cfg = dev->config;
|
||||
|
@ -174,7 +169,7 @@ static int bme280_wait_until_ready(const struct device *dev)
|
|||
static int bme280_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
struct bme280_data *data = to_data(dev);
|
||||
struct bme280_data *data = dev->data;
|
||||
uint8_t buf[8];
|
||||
int32_t adc_press, adc_temp, adc_humidity;
|
||||
int size = 6;
|
||||
|
@ -228,7 +223,7 @@ static int bme280_channel_get(const struct device *dev,
|
|||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
struct bme280_data *data = to_data(dev);
|
||||
struct bme280_data *data = dev->data;
|
||||
|
||||
switch (chan) {
|
||||
case SENSOR_CHAN_AMBIENT_TEMP:
|
||||
|
@ -272,7 +267,7 @@ static const struct sensor_driver_api bme280_api_funcs = {
|
|||
|
||||
static int bme280_read_compensation(const struct device *dev)
|
||||
{
|
||||
struct bme280_data *data = to_data(dev);
|
||||
struct bme280_data *data = dev->data;
|
||||
uint16_t buf[12];
|
||||
uint8_t hbuf[7];
|
||||
int err = 0;
|
||||
|
@ -325,7 +320,7 @@ static int bme280_read_compensation(const struct device *dev)
|
|||
|
||||
static int bme280_chip_init(const struct device *dev)
|
||||
{
|
||||
struct bme280_data *data = to_data(dev);
|
||||
struct bme280_data *data = dev->data;
|
||||
int err;
|
||||
|
||||
err = bme280_bus_check(dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue