drivers: sensors: 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-30 10:08:08 -05:00 committed by Maureen Helm
commit 9872dc16b5
66 changed files with 491 additions and 399 deletions

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT silabs_si7006
#include <drivers/sensor.h>
#include <kernel.h>
#include <device.h>
@ -37,7 +39,7 @@ static int si7006_get_humidity(struct device *i2c_dev,
int retval;
u8_t hum[2];
retval = i2c_burst_read(i2c_dev, DT_INST_0_SILABS_SI7006_BASE_ADDRESS,
retval = i2c_burst_read(i2c_dev, DT_INST_REG_ADDR(0),
SI7006_MEAS_REL_HUMIDITY_MASTER_MODE, hum, sizeof(hum));
if (retval == 0) {
@ -61,7 +63,7 @@ static int si7006_get_temperature(struct device *i2c_dev,
u8_t temp[2];
int retval;
retval = i2c_burst_read(i2c_dev, DT_INST_0_SILABS_SI7006_BASE_ADDRESS,
retval = i2c_burst_read(i2c_dev, DT_INST_REG_ADDR(0),
SI7006_MEAS_TEMP_MASTER_MODE, temp, sizeof(temp));
if (retval == 0) {
@ -144,7 +146,7 @@ static int si7006_init(struct device *dev)
struct si7006_data *drv_data = dev->driver_data;
drv_data->i2c_dev = device_get_binding(
DT_INST_0_SILABS_SI7006_BUS_NAME);
DT_INST_BUS_LABEL(0));
if (!drv_data->i2c_dev) {
LOG_ERR("i2c master not found.");
@ -158,5 +160,5 @@ static int si7006_init(struct device *dev)
static struct si7006_data si_data;
DEVICE_AND_API_INIT(si7006, DT_INST_0_SILABS_SI7006_LABEL, si7006_init,
DEVICE_AND_API_INIT(si7006, DT_INST_LABEL(0), si7006_init,
&si_data, NULL, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &si7006_api);