drivers: can: use separate log modules for each driver

Use separate log modules for each CAN driver similar to other
sub-systems/driver classes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-02-22 12:06:54 +01:00 committed by Anas Nashif
commit de45e8ec72
10 changed files with 23 additions and 22 deletions

View file

@ -7,10 +7,9 @@
#include <drivers/can.h> #include <drivers/can.h>
#include <kernel.h> #include <kernel.h>
#include <sys/util.h> #include <sys/util.h>
#define LOG_LEVEL CONFIG_CAN_LOG_LEVEL
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(can_driver);
LOG_MODULE_REGISTER(can_common, CONFIG_CAN_LOG_LEVEL);
#define CAN_SYNC_SEG 1 #define CAN_SYNC_SEG 1

View file

@ -10,9 +10,9 @@
#include <drivers/can.h> #include <drivers/can.h>
#include "can_mcan.h" #include "can_mcan.h"
#include "can_mcan_int.h" #include "can_mcan_int.h"
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_REGISTER(can_mcan, CONFIG_CAN_LOG_LEVEL);
#define CAN_INIT_TIMEOUT (100) #define CAN_INIT_TIMEOUT (100)
#define CAN_DIV_CEIL(val, div) (((val) + (div) - 1) / (div)) #define CAN_DIV_CEIL(val, div) (((val) + (div) - 1) / (div))

View file

@ -10,10 +10,9 @@
#include <device.h> #include <device.h>
#include <drivers/spi.h> #include <drivers/spi.h>
#include <drivers/gpio.h> #include <drivers/gpio.h>
#define LOG_LEVEL CONFIG_CAN_LOG_LEVEL
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(mcp2515_can);
LOG_MODULE_REGISTER(can_mcp2515, CONFIG_CAN_LOG_LEVEL);
#include "can_mcp2515.h" #include "can_mcp2515.h"
#include "can_utils.h" #include "can_utils.h"

View file

@ -13,10 +13,9 @@
#include <device.h> #include <device.h>
#include <sys/byteorder.h> #include <sys/byteorder.h>
#include <fsl_flexcan.h> #include <fsl_flexcan.h>
#define LOG_LEVEL CONFIG_CAN_LOG_LEVEL
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(can_mcux_flexcan);
LOG_MODULE_REGISTER(can_mcux_flexcan, CONFIG_CAN_LOG_LEVEL);
#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || #define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) ||

View file

@ -11,7 +11,7 @@
#include "can_mcan.h" #include "can_mcan.h"
LOG_MODULE_REGISTER(mcux_mcan, CONFIG_CAN_LOG_LEVEL); LOG_MODULE_REGISTER(can_mcux_mcan, CONFIG_CAN_LOG_LEVEL);
#define DT_DRV_COMPAT nxp_lpc_mcan #define DT_DRV_COMPAT nxp_lpc_mcan

View file

@ -12,9 +12,9 @@
#include <drivers/clock_control.h> #include <drivers/clock_control.h>
#include <drivers/clock_control/rcar_clock_control.h> #include <drivers/clock_control/rcar_clock_control.h>
#include <drivers/pinctrl.h> #include <drivers/pinctrl.h>
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_REGISTER(can_rcar, CONFIG_CAN_LOG_LEVEL);
#include "can_utils.h" #include "can_utils.h"

View file

@ -9,9 +9,10 @@
#include <drivers/can.h> #include <drivers/can.h>
#include <soc.h> #include <soc.h>
#include <kernel.h> #include <kernel.h>
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_REGISTER(can_sam, CONFIG_CAN_LOG_LEVEL);
#define DT_DRV_COMPAT atmel_sam_can #define DT_DRV_COMPAT atmel_sam_can
struct can_sam_config { struct can_sam_config {

View file

@ -14,10 +14,11 @@
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <drivers/can.h> #include <drivers/can.h>
#include <logging/log.h>
#include "can_stm32.h" #include "can_stm32.h"
#include <logging/log.h> LOG_MODULE_REGISTER(can_stm32, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
#define CAN_INIT_TIMEOUT (10 * sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC) #define CAN_INIT_TIMEOUT (10 * sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC)

View file

@ -9,10 +9,11 @@
#include <kernel.h> #include <kernel.h>
#include <soc.h> #include <soc.h>
#include <stm32_ll_rcc.h> #include <stm32_ll_rcc.h>
#include <logging/log.h>
#include "can_stm32fd.h" #include "can_stm32fd.h"
#include <logging/log.h> LOG_MODULE_REGISTER(can_stm32fd, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
#if CONFIG_CAN_STM32_CLOCK_DIVISOR != 1 && CONFIG_CAN_STM32_CLOCK_DIVISOR & 0x01 #if CONFIG_CAN_STM32_CLOCK_DIVISOR != 1 && CONFIG_CAN_STM32_CLOCK_DIVISOR & 0x01
#error CAN_STM32_CLOCK_DIVISOR invalid.\ #error CAN_STM32_CLOCK_DIVISOR invalid.\

View file

@ -10,10 +10,11 @@
#include <drivers/pinctrl.h> #include <drivers/pinctrl.h>
#include <kernel.h> #include <kernel.h>
#include <stm32_ll_rcc.h> #include <stm32_ll_rcc.h>
#include <logging/log.h>
#include "can_mcan.h" #include "can_mcan.h"
#include <logging/log.h> LOG_MODULE_REGISTER(can_stm32h7, CONFIG_CAN_LOG_LEVEL);
LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
#define DT_DRV_COMPAT st_stm32h7_fdcan #define DT_DRV_COMPAT st_stm32h7_fdcan