Skip to content

Commit 593e2b5

Browse files
mjchen0jhedberg
authored andcommitted
drivers: mbox: imx_mu: Remove extra interrupt handler layer
Change to pass the device node to IRQ_CONNECT and remove the intermediate interrupt handler that has to call DEVICE_DT_INST_GET() to get the device pointer. Signed-off-by: Mike J. Chen <[email protected]>
1 parent 04778ff commit 593e2b5

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

drivers/mbox/mbox_nxp_imx_mu.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,41 +155,29 @@ static DEVICE_API(mbox, nxp_imx_mu_driver_api) = {
155155
.set_enabled = nxp_imx_mu_set_enabled,
156156
};
157157

158-
static void handle_irq(const struct device *dev);
158+
static void mu_isr(const struct device *dev);
159159

160160
#define MU_INSTANCE_DEFINE(idx) \
161161
static struct nxp_imx_mu_data nxp_imx_mu_##idx##_data; \
162162
const static struct nxp_imx_mu_config nxp_imx_mu_##idx##_config = { \
163163
.base = (MU_Type *)DT_INST_REG_ADDR(idx), \
164164
}; \
165-
void MU_##idx##_IRQHandler(void); \
166165
static int nxp_imx_mu_##idx##_init(const struct device *dev) \
167166
{ \
168167
ARG_UNUSED(dev); \
169168
MU_Init(nxp_imx_mu_##idx##_config.base); \
170-
IRQ_CONNECT(DT_INST_IRQN(idx), DT_INST_IRQ(idx, priority), MU_##idx##_IRQHandler, \
171-
NULL, 0); \
169+
IRQ_CONNECT(DT_INST_IRQN(idx), DT_INST_IRQ(idx, priority), mu_isr, \
170+
DEVICE_DT_INST_GET(idx), 0); \
172171
irq_enable(DT_INST_IRQN(idx)); \
173172
return 0; \
174173
} \
175174
DEVICE_DT_INST_DEFINE(idx, nxp_imx_mu_##idx##_init, NULL, &nxp_imx_mu_##idx##_data, \
176175
&nxp_imx_mu_##idx##_config, PRE_KERNEL_1, CONFIG_MBOX_INIT_PRIORITY, \
177176
&nxp_imx_mu_driver_api)
178177

179-
#define MU_IRQ_HANDLER(idx) \
180-
void MU_##idx##_IRQHandler(void) \
181-
{ \
182-
const struct device *dev = DEVICE_DT_INST_GET(idx); \
183-
handle_irq(dev); \
184-
}
185-
186-
#define MU_INST(idx) \
187-
MU_INSTANCE_DEFINE(idx); \
188-
MU_IRQ_HANDLER(idx);
189-
190-
DT_INST_FOREACH_STATUS_OKAY(MU_INST)
178+
DT_INST_FOREACH_STATUS_OKAY(MU_INSTANCE_DEFINE)
191179

192-
static void handle_irq(const struct device *dev)
180+
static void mu_isr(const struct device *dev)
193181
{
194182
struct nxp_imx_mu_data *data = dev->data;
195183
const struct nxp_imx_mu_config *config = dev->config;

0 commit comments

Comments
 (0)