sched/clock: has external linkage but is only used in one translation unit

Fix for MISRA-C rule 8.10

Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
This commit is contained in:
jiangtao16
2025-08-07 18:06:44 +08:00
committed by Xiang Xiao
parent 397e7e7a4f
commit e171415897
2 changed files with 23 additions and 59 deletions
-13
View File
@@ -817,19 +817,6 @@ void perf_convert(clock_t elapsed, FAR struct timespec *ts);
unsigned long perf_getfreq(void);
/****************************************************************************
* Name: nxclock_settime
*
* Description:
* Clock Functions based on POSIX APIs
*
* CLOCK_REALTIME - POSIX demands this to be present. This is the wall
* time clock.
*
****************************************************************************/
int nxclock_settime(clockid_t clock_id, FAR const struct timespec *tp);
/****************************************************************************
* Name: nxclock_gettime
*
+23 -46
View File
@@ -98,50 +98,6 @@ static void nxclock_set_realtime(FAR const struct timespec *tp)
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxclock_settime
*
* Description:
* Clock Functions based on POSIX APIs
*
* CLOCK_REALTIME - POSIX demands this to be present. This is the wall
* time clock.
*
****************************************************************************/
int nxclock_settime(clockid_t clock_id, FAR const struct timespec *tp)
{
int ret = -EINVAL;
if (tp == NULL || tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000)
{
return ret;
}
if (clock_id == CLOCK_REALTIME)
{
nxclock_set_realtime(tp);
return 0;
}
#ifdef CONFIG_PTP_CLOCK
else if ((clock_id & CLOCK_MASK) == CLOCK_FD)
{
FAR struct file *filep;
ret = ptp_clockid_to_filep(clock_id, &filep);
if (ret < 0)
{
return ret;
}
ret = file_ioctl(filep, PTP_CLOCK_SETTIME, tp);
fs_putfilep(filep);
}
#endif
return ret;
}
/****************************************************************************
* Name: clock_settime
*
@@ -155,9 +111,30 @@ int nxclock_settime(clockid_t clock_id, FAR const struct timespec *tp)
int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
{
int ret;
int ret = -EINVAL;
if (tp != NULL && tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000)
{
if (clock_id == CLOCK_REALTIME)
{
nxclock_set_realtime(tp);
ret = 0;
}
#ifdef CONFIG_PTP_CLOCK
else if ((clock_id & CLOCK_MASK) == CLOCK_FD)
{
FAR struct file *filep;
ret = ptp_clockid_to_filep(clock_id, &filep);
if (ret >= 0)
{
ret = file_ioctl(filep, PTP_CLOCK_SETTIME, tp);
fs_putfilep(filep);
}
}
#endif
}
ret = nxclock_settime(clock_id, tp);
if (ret < 0)
{
set_errno(-ret);