This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fc28b93224bcb7596b0052f25a5a4fa6b80b49a2 Author: ouyangxiangzhen <[email protected]> AuthorDate: Thu Sep 11 16:19:44 2025 +0800 timers/oneshot: Remove all callback and args. This commit remove all callback and args in the APIs. Signed-off-by: ouyangxiangzhen <[email protected]> --- arch/arm/src/armv7-a/arm_timer.c | 2 -- arch/arm/src/armv7-r/arm_timer.c | 2 -- arch/arm/src/armv8-r/arm_timer.c | 3 +-- arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c | 4 +--- arch/arm/src/sama5/sam_oneshot_lowerhalf.c | 4 +--- arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c | 4 +--- arch/arm/src/samv7/sam_oneshot_lowerhalf.c | 4 +--- arch/arm/src/stm32/stm32_oneshot_lowerhalf.c | 4 +--- arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c | 4 +--- arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c | 4 +--- arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c | 6 ++---- arch/arm64/src/common/arm64_arch_timer.c | 3 +-- arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c | 4 +--- arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c | 6 +----- arch/risc-v/src/common/espressif/esp_oneshot.c | 15 +++------------ arch/risc-v/src/common/riscv_mtimer.c | 2 -- .../src/esp32c3-legacy/esp32c3_oneshot_lowerhalf.c | 6 ------ arch/sim/src/sim/sim_oneshot.c | 5 ++--- arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c | 8 +++----- arch/tricore/src/common/tricore_systimer.c | 2 -- arch/x86_64/src/intel64/intel64_oneshot_lower.c | 12 ++++-------- arch/xtensa/src/common/xtensa_oneshot.c | 2 -- arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c | 5 ----- arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c | 6 ------ arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c | 5 ----- drivers/audio/tone.c | 8 ++++---- drivers/timers/arch_alarm.c | 7 +++---- drivers/timers/goldfish_timer.c | 4 ---- drivers/timers/oneshot.c | 3 +-- drivers/timers/watchdog.c | 4 ++-- include/nuttx/timers/oneshot.h | 16 ++++++---------- sched/sched/sched_cpuload_oneshot.c | 3 +-- 32 files changed, 42 insertions(+), 125 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_timer.c b/arch/arm/src/armv7-a/arm_timer.c index f234acb5842..9d99152e3e1 100644 --- a/arch/arm/src/armv7-a/arm_timer.c +++ b/arch/arm/src/armv7-a/arm_timer.c @@ -76,7 +76,6 @@ struct arm_timer_lowerhalf_s static int arm_timer_maxdelay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int arm_timer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int arm_timer_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -168,7 +167,6 @@ static int arm_timer_maxdelay(struct oneshot_lowerhalf_s *lower_, } static int arm_timer_start(struct oneshot_lowerhalf_s *lower_, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct arm_timer_lowerhalf_s *lower = diff --git a/arch/arm/src/armv7-r/arm_timer.c b/arch/arm/src/armv7-r/arm_timer.c index 62a69e7e3f4..433c6a21fac 100644 --- a/arch/arm/src/armv7-r/arm_timer.c +++ b/arch/arm/src/armv7-r/arm_timer.c @@ -75,7 +75,6 @@ struct arm_timer_lowerhalf_s static int arm_timer_maxdelay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int arm_timer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int arm_timer_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -161,7 +160,6 @@ static int arm_timer_maxdelay(struct oneshot_lowerhalf_s *lower_, } static int arm_timer_start(struct oneshot_lowerhalf_s *lower_, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct arm_timer_lowerhalf_s *lower = diff --git a/arch/arm/src/armv8-r/arm_timer.c b/arch/arm/src/armv8-r/arm_timer.c index aacdd9b9e55..79f4d752f55 100644 --- a/arch/arm/src/armv8-r/arm_timer.c +++ b/arch/arm/src/armv8-r/arm_timer.c @@ -243,7 +243,6 @@ static int arm_cancel(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int arm_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { uint64_t count; @@ -251,7 +250,7 @@ static int arm_start(struct oneshot_lowerhalf_s *lower, (struct arm_oneshot_lowerhalf_s *)lower; uint64_t freq = priv->frequency; - DEBUGASSERT(priv && callback && ts); + DEBUGASSERT(priv && ts); /* Set the timeout */ diff --git a/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c b/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c index be01d5578cb..78427367cd0 100644 --- a/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c +++ b/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c @@ -69,7 +69,6 @@ static void sam_oneshot_handler(void *arg); static int sam_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int sam_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -181,7 +180,6 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct sam_oneshot_lowerhalf_s *priv = @@ -189,7 +187,7 @@ static int sam_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/sama5/sam_oneshot_lowerhalf.c b/arch/arm/src/sama5/sam_oneshot_lowerhalf.c index 735eaa0bdce..e937eb7d48f 100644 --- a/arch/arm/src/sama5/sam_oneshot_lowerhalf.c +++ b/arch/arm/src/sama5/sam_oneshot_lowerhalf.c @@ -71,7 +71,6 @@ static void sam_oneshot_handler(void *arg); static int sam_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int sam_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -183,7 +182,6 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct sam_oneshot_lowerhalf_s *priv = @@ -191,7 +189,7 @@ static int sam_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c b/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c index e4c8f2cf697..8df89f6b5d9 100644 --- a/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c +++ b/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c @@ -69,7 +69,6 @@ static void sam_oneshot_handler(void *arg); static int sam_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int sam_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -181,7 +180,6 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct sam_oneshot_lowerhalf_s *priv = @@ -189,7 +187,7 @@ static int sam_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/samv7/sam_oneshot_lowerhalf.c b/arch/arm/src/samv7/sam_oneshot_lowerhalf.c index 1822c3d27af..60362290bed 100644 --- a/arch/arm/src/samv7/sam_oneshot_lowerhalf.c +++ b/arch/arm/src/samv7/sam_oneshot_lowerhalf.c @@ -69,7 +69,6 @@ static void sam_oneshot_handler(void *arg); static int sam_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int sam_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -181,7 +180,6 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int sam_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct sam_oneshot_lowerhalf_s *priv = @@ -189,7 +187,7 @@ static int sam_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c index 2d6a2c7e6fd..a6afcd2a944 100644 --- a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c @@ -68,7 +68,6 @@ static void stm32_oneshot_handler(void *arg); static int stm32_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int stm32_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int stm32_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -180,7 +179,6 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int stm32_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct stm32_oneshot_lowerhalf_s *priv = @@ -188,7 +186,7 @@ static int stm32_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c b/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c index 8f80f9bec49..da8112d52ba 100644 --- a/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c +++ b/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c @@ -68,7 +68,6 @@ static void stm32_oneshot_handler(void *arg); static int stm32_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int stm32_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int stm32_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -180,7 +179,6 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int stm32_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct stm32_oneshot_lowerhalf_s *priv = @@ -188,7 +186,7 @@ static int stm32_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c b/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c index d217c341d5e..63d31d39f10 100644 --- a/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c +++ b/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c @@ -69,7 +69,6 @@ static void stm32l4_oneshot_handler(void *arg); static int stm32l4_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int stm32l4_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int stm32l4_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -181,7 +180,6 @@ static int stm32l4_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int stm32l4_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct stm32l4_oneshot_lowerhalf_s *priv = @@ -189,7 +187,7 @@ static int stm32l4_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c b/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c index cae5981a8e6..b1d3bebdfcd 100644 --- a/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c +++ b/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c @@ -69,7 +69,6 @@ static void stm32wb_oneshot_handler(void *arg); static int stm32wb_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int stm32wb_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int stm32wb_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -181,15 +180,14 @@ static int stm32wb_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int stm32wb_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, - const struct timespec *ts) + const struct timespec *ts) { struct stm32wb_oneshot_lowerhalf_s *priv = (struct stm32wb_oneshot_lowerhalf_s *)lower; irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/arm64/src/common/arm64_arch_timer.c b/arch/arm64/src/common/arm64_arch_timer.c index 89aa274ca0c..5c1bd0d89a4 100644 --- a/arch/arm64/src/common/arm64_arch_timer.c +++ b/arch/arm64/src/common/arm64_arch_timer.c @@ -235,7 +235,6 @@ static int arm64_cancel(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int arm64_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { uint64_t count; @@ -243,7 +242,7 @@ static int arm64_start(struct oneshot_lowerhalf_s *lower, (struct arm64_oneshot_lowerhalf_s *)lower; uint64_t freq = priv->frequency; - DEBUGASSERT(priv && callback && ts); + DEBUGASSERT(priv && ts); priv->running = this_cpu(); diff --git a/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c b/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c index e63b78c034c..8a7d8dd3a92 100644 --- a/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c +++ b/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c @@ -67,7 +67,6 @@ static void pic32mz_oneshot_handler(void *arg); static int pic32mz_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int pic32mz_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int pic32mz_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -182,7 +181,6 @@ static int pic32mz_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int pic32mz_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct pic32mz_oneshot_lowerhalf_s *priv = @@ -190,7 +188,7 @@ static int pic32mz_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c b/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c index f77194ccad4..4e7ee8b8c26 100644 --- a/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c +++ b/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c @@ -84,8 +84,6 @@ struct bl602_oneshot_lowerhalf_s static int bl602_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec * ts); static int bl602_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void * arg, const struct timespec * ts); static int bl602_cancel(struct oneshot_lowerhalf_s *lower, struct timespec * ts); @@ -229,8 +227,6 @@ static int bl602_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int bl602_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void * arg, const struct timespec * ts) { struct bl602_oneshot_lowerhalf_s *priv = @@ -238,7 +234,7 @@ static int bl602_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; uint64_t usec; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); if (priv->started == true) { diff --git a/arch/risc-v/src/common/espressif/esp_oneshot.c b/arch/risc-v/src/common/espressif/esp_oneshot.c index 732bd6b283a..75809226b32 100644 --- a/arch/risc-v/src/common/espressif/esp_oneshot.c +++ b/arch/risc-v/src/common/espressif/esp_oneshot.c @@ -97,8 +97,6 @@ static int esp_oneshot_isr(int irq, void *context, void *arg); static int esp_oneshot_maxdelay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int esp_oneshot_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts); static int esp_oneshot_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -193,8 +191,6 @@ static int esp_oneshot_maxdelay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int esp_oneshot_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts) { struct esp_oneshot_lowerhalf_s *priv = @@ -202,11 +198,9 @@ static int esp_oneshot_start(struct oneshot_lowerhalf_s *lower, uint64_t timeout_us; DEBUGASSERT(priv != NULL); - DEBUGASSERT(callback != NULL); DEBUGASSERT(ts != NULL); - tmrinfo("callback=%p arg=%p, ts=(%lu, %ld)\n", - callback, arg, (unsigned long)ts->tv_sec, ts->tv_nsec); + tmrinfo("ts=(%lu, %ld)\n", (unsigned long)ts->tv_sec, ts->tv_nsec); if (priv->running) { @@ -269,11 +263,8 @@ static int esp_oneshot_start(struct oneshot_lowerhalf_s *lower, /* Configure callback, in case a handler was provided before */ - if (priv->callback != NULL) - { - timer_ll_enable_intr(hal->dev, TIMER_LL_EVENT_ALARM(hal->timer_id), - true); - } + timer_ll_enable_intr(hal->dev, TIMER_LL_EVENT_ALARM(hal->timer_id), + true); /* Finally, start the timer */ diff --git a/arch/risc-v/src/common/riscv_mtimer.c b/arch/risc-v/src/common/riscv_mtimer.c index 23167a98658..4e1a632ad02 100644 --- a/arch/risc-v/src/common/riscv_mtimer.c +++ b/arch/risc-v/src/common/riscv_mtimer.c @@ -55,7 +55,6 @@ struct riscv_mtimer_lowerhalf_s static int riscv_mtimer_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int riscv_mtimer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int riscv_mtimer_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -137,7 +136,6 @@ static int riscv_mtimer_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int riscv_mtimer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct riscv_mtimer_lowerhalf_s *priv = diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_oneshot_lowerhalf.c b/arch/risc-v/src/esp32c3-legacy/esp32c3_oneshot_lowerhalf.c index dc5f2853b8b..6a620fbd570 100644 --- a/arch/risc-v/src/esp32c3-legacy/esp32c3_oneshot_lowerhalf.c +++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_oneshot_lowerhalf.c @@ -72,8 +72,6 @@ static void esp32c3_oneshot_lh_handler(void *arg); static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts); static int oneshot_lh_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -187,8 +185,6 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts) { struct esp32c3_oneshot_lowerhalf_s *priv = @@ -197,8 +193,6 @@ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; DEBUGASSERT(priv != NULL); - DEBUGASSERT(callback != NULL); - DEBUGASSERT(arg != NULL); DEBUGASSERT(ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/sim/src/sim/sim_oneshot.c b/arch/sim/src/sim/sim_oneshot.c index d9b0133cc2c..02b787f853f 100644 --- a/arch/sim/src/sim/sim_oneshot.c +++ b/arch/sim/src/sim/sim_oneshot.c @@ -74,7 +74,6 @@ static void sim_process_tick(sq_entry_t *entry); static int sim_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int sim_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int sim_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -290,14 +289,14 @@ static int sim_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int sim_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct sim_oneshot_lowerhalf_s *priv = (struct sim_oneshot_lowerhalf_s *)lower; + struct timespec current; irqstate_t flags; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); flags = enter_critical_section(); diff --git a/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c b/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c index 16bbbffe043..d3a7cb5ed52 100644 --- a/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c +++ b/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c @@ -71,8 +71,7 @@ static void bm3803_oneshot_handler(void *arg); static int bm3803_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int bm3803_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, - const struct timespec *ts); + const struct timespec *ts); static int bm3803_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -183,15 +182,14 @@ static int bm3803_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int bm3803_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, - const struct timespec *ts) + const struct timespec *ts) { struct bm3803_oneshot_lowerhalf_s *priv = (struct bm3803_oneshot_lowerhalf_s *)lower; irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/tricore/src/common/tricore_systimer.c b/arch/tricore/src/common/tricore_systimer.c index 6405cd8478b..7ac11436dee 100644 --- a/arch/tricore/src/common/tricore_systimer.c +++ b/arch/tricore/src/common/tricore_systimer.c @@ -59,7 +59,6 @@ struct tricore_systimer_lowerhalf_s static int tricore_systimer_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int tricore_systimer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int tricore_systimer_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -168,7 +167,6 @@ static int tricore_systimer_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int tricore_systimer_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct tricore_systimer_lowerhalf_s *priv = diff --git a/arch/x86_64/src/intel64/intel64_oneshot_lower.c b/arch/x86_64/src/intel64/intel64_oneshot_lower.c index 126f7c5b6b8..d8c6dd92345 100644 --- a/arch/x86_64/src/intel64/intel64_oneshot_lower.c +++ b/arch/x86_64/src/intel64/intel64_oneshot_lower.c @@ -60,16 +60,14 @@ static void intel64_oneshot_handler(void *arg); static int intel64_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int intel64_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, - const struct timespec *ts); + const struct timespec *ts); static int intel64_cancel(struct oneshot_lowerhalf_s *lower, - struct timespec *ts); + struct timespec *ts); static int intel64_current(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int intel64_tick_max_delay(struct oneshot_lowerhalf_s *lower, clock_t *ticks); static int intel64_tick_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, clock_t ticks); static int intel64_tick_cancel(struct oneshot_lowerhalf_s *lower, clock_t *ticks); @@ -190,7 +188,6 @@ static int intel64_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int intel64_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct intel64_oneshot_lowerhalf_s *priv = @@ -198,7 +195,7 @@ static int intel64_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; int ret; - DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); + DEBUGASSERT(priv != NULL && ts != NULL); /* Save the callback information and start the timer */ @@ -352,7 +349,6 @@ static int intel64_tick_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int intel64_tick_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, clock_t ticks) { struct timespec ts; @@ -361,7 +357,7 @@ static int intel64_tick_start(struct oneshot_lowerhalf_s *lower, clock_ticks2time(&ts, ticks); - return intel64_start(lower, callback, arg, &ts); + return intel64_start(lower, &ts); } /**************************************************************************** diff --git a/arch/xtensa/src/common/xtensa_oneshot.c b/arch/xtensa/src/common/xtensa_oneshot.c index 4317070acf9..c3bf1b151c8 100644 --- a/arch/xtensa/src/common/xtensa_oneshot.c +++ b/arch/xtensa/src/common/xtensa_oneshot.c @@ -57,7 +57,6 @@ struct xoneshot_lowerhalf_s static int xtensa_oneshot_maxdelay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int xtensa_oneshot_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, void *arg, const struct timespec *ts); static int xtensa_oneshot_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -93,7 +92,6 @@ static inline uint64_t sec_to_count(uint32_t sec, uint32_t freq) } static int xtensa_oneshot_start(struct oneshot_lowerhalf_s *lower_, - oneshot_callback_t callback, void *arg, const struct timespec *ts) { struct xoneshot_lowerhalf_s *lower = diff --git a/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c b/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c index e9945d0d2e0..4adba56bf95 100644 --- a/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c +++ b/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c @@ -73,8 +73,6 @@ static void esp32_oneshot_lh_handler(void *arg); static int esp32_max_lh_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int esp32_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts); static int esp32_lh_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -184,8 +182,6 @@ static int esp32_max_lh_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int esp32_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts) { struct esp32_oneshot_lowerhalf_s *priv = @@ -194,7 +190,6 @@ static int esp32_lh_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; DEBUGASSERT(priv != NULL); - DEBUGASSERT(callback != NULL); DEBUGASSERT(ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c b/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c index 26083bbc62e..3f52825dbfd 100644 --- a/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c +++ b/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c @@ -70,8 +70,6 @@ static void esp32s2_oneshot_lh_handler(void *arg); static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts); static int oneshot_lh_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -185,8 +183,6 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts) { struct esp32s2_oneshot_lowerhalf_s *priv = @@ -195,8 +191,6 @@ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; DEBUGASSERT(priv != NULL); - DEBUGASSERT(callback != NULL); - DEBUGASSERT(arg != NULL); DEBUGASSERT(ts != NULL); /* Save the callback information and start the timer */ diff --git a/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c b/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c index 65e9992c6b8..53d4481ffe0 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c +++ b/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c @@ -72,8 +72,6 @@ static void oneshot_lh_handler(void *arg); static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, struct timespec *ts); static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts); static int oneshot_lh_cancel(struct oneshot_lowerhalf_s *lower, struct timespec *ts); @@ -185,8 +183,6 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, - void *arg, const struct timespec *ts) { struct esp32s3_oneshot_lowerhalf_s *priv = @@ -195,7 +191,6 @@ static int oneshot_lh_start(struct oneshot_lowerhalf_s *lower, irqstate_t flags; DEBUGASSERT(priv != NULL); - DEBUGASSERT(callback != NULL); DEBUGASSERT(ts != NULL); /* Save the callback information and start the timer */ diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index dd4730d688d..93247fe57b3 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -390,7 +390,7 @@ static void next_note(FAR struct tone_upperhalf_s *upper) ts.tv_sec = (time_t) sec; ts.tv_nsec = (unsigned long)nsec; - ONESHOT_START(upper->oneshot, oneshot_callback, upper, &ts); + ONESHOT_START(upper->oneshot, &ts); g_silence_length = 0; return; @@ -524,7 +524,7 @@ static void next_note(FAR struct tone_upperhalf_s *upper) ts.tv_sec = (time_t) sec; ts.tv_nsec = (unsigned long)nsec; - ONESHOT_START(upper->oneshot, oneshot_callback, upper, &ts); + ONESHOT_START(upper->oneshot, &ts); return; /* Change tempo */ @@ -567,7 +567,7 @@ static void next_note(FAR struct tone_upperhalf_s *upper) ts.tv_sec = (time_t) sec; ts.tv_nsec = (unsigned long)nsec; - ONESHOT_START(upper->oneshot, oneshot_callback, upper, &ts); + ONESHOT_START(upper->oneshot, &ts); return; } @@ -651,7 +651,7 @@ static void next_note(FAR struct tone_upperhalf_s *upper) /* And arrange a callback when the note should stop */ - ONESHOT_START(upper->oneshot, oneshot_callback, upper, &ts); + ONESHOT_START(upper->oneshot, &ts); return; /* Tune looks bad (unexpected EOF, bad character, etc.) */ diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c index 6a345ed2fd5..09adbdb45da 100644 --- a/drivers/timers/arch_alarm.c +++ b/drivers/timers/arch_alarm.c @@ -59,7 +59,7 @@ static void oneshot_callback(FAR struct oneshot_lowerhalf_s *lower, * atomically w. respect to a HW timer */ - ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback, NULL, 1); + ONESHOT_TICK_START(g_oneshot_lower, 1); /* It is always an error if this progresses more than 1 tick at a time. * That would break any timer based on wdog; such timers might timeout @@ -98,7 +98,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower) g_oneshot_maxticks = ticks < UINT32_MAX ? ticks : UINT32_MAX; #else ONESHOT_TICK_CURRENT(g_oneshot_lower, &g_current_tick); - ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback, NULL, 1); + ONESHOT_TICK_START(g_oneshot_lower, 1); #endif } @@ -272,8 +272,7 @@ int weak_function up_alarm_tick_start(clock_t ticks) delta = 0; } - ret = ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback, - NULL, delta); + ret = ONESHOT_TICK_START(g_oneshot_lower, delta); } return ret; diff --git a/drivers/timers/goldfish_timer.c b/drivers/timers/goldfish_timer.c index afd680c8fc5..5e8d1a2d746 100644 --- a/drivers/timers/goldfish_timer.c +++ b/drivers/timers/goldfish_timer.c @@ -75,8 +75,6 @@ struct goldfish_timer_lowerhalf_s static int goldfish_timer_maxdelay(FAR struct oneshot_lowerhalf_s *lower, FAR struct timespec *ts); static int goldfish_timer_start(FAR struct oneshot_lowerhalf_s *lower, - FAR oneshot_callback_t callback, - FAR void *arg, FAR const struct timespec *ts); static int goldfish_timer_cancel(FAR struct oneshot_lowerhalf_s *lower, FAR struct timespec *ts); @@ -109,8 +107,6 @@ static int goldfish_timer_maxdelay(FAR struct oneshot_lowerhalf_s *lower_, } static int goldfish_timer_start(FAR struct oneshot_lowerhalf_s *lower_, - FAR oneshot_callback_t callback, - FAR void *arg, FAR const struct timespec *ts) { FAR struct goldfish_timer_lowerhalf_s *lower = diff --git a/drivers/timers/oneshot.c b/drivers/timers/oneshot.c index 9b78a8573bd..9c1204fa8c0 100644 --- a/drivers/timers/oneshot.c +++ b/drivers/timers/oneshot.c @@ -215,8 +215,7 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg) /* Start the oneshot timer */ - ret = ONESHOT_START(priv->od_lower, oneshot_callback, priv, - &start->ts); + ret = ONESHOT_START(priv->od_lower, &start->ts); } break; diff --git a/drivers/timers/watchdog.c b/drivers/timers/watchdog.c index 9e87eaba366..7ec6d33c432 100644 --- a/drivers/timers/watchdog.c +++ b/drivers/timers/watchdog.c @@ -187,7 +187,7 @@ watchdog_automonitor_oneshot(FAR struct oneshot_lowerhalf_s *oneshot, }; lower->ops->keepalive(lower); - ONESHOT_START(oneshot, watchdog_automonitor_oneshot, upper, &ts); + ONESHOT_START(oneshot, &ts); } } #elif defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_TIMER) @@ -275,7 +275,7 @@ watchdog_automonitor_start(FAR struct watchdog_upperhalf_s *upper) }; upper->oneshot = oneshot; - ONESHOT_START(oneshot, watchdog_automonitor_oneshot, upper, &ts); + ONESHOT_START(oneshot, &ts); #elif defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_TIMER) upper->timer = timer; timer->ops->setcallback(timer, watchdog_automonitor_timer, upper); diff --git a/include/nuttx/timers/oneshot.h b/include/nuttx/timers/oneshot.h index e713a13f0e2..747d494ab73 100644 --- a/include/nuttx/timers/oneshot.h +++ b/include/nuttx/timers/oneshot.h @@ -120,10 +120,10 @@ * ****************************************************************************/ -#define ONESHOT_START(l,h,a,t) \ - ((l)->ops->start ? (l)->ops->start(l,h,a,t) : oneshot_start(l,h,a,t)) -#define ONESHOT_TICK_START(l,h,a,t) \ - ((l)->ops->tick_start ? (l)->ops->tick_start(l,h,a,t) : oneshot_tick_start(l,h,a,t)) +#define ONESHOT_START(l,t) \ + ((l)->ops->start ? (l)->ops->start(l,t) : oneshot_start(l,t)) +#define ONESHOT_TICK_START(l,t) \ + ((l)->ops->tick_start ? (l)->ops->tick_start(l,t) : oneshot_tick_start(l,t)) /**************************************************************************** * Name: ONESHOT_CANCEL @@ -202,7 +202,6 @@ struct oneshot_operations_s CODE int (*max_delay)(FAR struct oneshot_lowerhalf_s *lower, FAR struct timespec *ts); CODE int (*start)(FAR struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, FAR void *arg, FAR const struct timespec *ts); CODE int (*cancel)(FAR struct oneshot_lowerhalf_s *lower, FAR struct timespec *ts); @@ -211,7 +210,6 @@ struct oneshot_operations_s CODE int (*tick_max_delay)(FAR struct oneshot_lowerhalf_s *lower, FAR clock_t *ticks); CODE int (*tick_start)(FAR struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, FAR void *arg, clock_t ticks); CODE int (*tick_cancel)(FAR struct oneshot_lowerhalf_s *lower, FAR clock_t *ticks); @@ -284,7 +282,6 @@ int oneshot_max_delay(FAR struct oneshot_lowerhalf_s *lower, static inline int oneshot_start(FAR struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, FAR void *arg, FAR const struct timespec *ts) { clock_t tick; @@ -295,7 +292,7 @@ int oneshot_start(FAR struct oneshot_lowerhalf_s *lower, } tick = clock_time2ticks(ts); - return lower->ops->tick_start(lower, callback, arg, tick); + return lower->ops->tick_start(lower, tick); } static inline @@ -353,7 +350,6 @@ int oneshot_tick_max_delay(FAR struct oneshot_lowerhalf_s *lower, static inline int oneshot_tick_start(FAR struct oneshot_lowerhalf_s *lower, - oneshot_callback_t callback, FAR void *arg, clock_t ticks) { struct timespec ts; @@ -364,7 +360,7 @@ int oneshot_tick_start(FAR struct oneshot_lowerhalf_s *lower, } clock_ticks2time(&ts, ticks); - return lower->ops->start(lower, callback, arg, &ts); + return lower->ops->start(lower, &ts); } static inline diff --git a/sched/sched/sched_cpuload_oneshot.c b/sched/sched/sched_cpuload_oneshot.c index 78bafd8ea3c..608a14b74bd 100644 --- a/sched/sched/sched_cpuload_oneshot.c +++ b/sched/sched/sched_cpuload_oneshot.c @@ -199,8 +199,7 @@ static void nxsched_oneshot_start(void) ts.tv_sec = secs; ts.tv_nsec = 1000 * usecs; - DEBUGVERIFY(ONESHOT_START(g_sched_oneshot.oneshot, - nxsched_oneshot_callback, NULL, &ts)); + DEBUGVERIFY(ONESHOT_START(g_sched_oneshot.oneshot, &ts)); } /****************************************************************************
