devices: constify device pointers initialized at compile time

Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-08-22 10:36:10 +02:00 committed by Carles Cufí
commit a202341958
215 changed files with 335 additions and 335 deletions

View file

@ -130,42 +130,42 @@ static int board_pinmux_init(const struct device *dev)
struct pinmux_ports_t pinmux_ports;
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_000_036), okay)
const struct device *porta = DEVICE_DT_GET(DT_NODELABEL(pinmux_000_036));
const struct device *const porta = DEVICE_DT_GET(DT_NODELABEL(pinmux_000_036));
__ASSERT_NO_MSG(device_is_ready(porta));
pinmux_ports.porta = porta;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_040_076), okay)
const struct device *portb = DEVICE_DT_GET(DT_NODELABEL(pinmux_040_076));
const struct device *const portb = DEVICE_DT_GET(DT_NODELABEL(pinmux_040_076));
__ASSERT_NO_MSG(device_is_ready(portb));
pinmux_ports.portb = portb;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_100_136), okay)
const struct device *portc = DEVICE_DT_GET(DT_NODELABEL(pinmux_100_136));
const struct device *const portc = DEVICE_DT_GET(DT_NODELABEL(pinmux_100_136));
__ASSERT_NO_MSG(device_is_ready(portc));
pinmux_ports.portc = portc;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_140_176), okay)
const struct device *portd = DEVICE_DT_GET(DT_NODELABEL(pinmux_140_176));
const struct device *const portd = DEVICE_DT_GET(DT_NODELABEL(pinmux_140_176));
__ASSERT_NO_MSG(device_is_ready(portd));
pinmux_ports.portd = portd;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_200_236), okay)
const struct device *porte = DEVICE_DT_GET(DT_NODELABEL(pinmux_200_236));
const struct device *const porte = DEVICE_DT_GET(DT_NODELABEL(pinmux_200_236));
__ASSERT_NO_MSG(device_is_ready(porte));
pinmux_ports.porte = porte;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_240_276), okay)
const struct device *portf = DEVICE_DT_GET(DT_NODELABEL(pinmux_240_276));
const struct device *const portf = DEVICE_DT_GET(DT_NODELABEL(pinmux_240_276));
__ASSERT_NO_MSG(device_is_ready(portf));

View file

@ -132,42 +132,42 @@ static int board_pinmux_init(const struct device *dev)
struct pinmux_ports_t pinmux_ports;
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_000_036), okay)
const struct device *porta = DEVICE_DT_GET(DT_NODELABEL(pinmux_000_036));
const struct device *const porta = DEVICE_DT_GET(DT_NODELABEL(pinmux_000_036));
__ASSERT_NO_MSG(device_is_ready(porta));
pinmux_ports.porta = porta;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_040_076), okay)
const struct device *portb = DEVICE_DT_GET(DT_NODELABEL(pinmux_040_076));
const struct device *const portb = DEVICE_DT_GET(DT_NODELABEL(pinmux_040_076));
__ASSERT_NO_MSG(device_is_ready(portb));
pinmux_ports.portb = portb;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_100_136), okay)
const struct device *portc = DEVICE_DT_GET(DT_NODELABEL(pinmux_100_136));
const struct device *const portc = DEVICE_DT_GET(DT_NODELABEL(pinmux_100_136));
__ASSERT_NO_MSG(device_is_ready(portc));
pinmux_ports.portc = portc;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_140_176), okay)
const struct device *portd = DEVICE_DT_GET(DT_NODELABEL(pinmux_140_176));
const struct device *const portd = DEVICE_DT_GET(DT_NODELABEL(pinmux_140_176));
__ASSERT_NO_MSG(device_is_ready(portd));
pinmux_ports.portd = portd;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_200_236), okay)
const struct device *porte = DEVICE_DT_GET(DT_NODELABEL(pinmux_200_236));
const struct device *const porte = DEVICE_DT_GET(DT_NODELABEL(pinmux_200_236));
__ASSERT_NO_MSG(device_is_ready(porte));
pinmux_ports.porte = porte;
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pinmux_240_276), okay)
const struct device *portf = DEVICE_DT_GET(DT_NODELABEL(pinmux_240_276));
const struct device *const portf = DEVICE_DT_GET(DT_NODELABEL(pinmux_240_276));
__ASSERT_NO_MSG(device_is_ready(portf));

View file

