Skip to content

Commit ceb02b3

Browse files
fabiobaltiericarlescufi
authored andcommitted
intc: intc_nxp_pint: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system to track the device dependencies and ensure that the interrupt controller is initialized before other devices using it. Adjust some DT_INST macro as well while at it. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent e9a67aa commit ceb02b3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/interrupt_controller/intc_nxp_pint.c

+8-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/* Based on STM32 EXTI driver, which is (c) 2016 Open-RnD Sp. z o.o. */
88

9-
#include <zephyr/init.h>
9+
#include <zephyr/device.h>
1010
#include <zephyr/irq.h>
1111
#include <errno.h>
1212
#include <zephyr/drivers/interrupt_controller/nxp_pint.h>
@@ -15,9 +15,7 @@
1515

1616
#define DT_DRV_COMPAT nxp_pint
1717

18-
#define PINT_NODE DT_INST(0, DT_DRV_COMPAT)
19-
20-
static PINT_Type *pint_base = (PINT_Type *)DT_REG_ADDR(PINT_NODE);
18+
static PINT_Type *pint_base = (PINT_Type *)DT_INST_REG_ADDR(0);
2119

2220
/* Describes configuration of PINT IRQ slot */
2321
struct pint_irq_slot {
@@ -30,9 +28,9 @@ struct pint_irq_slot {
3028
#define NO_PINT_ID 0xFF
3129

3230
/* Tracks IRQ configuration for each pint interrupt source */
33-
static struct pint_irq_slot pint_irq_cfg[DT_PROP(PINT_NODE, num_lines)];
31+
static struct pint_irq_slot pint_irq_cfg[DT_INST_PROP(0, num_lines)];
3432
/* Tracks pint interrupt source selected for each pin */
35-
static uint8_t pin_pint_id[DT_PROP(PINT_NODE, num_inputs)];
33+
static uint8_t pin_pint_id[DT_INST_PROP(0, num_inputs)];
3634

3735
#define PIN_TO_INPUT_MUX_CONNECTION(pin) \
3836
((PINTSEL_PMUX_ID << PMUX_SHIFT) + (pin))
@@ -188,17 +186,17 @@ static void nxp_pint_isr(uint8_t *slot)
188186
irq_enable(DT_IRQ_BY_IDX(node_id, idx, irq)); \
189187
} while (false)))
190188

191-
static int intc_nxp_pint_init(void)
189+
static int intc_nxp_pint_init(const struct device *dev)
192190
{
193191
/* First, connect IRQs for each interrupt.
194192
* The IRQ handler will receive the PINT slot as a
195193
* parameter.
196194
*/
197-
LISTIFY(8, NXP_PINT_IRQ, (;), PINT_NODE);
195+
LISTIFY(8, NXP_PINT_IRQ, (;), DT_INST(0, DT_DRV_COMPAT));
198196
PINT_Init(pint_base);
199197
memset(pin_pint_id, NO_PINT_ID, ARRAY_SIZE(pin_pint_id));
200198
return 0;
201199
}
202200

203-
SYS_INIT(intc_nxp_pint_init, PRE_KERNEL_1,
204-
CONFIG_INTC_INIT_PRIORITY);
201+
DEVICE_DT_INST_DEFINE(0, intc_nxp_pint_init, NULL, NULL, NULL,
202+
PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL);

0 commit comments

Comments
 (0)