From 9db97fc08fa92c95accef076be73079c76520b5c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 17 Aug 2022 13:21:06 +0200 Subject: [PATCH] drivers: intc: miwu: remove redundant declarations Remove redundant definitions by defining at the top before variable is used. Also constify device array. Signed-off-by: Gerard Marull-Paretas --- drivers/interrupt_controller/intc_miwu.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/interrupt_controller/intc_miwu.c b/drivers/interrupt_controller/intc_miwu.c index 1cf3f07d6b9..509f90386ea 100644 --- a/drivers/interrupt_controller/intc_miwu.c +++ b/drivers/interrupt_controller/intc_miwu.c @@ -59,8 +59,15 @@ #include LOG_MODULE_REGISTER(intc_miwu, LOG_LEVEL_ERR); -/* MIWU module instances forward declaration */ -static const struct device *miwu_devs[]; +/* MIWU module instances */ +#define NPCX_MIWU_DEV(inst) DEVICE_DT_INST_GET(inst), + +static const struct device *const miwu_devs[] = { + DT_INST_FOREACH_STATUS_OKAY(NPCX_MIWU_DEV) +}; + +BUILD_ASSERT(ARRAY_SIZE(miwu_devs) == NPCX_MIWU_TABLE_COUNT, + "Size of miwu_devs array must equal to NPCX_MIWU_TABLE_COUNT"); /* Driver config */ struct intc_miwu_config { @@ -390,13 +397,3 @@ int npcx_miwu_manage_dev_callback(struct miwu_dev_callback *cb, bool set) NPCX_MIWU_INIT_FUNC_IMPL(inst) DT_INST_FOREACH_STATUS_OKAY(NPCX_MIWU_INIT) - -/* MIWU module instances */ -#define NPCX_MIWU_DEV(inst) DEVICE_DT_INST_GET(inst), - -static const struct device *miwu_devs[] = { - DT_INST_FOREACH_STATUS_OKAY(NPCX_MIWU_DEV) -}; - -BUILD_ASSERT(ARRAY_SIZE(miwu_devs) == NPCX_MIWU_TABLE_COUNT, - "Size of miwu_devs array must equal to NPCX_MIWU_TABLE_COUNT");