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:
parent
007aa031b5
commit
9872dc16b5
66 changed files with 491 additions and 399 deletions
|
@ -10,6 +10,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT bosch_bme680
|
||||
|
||||
#include "bme680.h"
|
||||
#include <drivers/gpio.h>
|
||||
#include <drivers/i2c.h>
|
||||
|
@ -401,14 +403,14 @@ static int bme680_init(struct device *dev)
|
|||
struct bme680_data *data = dev->driver_data;
|
||||
|
||||
data->i2c_master = device_get_binding(
|
||||
DT_INST_0_BOSCH_BME680_BUS_NAME);
|
||||
DT_INST_BUS_LABEL(0));
|
||||
if (!data->i2c_master) {
|
||||
LOG_ERR("I2C master not found: %s",
|
||||
DT_INST_0_BOSCH_BME680_BUS_NAME);
|
||||
DT_INST_BUS_LABEL(0));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
data->i2c_slave_addr = DT_INST_0_BOSCH_BME680_BASE_ADDRESS;
|
||||
data->i2c_slave_addr = DT_INST_REG_ADDR(0);
|
||||
|
||||
if (bme680_chip_init(dev) < 0) {
|
||||
return -EINVAL;
|
||||
|
@ -424,6 +426,6 @@ static const struct sensor_driver_api bme680_api_funcs = {
|
|||
|
||||
static struct bme680_data bme680_data;
|
||||
|
||||
DEVICE_AND_API_INIT(bme680, DT_INST_0_BOSCH_BME680_LABEL, bme680_init, &bme680_data,
|
||||
DEVICE_AND_API_INIT(bme680, DT_INST_LABEL(0), bme680_init, &bme680_data,
|
||||
NULL, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,
|
||||
&bme680_api_funcs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue