diff --git a/arch/arm/src/cxd56xx/cxd56_cisif.c b/arch/arm/src/cxd56xx/cxd56_cisif.c index 33c9529a67e..c7e2bdf1e7c 100644 --- a/arch/arm/src/cxd56xx/cxd56_cisif.c +++ b/arch/arm/src/cxd56xx/cxd56_cisif.c @@ -286,10 +286,7 @@ static uint64_t cisif_get_msec_time(void) { struct timespec tp; - if (clock_systime_timespec(&tp) < 0) - { - return 0; - } + clock_systime_timespec(&tp); return (((uint64_t)tp.tv_sec) * 1000 + tp.tv_nsec / 1000000); } diff --git a/arch/arm/src/cxd56xx/cxd56_nxaudio.c b/arch/arm/src/cxd56xx/cxd56_nxaudio.c index a29e72ddbaa..0e20e5d7fc9 100644 --- a/arch/arm/src/cxd56xx/cxd56_nxaudio.c +++ b/arch/arm/src/cxd56xx/cxd56_nxaudio.c @@ -2094,15 +2094,10 @@ static int cxd56_power_on_micbias(struct cxd56_dev_s *dev) /* Set mic boot time */ - if (clock_systime_timespec(&start) < 0) - { - dev->mic_boot_start = 0x0ull; - } - else - { - dev->mic_boot_start = (uint64_t)start.tv_sec * 1000 + - (uint64_t)start.tv_nsec / 1000000; - } + clock_systime_timespec(&start); + + dev->mic_boot_start = (uint64_t)start.tv_sec * 1000 + + (uint64_t)start.tv_nsec / 1000000; return OK; } @@ -2953,16 +2948,16 @@ static int cxd56_start(struct audio_lowerhalf_s *lower) if (priv->mic_boot_start != 0x0ull) { struct timespec end; - if (clock_systime_timespec(&end) == 0) - { - uint64_t time = (uint64_t)end.tv_sec * 1000 + - (uint64_t)end.tv_nsec / 1000000 - - priv->mic_boot_start; - if (time < CXD56_MIC_BOOT_WAIT) - { - nxsig_usleep((CXD56_MIC_BOOT_WAIT - time) * 1000); - } + clock_systime_timespec(&end); + + uint64_t time = (uint64_t)end.tv_sec * 1000 + + (uint64_t)end.tv_nsec / 1000000 - + priv->mic_boot_start; + + if (time < CXD56_MIC_BOOT_WAIT) + { + nxsig_usleep((CXD56_MIC_BOOT_WAIT - time) * 1000); } } } diff --git a/boards/arm/cxd56xx/drivers/audio/cxd56_audio_analog.c b/boards/arm/cxd56xx/drivers/audio/cxd56_audio_analog.c index 7d598626d01..95398b5ed88 100644 --- a/boards/arm/cxd56xx/drivers/audio/cxd56_audio_analog.c +++ b/boards/arm/cxd56xx/drivers/audio/cxd56_audio_analog.c @@ -64,12 +64,7 @@ static void clear_mic_boot_time(void) static void set_mic_boot_time(void) { struct timespec start; - if (clock_systime_timespec(&start) < 0) - { - g_mic_boot_start_time = 0x0ull; - return; - } - + clock_systime_timespec(&start); g_mic_boot_start_time = (uint64_t)start.tv_sec * 1000 + (uint64_t)start.tv_nsec / 1000000; } @@ -79,11 +74,7 @@ static void wait_mic_boot_finish(void) if (g_mic_boot_start_time != 0x0ull) { struct timespec end; - if (clock_systime_timespec(&end) < 0) - { - return; - } - + clock_systime_timespec(&end); uint64_t time = (uint64_t)end.tv_sec * 1000 + (uint64_t)end.tv_nsec / 1000000 - g_mic_boot_start_time; diff --git a/drivers/sensors/sht4x_uorb.c b/drivers/sensors/sht4x_uorb.c index 50c3592687b..302d72c100c 100644 --- a/drivers/sensors/sht4x_uorb.c +++ b/drivers/sensors/sht4x_uorb.c @@ -835,14 +835,7 @@ int sht4x_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr) priv->addr = addr; priv->precision = SHT4X_PREC_HIGH; priv->interval = 1000000; /* 1s interval */ - err = clock_systime_timespec(&priv->last_heat); - - if (err < 0) - { - snerr("ERROR: Failed to get timespec: %d\n", err); - kmm_free(priv); - return err; - } + clock_systime_timespec(&priv->last_heat); /* Allow heat immediately after registration since in theory the sensor has * never had its heater activated yet. diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c index 0cb503b0309..f26ffef5bdf 100644 --- a/drivers/video/isx019.c +++ b/drivers/video/isx019.c @@ -1230,11 +1230,7 @@ static bool try_repeat(int sec, int usec, FAR isx019_dev_t *priv, struct timespec now; struct timespec delta; - ret = clock_systime_timespec(&start); - if (ret < 0) - { - return false; - } + clock_systime_timespec(&start); while (1) { @@ -1245,12 +1241,7 @@ static bool try_repeat(int sec, int usec, FAR isx019_dev_t *priv, } else { - ret = clock_systime_timespec(&now); - if (ret < 0) - { - return false; - } - + clock_systime_timespec(&now); clock_timespec_subtract(&now, &start, &delta); if ((delta.tv_sec > sec) || ((delta.tv_sec == sec) && diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h index 8aa9f06ac02..dafe1d79b3d 100644 --- a/include/nuttx/clock.h +++ b/include/nuttx/clock.h @@ -731,13 +731,13 @@ clock_t clock_systime_ticks(void); * ts - Location to return the time * * Returned Value: - * OK (0) on success; a negated errno value on failure. + * None * * Assumptions: * ****************************************************************************/ -int clock_systime_timespec(FAR struct timespec *ts); +void clock_systime_timespec(FAR struct timespec *ts); /**************************************************************************** * Name: clock_cpuload diff --git a/openamp/0007-libmetal-nuttx-Update-function-prototype-changes.patch b/openamp/0007-libmetal-nuttx-Update-function-prototype-changes.patch new file mode 100644 index 00000000000..3ccf707ed8e --- /dev/null +++ b/openamp/0007-libmetal-nuttx-Update-function-prototype-changes.patch @@ -0,0 +1,58 @@ +From a120e0e698ff3f7af8bfee34a47051f13b74aac0 Mon Sep 17 00:00:00 2001 +From: chao an +Date: Thu, 9 Oct 2025 19:39:01 +0800 +Subject: [PATCH] libmetal/nuttx: Update function prototype changes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +clock_systime_timespec() always returns 0, so there is no need to +check the return value in the caller code, let us remove the return +value directly. + +From: + int clock_systime_timespec(FAR struct timespec *ts) +To: + void clock_systime_timespec(FAR struct timespec *ts) + +Fix build break: + +libmetal/lib/system/nuttx/time.c: In function ‘metal_get_timestamp’: +libmetal/lib/system/nuttx/time.c:21:11: error: void value not ignored as it ought to be + 21 | r = clock_systime_timespec(&tp); + | ^ +make[1]: *** [Makefile:46: libmetal/lib/system/nuttx/time.o] Error 1 + +Change-Id: I88443c4a5725bd269a05c8a503bd5095b082bfbe +--- + lib/system/nuttx/time.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/lib/system/nuttx/time.c libmetal/lib/system/nuttx/time.c +index 986f1ba..f06725d 100644 +--- a/lib/system/nuttx/time.c ++++ libmetal/lib/system/nuttx/time.c +@@ -14,14 +14,13 @@ + + unsigned long long metal_get_timestamp(void) + { +- unsigned long long t = 0; ++ unsigned long long t; + struct timespec tp; +- int r; + +- r = clock_systime_timespec(&tp); +- if (!r) { +- t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC; +- t += tp.tv_nsec; +- } ++ clock_systime_timespec(&tp); ++ ++ t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC; ++ t += tp.tv_nsec; ++ + return t; + } +-- +2.43.0 + diff --git a/openamp/libmetal.cmake b/openamp/libmetal.cmake index 5e5a29f18cb..d4b996c1ac8 100644 --- a/openamp/libmetal.cmake +++ b/openamp/libmetal.cmake @@ -48,6 +48,8 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libmetal) ${CMAKE_CURRENT_LIST_DIR}/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < ${CMAKE_CURRENT_LIST_DIR}/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch + && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0007-libmetal-nuttx-Update-function-prototype-changes.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) diff --git a/openamp/libmetal.defs b/openamp/libmetal.defs index ac6e5b63ce4..fc5443dde73 100644 --- a/openamp/libmetal.defs +++ b/openamp/libmetal.defs @@ -88,6 +88,7 @@ libmetal.zip: $(Q) patch -p0 < 0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch $(Q) patch -p0 < 0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch $(Q) patch -p0 < 0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch + $(Q) patch -p0 < 0007-libmetal-nuttx-Update-function-prototype-changes.patch .libmetal_headers: libmetal.zip else diff --git a/sched/clock/clock_systime_timespec.c b/sched/clock/clock_systime_timespec.c index fbb7ed6f14e..2c8283f3419 100644 --- a/sched/clock/clock_systime_timespec.c +++ b/sched/clock/clock_systime_timespec.c @@ -52,14 +52,13 @@ * ts - Location to return the time * * Returned Value: - * Current version almost always returns OK. Currently errors are - * possible with CONFIG_RTC_HIRES only. + * None * * Assumptions: * ****************************************************************************/ -int clock_systime_timespec(FAR struct timespec *ts) +void clock_systime_timespec(FAR struct timespec *ts) { #ifdef CONFIG_RTC_HIRES if (g_rtc_enabled) @@ -84,6 +83,4 @@ int clock_systime_timespec(FAR struct timespec *ts) #else clock_ticks2time(ts, g_system_ticks); #endif - return 0; } -