drivers/sensor: stmemsc: make use of spi_dt_spec and i2c_dt_spec

Make use of the new DT facilities that introduced two new
bus structures, spi_dt_spec and i2c_dt_spec, as well as the
macros, SPI_DT_SPEC_INST_GET and I2C_DT_SPEC_INST_GET, to
retrieve info from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2021-09-07 10:27:49 +02:00 committed by Maureen Helm
commit dabaaa1e5d
13 changed files with 42 additions and 62 deletions

View file

@ -356,9 +356,8 @@ static int lis2dw12_init(const struct device *dev)
.handle = \
(void *)&lis2dw12_config_##inst.stmemsc_cfg, \
}, \
.stmemsc_cfg.spi = { \
.bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.spi_cfg = SPI_CONFIG_DT_INST(inst, \
.stmemsc_cfg = { \
.spi = SPI_DT_SPEC_INST_GET(inst, \
LIS2DW12_SPI_OPERATION, \
0), \
}, \
@ -383,9 +382,8 @@ static int lis2dw12_init(const struct device *dev)
.handle = \
(void *)&lis2dw12_config_##inst.stmemsc_cfg, \
}, \
.stmemsc_cfg.i2c = { \
.bus = DEVICE_DT_GET(DT_INST_BUS(inst)), \
.i2c_slv_addr = DT_INST_REG_ADDR(inst), \
.stmemsc_cfg = { \
.i2c = I2C_DT_SPEC_INST_GET(inst), \
}, \
.pm = DT_INST_PROP(inst, power_mode), \
.range = DT_INST_PROP(inst, range), \