@ -21,7 +21,7 @@ int bt_hci_transport_setup(const struct device *h4)
{
int err;
char c;
const struct device *port = DEVICE_DT_GET(RESET_GPIO_CTRL);
const struct device *const port = DEVICE_DT_GET(RESET_GPIO_CTRL);
if (!device_is_ready(port)) {
return -EIO;

View file

@ -15,7 +15,7 @@ static int board_sparkfun_thing_plus_nrf9160_init(const struct device *dev)
ARG_UNUSED(dev);
/* Get handle of the GPIO device. */
const struct device *gpio = DEVICE_DT_GET(GPIO0);
const struct device *const gpio = DEVICE_DT_GET(GPIO0);
if (!device_is_ready(gpio)) {
return -ENODEV;

View file

@ -10,9 +10,9 @@
static int rv32m1_vega_board_init(const struct device *dev)
{
const struct device *gpiob = DEVICE_DT_GET(DT_NODELABEL(gpiob));
const struct device *gpioc = DEVICE_DT_GET(DT_NODELABEL(gpioc));
const struct device *gpiod = DEVICE_DT_GET(DT_NODELABEL(gpiod));
const struct device *const gpiob = DEVICE_DT_GET(DT_NODELABEL(gpiob));
const struct device *const gpioc = DEVICE_DT_GET(DT_NODELABEL(gpioc));
const struct device *const gpiod = DEVICE_DT_GET(DT_NODELABEL(gpiod));
ARG_UNUSED(dev);

View file

@ -104,7 +104,7 @@ device is to use :c:func:`DEVICE_DT_GET`:
.. code-block:: c
const struct device *uart_dev = DEVICE_DT_GET(MY_SERIAL);
const struct device *const uart_dev = DEVICE_DT_GET(MY_SERIAL);
if (!device_is_ready(uart_dev)) {
/* Not ready, do not use */
@ -142,7 +142,7 @@ that the node has ``status = "okay"``, like this:
#define MY_SERIAL DT_NODELABEL(my_serial)
#if DT_NODE_HAS_STATUS(MY_SERIAL, okay)
const struct device *uart_dev = DEVICE_DT_GET(MY_SERIAL);
const struct device *const uart_dev = DEVICE_DT_GET(MY_SERIAL);
#else
#error "Node is disabled"
#endif

View file

@ -158,7 +158,7 @@ a mailbox. When a transmitting mailbox is assigned, sending cannot be canceled.
.dlc = 8,
.data = {1,2,3,4,5,6,7,8}
};
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
const struct device *const can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
int ret;
ret = can_send(can_dev, &frame, K_MSEC(100), NULL, NULL);
@ -234,7 +234,7 @@ The filter for this example is configured to match the identifier 0x123 exactly.
.id_mask = CAN_STD_ID_MASK
};
int filter_id;
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
const struct device *const can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
filter_id = can_add_rx_filter(can_dev, rx_callback_function, callback_arg, &my_filter);
if (filter_id < 0) {
@ -261,7 +261,7 @@ The filter for this example is configured to match the extended identifier
CAN_MSGQ_DEFINE(my_can_msgq, 2);
struct can_frame rx_frame;
int filter_id;
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
const struct device *const can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
filter_id = can_add_rx_filter_msgq(can_dev, &my_can_msgq, &my_filter);
if (filter_id < 0) {
@ -292,7 +292,7 @@ The following example sets the bitrate to 250k baud with the sampling point at
.. code-block:: C
struct can_timing timing;
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
const struct device *const can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
int ret;
ret = can_calc_timing(can_dev, &timing, 250000, 875);

View file

@ -72,7 +72,7 @@ the DTR signal:
.. code-block:: c
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;
if (usb_enable(NULL)) {

View file

@ -176,7 +176,7 @@ static void adc_it8xxx2_get_sample(const struct device *dev)
static void adc_poll_valid_data(void)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
int valid = 0;
/*
@ -205,7 +205,7 @@ static void adc_poll_valid_data(void)
static void adc_enable_measurement(uint32_t ch)
{
struct adc_it8xxx2_regs *const adc_regs = ADC_IT8XXX2_REG_BASE;
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct adc_it8xxx2_data *data = dev->data;
if (ch <= CHIP_ADC_CH7) {

View file

@ -253,7 +253,7 @@ static int adc_nrfx_read_async(const struct device *dev,
static void event_handler(const nrfx_adc_evt_t *p_event)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
if (p_event->type == NRFX_ADC_EVT_DONE) {
adc_context_on_sampling_done(&m_data.ctx, dev);

View file

@ -978,7 +978,7 @@ static int adc_stm32_init(const struct device *dev)
{
struct adc_stm32_data *data = dev->data;
const struct adc_stm32_cfg *config = dev->config;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
ADC_TypeDef *adc = (ADC_TypeDef *)config->base;
int err;

View file

@ -49,7 +49,7 @@
static void aspeed_cache_init(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
uint32_t start_bit, end_bit, max_bit;
/* set all cache areas to no-cache by default */
@ -112,7 +112,7 @@ void cache_data_enable(void)
void cache_data_disable(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
syscon_write_reg(dev, CACHE_FUNC_CTRL_REG, 0);
}
@ -124,14 +124,14 @@ void cache_instr_enable(void)
void cache_instr_disable(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
syscon_write_reg(dev, CACHE_FUNC_CTRL_REG, 0);
}
int cache_data_all(int op)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
uint32_t ctrl;
unsigned int key = 0;
@ -162,7 +162,7 @@ int cache_data_all(int op)
int cache_data_range(void *addr, size_t size, int op)
{
uint32_t aligned_addr, i, n;
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
unsigned int key = 0;
ARG_UNUSED(op);
@ -196,7 +196,7 @@ int cache_data_range(void *addr, size_t size, int op)
int cache_instr_all(int op)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
uint32_t ctrl;
unsigned int key = 0;
@ -227,7 +227,7 @@ int cache_instr_all(int op)
int cache_instr_range(void *addr, size_t size, int op)
{
uint32_t aligned_addr, i, n;
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
unsigned int key = 0;
ARG_UNUSED(op);
@ -262,7 +262,7 @@ int cache_instr_range(void *addr, size_t size, int op)
#ifdef CONFIG_DCACHE_LINE_SIZE_DETECT
size_t cache_data_line_size_get(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
uint32_t ctrl;
syscon_read_reg(dev, CACHE_FUNC_CTRL_REG, &ctrl);
@ -274,7 +274,7 @@ size_t cache_data_line_size_get(void)
#ifdef CONFIG_ICACHE_LINE_SIZE_DETECT
size_t cache_instr_line_size_get(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(syscon));
uint32_t ctrl;
syscon_read_reg(dev, CACHE_FUNC_CTRL_REG, &ctrl);

View file

@ -72,7 +72,7 @@ static int can_stm32fd_clock_enable(const struct device *dev)
int ret;
const struct can_mcan_config *mcan_cfg = dev->config;
const struct can_stm32fd_config *stm32fd_cfg = mcan_cfg->custom;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
LL_RCC_SetFDCANClockSource(CAN_STM32FD_CLOCK_SOURCE);

View file

@ -47,7 +47,7 @@ static int can_stm32h7_clock_enable(const struct device *dev)
{
const struct can_mcan_config *mcan_cfg = dev->config;
const struct can_stm32h7_config *stm32h7_cfg = mcan_cfg->custom;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
int ret;
LL_RCC_SetFDCANClockSource(LL_RCC_FDCAN_CLKSOURCE_PLL1Q);

View file

@ -320,7 +320,7 @@ static const struct counter_driver_api counter_gecko_driver_api = {
ISR_DIRECT_DECLARE(counter_gecko_isr_0)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct counter_gecko_data *const dev_data = dev->data;
counter_alarm_callback_t alarm_callback;
uint32_t count = RTCC_CounterGet();

View file

@ -278,7 +278,7 @@ void rtc_stm32_isr(const struct device *dev)
static int rtc_stm32_init(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct rtc_stm32_config *cfg = dev->config;
struct rtc_stm32_data *data = dev->data;

View file

@ -144,7 +144,7 @@ static int dtmr_cmsdk_apb_init(const struct device *dev)
#ifdef CONFIG_CLOCK_CONTROL
/* Enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
const struct device *const clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
if (!device_is_ready(clk)) {
return -ENODEV;

View file

@ -147,7 +147,7 @@ static int tmr_cmsdk_apb_init(const struct device *dev)
#ifdef CONFIG_CLOCK_CONTROL
/* Enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
const struct device *const clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
if (!device_is_ready(clk)) {
return -ENODEV;

View file

@ -449,7 +449,7 @@ static int crypto_stm32_query_caps(const struct device *dev)
static int crypto_stm32_init(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
struct crypto_stm32_data *data = CRYPTO_STM32_DATA(dev);
const struct crypto_stm32_config *cfg = CRYPTO_STM32_CFG(dev);

View file

@ -119,7 +119,7 @@ static int dac_stm32_init(const struct device *dev)
int err;
/* enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
if (!device_is_ready(clk)) {
LOG_ERR("clock control device not ready");

View file

@ -556,7 +556,7 @@ static int stm32_sdmmc_pwr_uninit(struct stm32_sdmmc_priv *priv)
static int disk_stm32_sdmmc_init(const struct device *dev)
{
struct stm32_sdmmc_priv *priv = dev->data;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
int err;
if (!device_is_ready(clk)) {

View file

@ -615,7 +615,7 @@ DMA_STM32_EXPORT_API int dma_stm32_stop(const struct device *dev, uint32_t id)
static int dma_stm32_init(const struct device *dev)
{
const struct dma_stm32_config *config = dev->config;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
if (!device_is_ready(clk)) {
LOG_ERR("clock control device not ready");

View file

@ -214,7 +214,7 @@ static int dmamux_stm32_init(const struct device *dev)
{
#if DT_INST_NODE_HAS_PROP(0, clocks)
const struct dmamux_stm32_config *config = dev->config;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
if (!device_is_ready(clk)) {
LOG_ERR("clock control device not ready");

View file

@ -385,7 +385,7 @@ static bool handle_nmi(void)
bool z_x86_do_kernel_nmi(const z_arch_esf_t *esf)
{
const struct device *dev = DEVICE_DT_GET(DEVICE_NODE);
const struct device *const dev = DEVICE_DT_GET(DEVICE_NODE);
struct ibecc_data *data = dev->data;
struct ibecc_error error_data;
k_spinlock_key_t key;

View file

@ -439,7 +439,7 @@ static const struct ptp_clock_driver_api api = {
static int ptp_e1000_init(const struct device *port)
{
const struct device *eth_dev = DEVICE_DT_INST_GET(0);
const struct device *const eth_dev = DEVICE_DT_INST_GET(0);
struct e1000_dev *context = eth_dev->data;
struct ptp_context *ptp_context = port->data;

View file

@ -1767,7 +1767,7 @@ static const struct ptp_clock_driver_api api = {
static int ptp_mcux_init(const struct device *port)
{
const struct device *eth_dev = DEVICE_DT_GET(DT_NODELABEL(enet));
const struct device *const eth_dev = DEVICE_DT_GET(DT_NODELABEL(enet));
struct eth_context *context = eth_dev->data;
struct ptp_context *ptp_context = port->data;
#if defined(CONFIG_PINCTRL)

View file

@ -722,7 +722,7 @@ static const struct ptp_clock_driver_api api = {
#define PTP_INIT_FUNC(x, _) \
static int ptp_init_##x(const struct device *port) \
{ \
const struct device *eth_dev = DEVICE_GET(eth_native_posix_##x); \
const struct device *const eth_dev = DEVICE_GET(eth_native_posix_##x); \
struct eth_context *context = eth_dev->data; \
struct ptp_context *ptp_context = port->data; \
\

View file

@ -2460,7 +2460,7 @@ static const struct ptp_clock_driver_api ptp_api = {
static int ptp_gmac_init(const struct device *port)
{
const struct device *eth_dev = DEVICE_DT_INST_GET(0);
const struct device *const eth_dev = DEVICE_DT_INST_GET(0);
struct eth_sam_dev_data *dev_data = eth_dev->data;
struct ptp_context *ptp_context = port->data;

View file

@ -1301,7 +1301,7 @@ static const struct ptp_clock_driver_api api = {
static int ptp_stm32_init(const struct device *port)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(mac));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(mac));
struct eth_stm32_hal_dev_data *eth_dev_data = dev->data;
const struct eth_stm32_hal_dev_cfg *eth_cfg = dev->config;
struct ptp_context *ptp_context = port->data;

View file

@ -342,7 +342,7 @@ static int stm32_flash_init(const struct device *dev)
*/
#if DT_INST_NODE_HAS_PROP(0, clocks)
struct flash_stm32_priv *p = FLASH_STM32_PRIV(dev);
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
/*
* On STM32 F0, F1, F3 & L1 series, flash interface clock source is

View file

@ -664,7 +664,7 @@ static const struct flash_driver_api flash_stm32h7_api = {
static int stm32h7_flash_init(const struct device *dev)
{
struct flash_stm32_priv *p = FLASH_STM32_PRIV(dev);
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
if (!device_is_ready(clk)) {
LOG_ERR("clock control device not ready");

View file

@ -238,7 +238,7 @@ static int gpio_cmsdk_ahb_init(const struct device *dev)
#ifdef CONFIG_CLOCK_CONTROL
/* Enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
const struct device *const clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0));
if (!device_is_ready(clk)) {
return -ENODEV;

View file

@ -684,8 +684,8 @@ static int gpio_it8xxx2_init_set(const struct device *arg)
ARG_UNUSED(arg);
if (IS_ENABLED(CONFIG_SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN)) {
const struct device *gpiok = DEVICE_DT_GET(DT_NODELABEL(gpiok));
const struct device *gpiol = DEVICE_DT_GET(DT_NODELABEL(gpiol));
const struct device *const gpiok = DEVICE_DT_GET(DT_NODELABEL(gpiok));
const struct device *const gpiol = DEVICE_DT_GET(DT_NODELABEL(gpiol));
for (int i = 0; i < 8; i++) {
gpio_pin_configure(gpiok, i, GPIO_INPUT | GPIO_PULL_DOWN);
@ -694,7 +694,7 @@ static int gpio_it8xxx2_init_set(const struct device *arg)
}
if (IS_ENABLED(CONFIG_SOC_IT8XXX2_GPIO_H7_DEFAULT_OUTPUT_LOW)) {
const struct device *gpioh = DEVICE_DT_GET(DT_NODELABEL(gpioh));
const struct device *const gpioh = DEVICE_DT_GET(DT_NODELABEL(gpioh));
gpio_pin_configure(gpioh, 7, GPIO_OUTPUT_LOW);
}

View file

@ -275,7 +275,7 @@ static int gpio_stm32_clock_request(const struct device *dev, bool on)
__ASSERT_NO_MSG(dev != NULL);
/* enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
if (on) {
ret = clock_control_on(clk,
@ -383,7 +383,7 @@ static int gpio_stm32_enable_int(int port, int pin)
defined(CONFIG_SOC_SERIES_STM32L1X) || \
defined(CONFIG_SOC_SERIES_STM32L4X) || \
defined(CONFIG_SOC_SERIES_STM32G4X)
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
struct stm32_pclken pclken = {
#ifdef CONFIG_SOC_SERIES_STM32H7X
.bus = STM32_CLOCK_BUS_APB4,

View file

@ -199,7 +199,7 @@ static const struct i2c_driver_api api_funcs = {
static int i2c_stm32_init(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct i2c_stm32_config *cfg = dev->config;
uint32_t bitrate_cfg;
int ret;

View file

@ -70,7 +70,7 @@ static void cmd_ieee_csma_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
ARG_UNUSED(h);
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct ieee802154_cc13xx_cc26xx_data *drv_data = dev->data;
update_saved_cmdhandle(ch, (RF_CmdHandle *) &drv_data->saved_cmdhandle);
@ -86,7 +86,7 @@ static void cmd_ieee_rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{
ARG_UNUSED(h);
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct ieee802154_cc13xx_cc26xx_data *drv_data = dev->data;
update_saved_cmdhandle(ch, (RF_CmdHandle *) &drv_data->saved_cmdhandle);

View file

@ -135,7 +135,7 @@ static inline bool is_subghz(uint16_t channel)
static void cmd_prop_tx_adv_callback(RF_Handle h, RF_CmdHandle ch,
RF_EventMask e)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
RF_Op *op = RF_getCmdOp(h, ch);
@ -146,7 +146,7 @@ static void cmd_prop_tx_adv_callback(RF_Handle h, RF_CmdHandle ch,
static void cmd_prop_rx_adv_callback(RF_Handle h, RF_CmdHandle ch,
RF_EventMask e)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
RF_Op *op = RF_getCmdOp(h, ch);

View file

@ -431,7 +431,7 @@ DEVICE_DT_DEFINE(EXTI_NODE, &stm32_exti_init,
*/
int stm32_exti_set_callback(int line, stm32_exti_callback_t cb, void *arg)
{
const struct device *dev = DEVICE_DT_GET(EXTI_NODE);
const struct device *const dev = DEVICE_DT_GET(EXTI_NODE);
struct stm32_exti_data *data = dev->data;
if (data->cb[line].cb) {
@ -446,7 +446,7 @@ int stm32_exti_set_callback(int line, stm32_exti_callback_t cb, void *arg)
void stm32_exti_unset_callback(int line)
{
const struct device *dev = DEVICE_DT_GET(EXTI_NODE);
const struct device *const dev = DEVICE_DT_GET(EXTI_NODE);
struct stm32_exti_data *data = dev->data;
data->cb[line].cb = NULL;

View file

@ -85,7 +85,7 @@ static const uint8_t line2irq[NUM_EXTI_LINES] = {
__unused static void gd32_exti_isr(const void *isr_data)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct gd32_exti_data *data = dev->data;
const struct gd32_exti_range *range = isr_data;
@ -138,7 +138,7 @@ void gd32_exti_trigger(uint8_t line, uint8_t trigger)
int gd32_exti_configure(uint8_t line, gd32_exti_cb_t cb, void *user)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct gd32_exti_data *data = dev->data;
__ASSERT_NO_MSG(line < NUM_EXTI_LINES);

View file

@ -570,7 +570,7 @@ static uint32_t gicv3_its_get_msi_addr(const struct device *dev)
#define ITS_RDIST_MAP(n) \
{ \
const struct device *dev = DEVICE_DT_INST_GET(n); \
const struct device *const dev = DEVICE_DT_INST_GET(n); \
struct gicv3_its_data *data; \
int ret; \
\
@ -593,7 +593,7 @@ void its_rdist_map(void)
#define ITS_RDIST_INVALL(n) \
{ \
const struct device *dev = DEVICE_DT_INST_GET(n); \
const struct device *const dev = DEVICE_DT_INST_GET(n); \
struct gicv3_its_data *data; \
int ret; \
\

View file

@ -106,7 +106,7 @@ static int rv32m1_intmux_get_line_state(const struct device *dev,
static void rv32m1_intmux_isr(const void *arg)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
const struct rv32m1_intmux_config *config = dev->config;
INTMUX_Type *regs = DEV_REGS(dev);
uint32_t channel = POINTER_TO_UINT(arg);

View file

@ -95,7 +95,7 @@ static void sam0_eic_isr(const struct device *dev)
int sam0_eic_acquire(int port, int pin, enum sam0_eic_trigger trigger,
bool filter, sam0_eic_callback_t cb, void *data)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_port_data *port_data;
struct sam0_eic_line_assignment *line_assignment;
@ -185,7 +185,7 @@ err_in_use:
static bool sam0_eic_check_ownership(int port, int pin, int line_index)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_line_assignment *line_assignment =
&dev_data->lines[line_index];
@ -204,7 +204,7 @@ static bool sam0_eic_check_ownership(int port, int pin, int line_index)
int sam0_eic_release(int port, int pin)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct sam0_eic_data *dev_data = dev->data;
uint32_t mask;
int line_index;
@ -295,7 +295,7 @@ int sam0_eic_disable_interrupt(int port, int pin)
uint32_t sam0_eic_interrupt_pending(int port)
{
const struct device *dev = DEVICE_DT_INST_GET(0);
const struct device *const dev = DEVICE_DT_INST_GET(0);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_line_assignment *line_assignment;
uint32_t set = EIC->INTFLAG.reg;

View file

@ -152,7 +152,7 @@ static int stm32_hsem_mailbox_init(const struct device *dev)
{
struct stm32_hsem_mailbox_data *data = dev->data;
const struct stm32_hsem_mailbox_config *cfg = dev->config;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
/* Config transfer semaphore */
switch (CONFIG_IPM_STM32_HSEM_CPU) {

View file

@ -985,7 +985,7 @@ static void mux_setup(struct k_work *work)
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
struct gsm_modem *gsm = CONTAINER_OF(dwork, struct gsm_modem,
gsm_configure_work);
const struct device *uart = DEVICE_DT_GET(GSM_UART_NODE);
const struct device *const uart = DEVICE_DT_GET(GSM_UART_NODE);
int ret;
gsm_ppp_lock(gsm);

View file

@ -327,7 +327,7 @@ static int ps2_npcx_ctrl_init(const struct device *dev)
const struct ps2_npcx_ctrl_config *const config = dev->config;
struct ps2_npcx_ctrl_data *const data = dev->data;
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
const struct device *clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
const struct device *const clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
int ret;
if (!device_is_ready(clk_dev)) {

View file

@ -54,7 +54,7 @@ static int cmd_battery(const struct shell *shell, size_t argc, char **argv)
struct sensor_value temp, volt, current, i_desired, charge_remain;
struct sensor_value charge, v_desired, v_design, cap, nom_cap;
struct sensor_value full, empty;
const struct device *dev = DEVICE_DT_GET(DT_ALIAS(battery));
const struct device *const dev = DEVICE_DT_GET(DT_ALIAS(battery));
bool allowed;
int err;

View file

@ -126,7 +126,7 @@ static int uart_cmsdk_apb_init(const struct device *dev)
#ifdef CONFIG_CLOCK_CONTROL
/* Enable clock for subsystem */
const struct device *clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_IDX(0, 1));
const struct device *const clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_IDX(0, 1));
struct uart_cmsdk_apb_dev_data * const data = dev->data;
if (!device_is_ready(clk)) {

View file

@ -637,7 +637,7 @@ static int uart_stm32_err_check(const struct device *dev)
static inline void __uart_stm32_get_clock(const struct device *dev)
{
struct uart_stm32_data *data = dev->data;
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
data->clock = clk;
}

View file

@ -142,7 +142,7 @@ int spi_npcx_fiu_release(const struct device *dev,
static int spi_npcx_fiu_init(const struct device *dev)
{
const struct npcx_spi_fiu_config *const config = dev->config;
const struct device *clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
const struct device *const clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
int ret;
if (!device_is_ready(clk_dev)) {

View file

@ -188,7 +188,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
static int usb_dc_stm32_clock_enable(void)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
struct stm32_pclken pclken = {
.bus = USB_CLOCK_BUS,
.enr = USB_CLOCK_BITS,

View file

@ -87,7 +87,7 @@ static void wwdg_stm32_irq_config(const struct device *dev);
static uint32_t wwdg_stm32_get_pclk(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct wwdg_stm32_config *cfg = WWDG_STM32_CFG(dev);
uint32_t pclk_rate;
@ -277,7 +277,7 @@ static const struct wdt_driver_api wwdg_stm32_api = {
static int wwdg_stm32_init(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct wwdg_stm32_config *cfg = WWDG_STM32_CFG(dev);
wwdg_stm32_irq_config(dev);

View file

@ -375,7 +375,7 @@ __boot_func
void z_early_boot_rand_get(uint8_t *buf, size_t length)
{
#ifdef CONFIG_ENTROPY_HAS_DRIVER
const struct device *entropy = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_entropy));
const struct device *const entropy = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_entropy));
int rc;
if (!device_is_ready(entropy)) {

View file

@ -20,7 +20,7 @@ static uint32_t next(void)
void nrf_802154_random_init(void)
{
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
int err;
__ASSERT_NO_MSG(device_is_ready(dev));

View file

@ -45,7 +45,7 @@ static struct ipc_ept_cfg ept_cfg = {
nrf_802154_ser_err_t nrf_802154_backend_init(void)
{
const struct device *ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0));
const struct device *const ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0));
int err;
err = ipc_service_open_instance(ipc_instance);

View file

@ -26,7 +26,7 @@
#include <zephyr/bluetooth/gatt.h>
#ifdef CONFIG_TEMP_NRF5
static const struct device *temp_dev = DEVICE_DT_GET_ANY(nordic_nrf_temp);
static const struct device *const temp_dev = DEVICE_DT_GET_ANY(nordic_nrf_temp);
#else
static const struct device *temp_dev;
#endif

View file

@ -111,7 +111,7 @@ void main(void)
int ret;
const struct device *mic_dev = DEVICE_DT_GET_ONE(st_mpxxdtyy);
const struct device *const mic_dev = DEVICE_DT_GET_ONE(st_mpxxdtyy);
if (!device_is_ready(mic_dev)) {
printk("Device %s is not ready\n", mic_dev->name);

View file

@ -155,7 +155,7 @@ void main(void)
printk("ArgonKey test!!\n");
#ifdef CONFIG_LPS22HB
const struct device *baro_dev = DEVICE_DT_GET_ONE(st_lps22hb_press);
const struct device *const baro_dev = DEVICE_DT_GET_ONE(st_lps22hb_press);
if (!device_is_ready(baro_dev)) {
printk("%s: device not ready.\n", baro_dev->name);
@ -164,7 +164,7 @@ void main(void)
#endif
#ifdef CONFIG_HTS221
const struct device *hum_dev = DEVICE_DT_GET_ONE(st_hts221);
const struct device *const hum_dev = DEVICE_DT_GET_ONE(st_hts221);
if (!device_is_ready(hum_dev)) {
printk("%s: device not ready.\n", hum_dev->name);
@ -173,7 +173,7 @@ void main(void)
#endif
#ifdef CONFIG_LSM6DSL
const struct device *accel_dev = DEVICE_DT_GET_ONE(st_lsm6dsl);
const struct device *const accel_dev = DEVICE_DT_GET_ONE(st_lsm6dsl);
if (!device_is_ready(accel_dev)) {
printk("%s: device not ready.\n", accel_dev->name);
@ -237,7 +237,7 @@ void main(void)
#endif
#ifdef CONFIG_VL53L0X
const struct device *tof_dev = DEVICE_DT_GET_ONE(st_vl53l0x);
const struct device *const tof_dev = DEVICE_DT_GET_ONE(st_vl53l0x);
if (!device_is_ready(tof_dev)) {
printk("%s: device not ready.\n", tof_dev->name);

View file

@ -185,7 +185,7 @@ void main(void)
printk("nRF LED matrix sample on %s\n", CONFIG_BOARD);
int ret;
const struct device *dev = DEVICE_DT_GET_ONE(nordic_nrf_led_matrix);
const struct device *const dev = DEVICE_DT_GET_ONE(nordic_nrf_led_matrix);
if (!dev) {
printk("Display device not ready\n");

View file

@ -336,7 +336,7 @@ void main(void)
static uint8_t tx_buffer[TRANSFER_LENGTH];
static uint8_t rx_buffer[sizeof(tx_buffer)];
uint8_t fill_value = 0;
const struct device *spi_dev = DEVICE_DT_GET(SPI_DEV_NODE);
const struct device *const spi_dev = DEVICE_DT_GET(SPI_DEV_NODE);
if (!device_is_ready(spi_dev)) {
printk("%s is not ready\n", spi_dev->name);

View file

@ -38,7 +38,7 @@ SYS_INIT(disable_ds_1, PRE_KERNEL_2, 0);
void main(void)
{
int rc;
const struct device *cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
const struct device *const cons = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(cons)) {
printk("%s: device not ready.\n", cons->name);

View file

@ -251,7 +251,7 @@ void main(void)
{
static const struct gpio_dt_spec led0_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
static const struct gpio_dt_spec led1_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios);
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
int i, on = 1;
int cnt = 1;
uint32_t dtr = 0;
@ -290,13 +290,13 @@ void main(void)
printk("SensorTile.box test!!\n");
const struct device *hts221 = DEVICE_DT_GET_ONE(st_hts221);
const struct device *lis2dw12 = DEVICE_DT_GET_ONE(st_lis2dw12);
const struct device *lps22hh = DEVICE_DT_GET_ONE(st_lps22hh);
const struct device *lsm6dso = DEVICE_DT_GET_ONE(st_lsm6dso);
const struct device *stts751 = DEVICE_DT_GET_ONE(st_stts751);
const struct device *iis3dhhc = DEVICE_DT_GET_ONE(st_iis3dhhc);
const struct device *lis2mdl = DEVICE_DT_GET_ONE(st_lis2mdl);
const struct device *const hts221 = DEVICE_DT_GET_ONE(st_hts221);
const struct device *const lis2dw12 = DEVICE_DT_GET_ONE(st_lis2dw12);
const struct device *const lps22hh = DEVICE_DT_GET_ONE(st_lps22hh);
const struct device *const lsm6dso = DEVICE_DT_GET_ONE(st_lsm6dso);
const struct device *const stts751 = DEVICE_DT_GET_ONE(st_stts751);
const struct device *const iis3dhhc = DEVICE_DT_GET_ONE(st_iis3dhhc);
const struct device *const lis2mdl = DEVICE_DT_GET_ONE(st_lis2mdl);
if (!device_is_ready(hts221)) {
printk("%s: device not ready.\n", hts221->name);

View file

@ -34,7 +34,7 @@ void new_message_callback(const struct device *dev, void *user_data,
void main(void)
{
const struct device *ipm = DEVICE_DT_GET(DT_NODELABEL(mailbox));
const struct device *const ipm = DEVICE_DT_GET(DT_NODELABEL(mailbox));
printk("STM32 h7_dual_core application\n");

View file

@ -76,7 +76,7 @@ static int do_pdm_transfer(const struct device *dmic_dev,
void main(void)
{
const struct device *dmic_dev = DEVICE_DT_GET(DT_NODELABEL(dmic_dev));
const struct device *const dmic_dev = DEVICE_DT_GET(DT_NODELABEL(dmic_dev));
int ret;
LOG_INF("DMIC sample");

View file

@ -24,7 +24,7 @@
K_THREAD_STACK_DEFINE(rx_thread_stack, RX_THREAD_STACK_SIZE);
K_THREAD_STACK_DEFINE(poll_state_stack, STATE_POLL_THREAD_STACK_SIZE);
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
const struct device *const can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
struct gpio_dt_spec led = GPIO_DT_SPEC_GET_OR(DT_ALIAS(led0), gpios, {0});
struct k_thread rx_thread_data;

View file

@ -311,7 +311,7 @@ int litex_clk_test(const struct device *dev)
void main(void)
{
const struct device *dev = DEVICE_DT_GET(MMCM);
const struct device *const dev = DEVICE_DT_GET(MMCM);
printf("Clock Control Example! %s\n", CONFIG_ARCH);

View file

@ -74,7 +74,7 @@ static void test_counter_interrupt_fn(const struct device *counter_dev,
void main(void)
{
const struct device *counter_dev = DEVICE_DT_GET(TIMER);
const struct device *const counter_dev = DEVICE_DT_GET(TIMER);
int err;
printk("Counter alarm sample\n\n");

View file

@ -229,7 +229,7 @@ static void set_aligned_clock(const struct device *ds3231)
void main(void)
{
const struct device *ds3231 = DEVICE_DT_GET_ONE(maxim_ds3231);
const struct device *const ds3231 = DEVICE_DT_GET_ONE(maxim_ds3231);
if (!device_is_ready(ds3231)) {
printk("%s: device not ready.\n", ds3231->name);

View file

@ -613,7 +613,7 @@ void main(void)
return;
}
#else
const struct device *dev = DEVICE_DT_GET_ONE(CRYPTO_DEV_COMPAT);
const struct device *const dev = DEVICE_DT_GET_ONE(CRYPTO_DEV_COMPAT);
if (!device_is_ready(dev)) {
LOG_ERR("Crypto device is not ready\n");

View file

@ -22,7 +22,7 @@ struct perisistant_values {
*/
static const struct device *get_eeprom_device(void)
{
const struct device *dev = DEVICE_DT_GET(DT_ALIAS(eeprom_0));
const struct device *const dev = DEVICE_DT_GET(DT_ALIAS(eeprom_0));
if (!device_is_ready(dev)) {
printk("\nError: Device \"%s\" is not ready; "

View file

@ -13,7 +13,7 @@
#include "greenled.h"
#include <eoss3_dev.h>
const struct device *fpga = DEVICE_DT_GET(DT_NODELABEL(fpga0));
const struct device *const fpga = DEVICE_DT_GET(DT_NODELABEL(fpga0));
void main(void)
{

View file

@ -23,8 +23,8 @@ static void keyscan_callback(const struct device *dev, uint32_t row,
void main(void)
{
const struct device *led = DEVICE_DT_GET(LED_NODE);
const struct device *key = DEVICE_DT_GET(KEY_NODE);
const struct device *const led = DEVICE_DT_GET(LED_NODE);
const struct device *const key = DEVICE_DT_GET(KEY_NODE);
int err;
int i;

View file

@ -70,7 +70,7 @@ static int read_bytes(const struct device *i2c_dev, uint16_t addr,
void main(void)
{
const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c0));
const struct device *const i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c0));
uint8_t cmp_data[16];
uint8_t data[16];
int i, ret;

View file

@ -16,7 +16,7 @@
bool init_wm8731_i2c(void)
{
const struct device *i2c_dev = DEVICE_DT_GET(WM8731_I2C_NODE);
const struct device *const i2c_dev = DEVICE_DT_GET(WM8731_I2C_NODE);
/* Initialization data for WM8731 registers. */
static const uint8_t init[][2] = {

View file

@ -246,8 +246,8 @@ static bool trigger_command(const struct device *i2s_dev_rx,
void main(void)
{
const struct device *i2s_dev_rx = DEVICE_DT_GET(I2S_RX_NODE);
const struct device *i2s_dev_tx = DEVICE_DT_GET(I2S_TX_NODE);
const struct device *const i2s_dev_rx = DEVICE_DT_GET(I2S_RX_NODE);
const struct device *const i2s_dev_tx = DEVICE_DT_GET(I2S_TX_NODE);
struct i2s_config config;
printk("I2S echo sample\n");

View file

@ -274,7 +274,7 @@ static void dump_bytes(const struct jesd216_param_header *php,
void main(void)
{
const struct device *dev = DEVICE_DT_GET(FLASH_NODE);
const struct device *const dev = DEVICE_DT_GET(FLASH_NODE);
if (!device_is_ready(dev)) {
printf("%s: device not ready\n", dev->name);

View file

@ -15,7 +15,7 @@
LOG_MODULE_REGISTER(main);
const struct device *kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
const struct device *const kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
static struct k_timer typematic_timer;
static struct k_timer block_matrix_timer;

View file

@ -15,7 +15,7 @@
LOG_MODULE_REGISTER(main);
const struct device *kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
const struct device *const kscan_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_keyboard_scan));
static void k_callback(const struct device *dev, uint32_t row, uint32_t col,
bool pressed)

View file

@ -14,7 +14,7 @@
#define I2C_INST DT_NODELABEL(i2c0)
#define LCD_ADDRESS 0x28
const struct device *i2c = DEVICE_DT_GET(I2C_INST);
const struct device *const i2c = DEVICE_DT_GET(I2C_INST);
void send_ascii(char c)
{

View file

@ -527,7 +527,7 @@ void pi_lcd_init(const struct device *gpio_dev, uint8_t cols, uint8_t rows,
void main(void)
{
const struct device *gpio_dev = DEVICE_DT_GET(GPIO_NODE);
const struct device *const gpio_dev = DEVICE_DT_GET(GPIO_NODE);
if (!device_is_ready(gpio_dev)) {
printk("Device %s not ready!\n", gpio_dev->name);

View file

@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(app);
void main(void)
{
const struct device *led_dev = DEVICE_DT_GET_ANY(ti_lp3943);
const struct device *const led_dev = DEVICE_DT_GET_ANY(ti_lp3943);
int i, ret;
if (!led_dev) {

View file

@ -211,7 +211,7 @@ static int run_channel_test(const struct device *lp503x_dev)
void main(void)
{
const struct device *lp503x_dev = DEVICE_DT_GET_ANY(ti_lp503x);
const struct device *const lp503x_dev = DEVICE_DT_GET_ANY(ti_lp503x);
int err;
uint8_t led;

View file

@ -164,7 +164,7 @@ static int turn_off_all_leds(const struct device *dev)
void main(void)
{
const struct device *dev = DEVICE_DT_GET_ANY(ti_lp5562);
const struct device *const dev = DEVICE_DT_GET_ANY(ti_lp5562);
int i, ret;
if (!dev) {

View file

@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(main);
void main(void)
{
const struct device *led_dev = DEVICE_DT_GET_ANY(nxp_pca9633);
const struct device *const led_dev = DEVICE_DT_GET_ANY(nxp_pca9633);
int i, ret;
if (!led_dev) {

View file

@ -40,7 +40,7 @@ void lora_receive_cb(const struct device *dev, uint8_t *data, uint16_t size,
void main(void)
{
const struct device *lora_dev = DEVICE_DT_GET(DEFAULT_RADIO_NODE);
const struct device *const lora_dev = DEVICE_DT_GET(DEFAULT_RADIO_NODE);
struct lora_modem_config config;
int ret, len;
uint8_t data[MAX_DATA_LEN] = {0};

View file

@ -24,7 +24,7 @@ char data[MAX_DATA_LEN] = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'};
void main(void)
{
const struct device *lora_dev = DEVICE_DT_GET(DEFAULT_RADIO_NODE);
const struct device *const lora_dev = DEVICE_DT_GET(DEFAULT_RADIO_NODE);
struct lora_modem_config config;
int ret;

View file

@ -33,7 +33,7 @@ uint8_t clamp_rgb(int val)
void main(void)
{
const struct device *glcd = DEVICE_DT_GET(DT_NODELABEL(glcd));
const struct device *const glcd = DEVICE_DT_GET(DT_NODELABEL(glcd));
char str[20];
int rgb[] = { 0x0, 0x0, 0x0 };
uint8_t rgb_chg[3];

View file

@ -120,7 +120,7 @@ void test_8bit_xfer(const struct device *dev, struct spi_cs_control *cs)
void main(void)
{
const struct device *dev = DEVICE_DT_GET(SPIBB_NODE);
const struct device *const dev = DEVICE_DT_GET(SPIBB_NODE);
if (!device_is_ready(dev)) {
printk("%s: device not ready.\n", dev->name);

View file

@ -27,7 +27,7 @@ void main(void)
{
printk("DataFlash sample on %s\n", CONFIG_BOARD);
const struct device *flash_dev = DEVICE_DT_GET_ONE(atmel_at45);
const struct device *const flash_dev = DEVICE_DT_GET_ONE(atmel_at45);
int i;
int err;
uint8_t data;

View file

@ -12,8 +12,8 @@
#define UART_NODE1 DT_ALIAS(single_line_uart1)
#define UART_NODE2 DT_ALIAS(single_line_uart2)
const struct device *sl_uart1 = DEVICE_DT_GET(UART_NODE1);
const struct device *sl_uart2 = DEVICE_DT_GET(UART_NODE2);
const struct device *const sl_uart1 = DEVICE_DT_GET(UART_NODE1);
const struct device *const sl_uart2 = DEVICE_DT_GET(UART_NODE2);
void main(void)
{

View file

@ -20,7 +20,7 @@ void w1_search_callback(struct w1_rom rom, void *user_data)
void main(void)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(w1));
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(w1));
if (!device_is_ready(dev)) {
LOG_ERR("Device not ready");

View file

@ -58,7 +58,7 @@ void main(void)
{
int err;
int wdt_channel_id;
const struct device *wdt = DEVICE_DT_GET(DT_ALIAS(watchdog0));
const struct device *const wdt = DEVICE_DT_GET(DT_ALIAS(watchdog0));
printk("Watchdog sample application\n");

View file

@ -24,7 +24,7 @@
#define BUFLEN 300
int begin_index = 0;
const struct device *sensor = DEVICE_DT_GET_ONE(adi_adxl345);
const struct device *const sensor = DEVICE_DT_GET_ONE(adi_adxl345);
int current_index = 0;
float bufx[BUFLEN] = { 0.0f };

View file

@ -112,7 +112,7 @@ static void modem_off_cb(const struct device *dev, void *user_data)
int main(void)
{
const struct device *uart_dev = DEVICE_DT_GET(UART_NODE);
const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE);
/* Optional register modem power callbacks */
gsm_ppp_register_modem_power_callback(gsm_dev, modem_on_cb, modem_off_cb, NULL);

View file

@ -99,7 +99,7 @@ void threshold_trigger_handler(const struct device *dev,
void main(void)
{
const struct device *adc_cmp = DEVICE_DT_GET(ADC_CMP_NODE);
const struct device *const adc_cmp = DEVICE_DT_GET(ADC_CMP_NODE);
int err;
if (!device_is_ready(adc_cmp)) {

View file

@ -171,7 +171,7 @@ static void process(const struct device *dev)
void main(void)
{
const struct device *dev = DEVICE_DT_GET_ONE(adi_adt7420);
const struct device *const dev = DEVICE_DT_GET_ONE(adi_adt7420);
if (!device_is_ready(dev)) {
printk("sensor: device not ready.\n");

View file

@ -51,7 +51,7 @@ void print_buffer(void *ptr, size_t l)
void main(void)
{
int ret;
const struct device *dev = DEVICE_DT_GET_ONE(panasonic_amg88xx);
const struct device *const dev = DEVICE_DT_GET_ONE(panasonic_amg88xx);
if (!device_is_ready(dev)) {
printk("sensor: device not ready.\n");

View file

@ -16,7 +16,7 @@
*/
static const struct device *get_bme280_device(void)
{
const struct device *dev = DEVICE_DT_GET_ANY(bosch_bme280);
const struct device *const dev = DEVICE_DT_GET_ANY(bosch_bme280);
if (dev == NULL) {
/* No such node, or the node does not have status "okay". */

View file

@ -11,7 +11,7 @@
void main(void)
{
const struct device *dev = DEVICE_DT_GET_ONE(bosch_bme680);
const struct device *const dev = DEVICE_DT_GET_ONE(bosch_bme680);
struct sensor_value temp, press, humidity, gas_res;
if (!device_is_ready(dev)) {

View file

@ -172,7 +172,7 @@ static void test_trigger_mode(const struct device *bmg160)
void main(void)
{
const struct device *bmg160 = DEVICE_DT_GET_ANY(bosch_bmg160);
const struct device *const bmg160 = DEVICE_DT_GET_ANY(bosch_bmg160);
#if defined(CONFIG_BMG160_RANGE_RUNTIME)
struct sensor_value attr;
#endif

View file

@ -11,7 +11,7 @@
void main(void)
{
const struct device *dev = DEVICE_DT_GET_ONE(bosch_bmi270);
const struct device *const dev = DEVICE_DT_GET_ONE(bosch_bmi270);
struct sensor_value acc[3], gyr[3];
struct sensor_value full_scale, sampling_freq, oversampling;

Some files were not shown because too many files have changed in this diff Show more