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

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT st_lsm303dlhc_magn
#include <drivers/i2c.h>
#include <init.h>
#include <drivers/sensor.h>
@ -131,13 +133,13 @@ static int lsm303dlhc_magn_init(struct device *dev)
}
static const struct lsm303dlhc_magn_config lsm303dlhc_magn_config = {
.i2c_name = DT_INST_0_ST_LSM303DLHC_MAGN_BUS_NAME,
.i2c_address = DT_INST_0_ST_LSM303DLHC_MAGN_BASE_ADDRESS,
.i2c_name = DT_INST_BUS_LABEL(0),
.i2c_address = DT_INST_REG_ADDR(0),
};
static struct lsm303dlhc_magn_data lsm303dlhc_magn_driver;
DEVICE_AND_API_INIT(lsm303dlhc_magn, DT_INST_0_ST_LSM303DLHC_MAGN_LABEL,
DEVICE_AND_API_INIT(lsm303dlhc_magn, DT_INST_LABEL(0),
lsm303dlhc_magn_init, &lsm303dlhc_magn_driver,
&lsm303dlhc_magn_config, POST_KERNEL,
CONFIG_SENSOR_INIT_PRIORITY, &lsm303dlhc_magn_driver_api);