From 0a8be84033e7d93e8757465aff0bb005c06daade Mon Sep 17 00:00:00 2001 From: Kerogit Date: Wed, 7 Jan 2026 07:50:12 +0100 Subject: [PATCH] arch/avr/src/avrdx: remove unused variable and update comment Commit e5db83d7dbb0 introduced a change to the file updated by this patch which caused a build-time warning about unused variable. This patch removes declaration of the variable from the code. This patch also updates comment that relates to what was changed in the commit. Patch was tested by building breadxavr:nsh - resulting binary is identical (by SHA256 checksum) and the warning is no longer present. Signed-off-by: Kerogit --- .../src/avrdx/avrdx_timerisr_tickless_alarm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c b/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c index 070dc00f345..323bcd8e53c 100644 --- a/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c +++ b/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c @@ -233,7 +233,6 @@ static void avrdx_deactivate_alarm(void) static void avrdx_check_alarm_expired(uint8_t context) { - struct timespec tv; int32_t sec_diff; uint32_t nsec_diff; int16_t interval; @@ -270,10 +269,17 @@ static void avrdx_check_alarm_expired(uint8_t context) * context. Remove non-interrupt flags from the context before * using it. * - * This possibly incurs small error (delay between alarm expiration - * and time read) but alarm must be deactivated first. up_timer_gettime - * will attempt to update time and that method in turn calls this one - * and the program will run into recursion loop + * Deactivate alarm first. Call to nxsched_timer_expiration() + * in turns calls up_timer_gettick(), that one calls + * up_timer_gettime() which calls this method through + * avrdx_increment_uptime(), causing a recursion loop. + * + * (Note that previous version of this code called + * nxsched_alarm_expiration() which does not exist now. + * That function needed struct timespec as a parameter which + * we obtained using up_timer_gettime (here), causing the same loop. + * Therefore, we always deactivate the alarm first before calling + * common code, even if it incurs a small timing error.) */ avrdx_deactivate_alarm();