drivers: sensor: st: Convert to new DT_INST macros

Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-03-26 16:47:47 -05:00 committed by Maureen Helm
commit e268368fd4
54 changed files with 442 additions and 354 deletions

View file

@ -6,6 +6,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT st_lsm9ds0_gyro
#include <drivers/sensor.h>
#include <kernel.h>
#include <device.h>
@ -344,18 +346,18 @@ static int lsm9ds0_gyro_init(struct device *dev)
}
static const struct lsm9ds0_gyro_config lsm9ds0_gyro_config = {
.i2c_master_dev_name = DT_INST_0_ST_LSM9DS0_GYRO_BUS_NAME,
.i2c_slave_addr = DT_INST_0_ST_LSM9DS0_GYRO_BASE_ADDRESS,
.i2c_master_dev_name = DT_INST_BUS_LABEL(0),
.i2c_slave_addr = DT_INST_REG_ADDR(0),
#if defined(CONFIG_LSM9DS0_GYRO_TRIGGER_DRDY)
.gpio_drdy_dev_name = DT_INST_0_ST_LSM9DS0_GYRO_IRQ_GPIOS_CONTROLLER,
.gpio_drdy_int_pin = DT_INST_0_ST_LSM9DS0_GYRO_IRQ_GPIOS_PIN,
.gpio_drdy_int_flags = DT_INST_0_ST_LSM9DS0_GYRO_IRQ_GPIOS_FLAGS,
.gpio_drdy_dev_name = DT_INST_GPIO_LABEL(0, irq_gpios),
.gpio_drdy_int_pin = DT_INST_GPIO_PIN(0, irq_gpios),
.gpio_drdy_int_flags = DT_INST_GPIO_FLAGS(0, irq_gpios),
#endif
};
static struct lsm9ds0_gyro_data lsm9ds0_gyro_data;
DEVICE_AND_API_INIT(lsm9ds0_gyro, DT_INST_0_ST_LSM9DS0_GYRO_LABEL,
DEVICE_AND_API_INIT(lsm9ds0_gyro, DT_INST_LABEL(0),
lsm9ds0_gyro_init, &lsm9ds0_gyro_data, &lsm9ds0_gyro_config,
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,
&lsm9ds0_gyro_api_funcs);