From fe70e480f4566c366ca4b4913982400a1e072ba9 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 9 May 2025 16:00:43 +0200 Subject: [PATCH] drivers/counter native_sim: Avoid reusing tag name Don't use the same name for the structure instance and type. As that is a violation of MISRA-C 2012 rule 5.7. Signed-off-by: Alberto Escolar Piedras --- drivers/counter/counter_native_sim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/counter/counter_native_sim.c b/drivers/counter/counter_native_sim.c index c044f8eef3d..87a21280b9f 100644 --- a/drivers/counter/counter_native_sim.c +++ b/drivers/counter/counter_native_sim.c @@ -32,7 +32,7 @@ static struct counter_alarm_cfg pending_alarm[DRIVER_CONFIG_INFO_CHANNELS]; static bool is_alarm_pending[DRIVER_CONFIG_INFO_CHANNELS]; static struct counter_top_cfg top; static bool is_top_set; -static const struct device *device; +static const struct device *dev_p; static void schedule_next_isr(void) { @@ -67,7 +67,7 @@ static void counter_isr(const void *arg) if (is_alarm_pending[i] && (current_value == pending_alarm[i].ticks)) { is_alarm_pending[i] = false; if (pending_alarm[i].callback) { - pending_alarm[i].callback(device, i, current_value, + pending_alarm[i].callback(dev_p, i, current_value, pending_alarm[i].user_data); } } @@ -75,7 +75,7 @@ static void counter_isr(const void *arg) if (is_top_set && (current_value == top.ticks)) { if (top.callback) { - top.callback(device, top.user_data); + top.callback(dev_p, top.user_data); } } @@ -84,7 +84,7 @@ static void counter_isr(const void *arg) static int ctr_init(const struct device *dev) { - device = dev; + dev_p = dev; memset(is_alarm_pending, 0, sizeof(is_alarm_pending)); is_top_set = false; top.ticks = TOP_VALUE;