drivers: sensor: Migrate to new logger
Move all sensor drivers and samples to new logging system. Signed-off-by: Punit Vara <punit.vara@intel.com>
This commit is contained in:
parent
86e69ddd8b
commit
e5620a2b87
129 changed files with 928 additions and 798 deletions
|
@ -11,8 +11,13 @@
|
|||
#include <kernel.h>
|
||||
#include <sensor.h>
|
||||
#include <misc/__assert.h>
|
||||
|
||||
#include "adt7420.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(ADT7420);
|
||||
|
||||
static int adt7420_temp_reg_read(struct device *dev, u8_t reg, s16_t *val)
|
||||
{
|
||||
struct adt7420_data *drv_data = dev->driver_data;
|
||||
|
@ -71,7 +76,7 @@ static int adt7420_attr_set(struct device *dev,
|
|||
ADT7420_REG_CONFIG,
|
||||
ADT7420_CONFIG_OP_MODE(~0),
|
||||
ADT7420_CONFIG_OP_MODE(val8)) < 0) {
|
||||
SYS_LOG_DBG("Failed to set attribute!");
|
||||
LOG_DBG("Failed to set attribute!");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -92,7 +97,7 @@ static int adt7420_attr_set(struct device *dev,
|
|||
value = (value / ADT7420_TEMP_SCALE) << 1;
|
||||
|
||||
if (adt7420_temp_reg_write(dev, reg, value) < 0) {
|
||||
SYS_LOG_DBG("Failed to set attribute!");
|
||||
LOG_DBG("Failed to set attribute!");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -185,7 +190,7 @@ static int adt7420_probe(struct device *dev)
|
|||
|
||||
#ifdef CONFIG_ADT7420_TRIGGER
|
||||
if (adt7420_init_interrupt(dev) < 0) {
|
||||
SYS_LOG_ERR("Failed to initialize interrupt!");
|
||||
LOG_ERR("Failed to initialize interrupt!");
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
|
@ -200,7 +205,7 @@ static int adt7420_init(struct device *dev)
|
|||
|
||||
drv_data->i2c = device_get_binding(cfg->i2c_port);
|
||||
if (drv_data->i2c == NULL) {
|
||||
SYS_LOG_DBG("Failed to get pointer to %s device!",
|
||||
LOG_DBG("Failed to get pointer to %s device!",
|
||||
cfg->i2c_port);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -97,8 +97,5 @@ int adt7420_trigger_set(struct device *dev,
|
|||
int adt7420_init_interrupt(struct device *dev);
|
||||
#endif /* CONFIG_ADT7420_TRIGGER */
|
||||
|
||||
#define SYS_LOG_DOMAIN "ADT7420"
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_SENSOR_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
|
||||
#endif /* ZEPHYR_DRIVERS_SENSOR_ADT7420_ADT7420_H_ */
|
||||
|
|
|
@ -10,8 +10,13 @@
|
|||
#include <misc/util.h>
|
||||
#include <kernel.h>
|
||||
#include <sensor.h>
|
||||
|
||||
#include "adt7420.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_DECLARE(ADT7420);
|
||||
|
||||
static void adt7420_thread_cb(void *arg)
|
||||
{
|
||||
struct device *dev = arg;
|
||||
|
@ -84,7 +89,7 @@ int adt7420_trigger_set(struct device *dev,
|
|||
drv_data->th_handler = handler;
|
||||
drv_data->th_trigger = *trig;
|
||||
} else {
|
||||
SYS_LOG_ERR("Unsupported sensor trigger");
|
||||
LOG_ERR("Unsupported sensor trigger");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -100,7 +105,7 @@ int adt7420_init_interrupt(struct device *dev)
|
|||
|
||||
drv_data->gpio = device_get_binding(cfg->gpio_port);
|
||||
if (drv_data->gpio == NULL) {
|
||||
SYS_LOG_DBG("Failed to get pointer to %s device!",
|
||||
LOG_DBG("Failed to get pointer to %s device!",
|
||||
cfg->gpio_port);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -114,7 +119,7 @@ int adt7420_init_interrupt(struct device *dev)
|
|||
BIT(cfg->int_gpio));
|
||||
|
||||
if (gpio_add_callback(drv_data->gpio, &drv_data->gpio_cb) < 0) {
|
||||
SYS_LOG_DBG("Failed to set gpio callback!");
|
||||
LOG_DBG("Failed to set gpio callback!");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue