sched: Remove the unnecessary weak_function

because not all compiler support the weak attribute, and
many features are either always used or guarded by config.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-08-16 12:20:39 +08:00 committed by Petro Karashchenko
parent f93964ad3c
commit 1b04bfae20
11 changed files with 24 additions and 62 deletions

View File

@ -76,9 +76,11 @@ extern struct timespec g_basetime;
int clock_basetime(FAR struct timespec *tp); int clock_basetime(FAR struct timespec *tp);
void weak_function clock_initialize(void); void clock_initialize(void);
#ifndef CONFIG_SCHED_TICKLESS #ifndef CONFIG_SCHED_TICKLESS
void weak_function clock_timer(void); void clock_timer(void);
#else
# define clock_timer()
#endif #endif
int clock_abstime2ticks(clockid_t clockid, int clock_abstime2ticks(clockid_t clockid,

View File

@ -67,7 +67,9 @@ extern FAR struct task_group_s *g_group_current[CONFIG_SMP_NCPUS];
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_SCHED_CHILD_STATUS #ifdef CONFIG_SCHED_CHILD_STATUS
void weak_function task_initialize(void); void task_initialize(void);
#else
# define task_initialize()
#endif #endif
/* Task group data structure management */ /* Task group data structure management */

View File

@ -564,16 +564,9 @@ void nx_start(void)
g_nx_initstate = OSINIT_MEMORY; g_nx_initstate = OSINIT_MEMORY;
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
/* Initialize tasking data structures */ /* Initialize tasking data structures */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS task_initialize();
if (task_initialize != NULL)
#endif
{
task_initialize();
}
#endif
/* Disables context switching because we need take the memory manager /* Disables context switching because we need take the memory manager
* semaphore on this CPU so that it will not be available on the other * semaphore on this CPU so that it will not be available on the other
@ -588,49 +581,24 @@ void nx_start(void)
/* Initialize the interrupt handling subsystem (if included) */ /* Initialize the interrupt handling subsystem (if included) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS irq_initialize();
if (irq_initialize != NULL)
#endif
{
irq_initialize();
}
/* Initialize the POSIX timer facility (if included in the link) */ /* Initialize the POSIX timer facility (if included in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS clock_initialize();
if (clock_initialize != NULL)
#endif
{
clock_initialize();
}
#ifndef CONFIG_DISABLE_POSIX_TIMERS #ifndef CONFIG_DISABLE_POSIX_TIMERS
#ifdef CONFIG_HAVE_WEAKFUNCTIONS timer_initialize();
if (timer_initialize != NULL)
#endif
{
timer_initialize();
}
#endif #endif
/* Initialize the signal facility (if in link) */ /* Initialize the signal facility (if in link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS nxsig_initialize();
if (nxsig_initialize != NULL)
#endif
{
nxsig_initialize();
}
#ifndef CONFIG_DISABLE_MQUEUE #ifndef CONFIG_DISABLE_MQUEUE
/* Initialize the named message queue facility (if in link) */ /* Initialize the named message queue facility (if in link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS nxmq_initialize();
if (nxmq_initialize != NULL)
#endif
{
nxmq_initialize();
}
#endif #endif
#ifdef CONFIG_NET #ifdef CONFIG_NET

View File

@ -142,7 +142,7 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
void weak_function irq_initialize(void); void irq_initialize(void);
/**************************************************************************** /****************************************************************************
* Name: irq_unexpected_isr * Name: irq_unexpected_isr

View File

@ -251,7 +251,7 @@ int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq,
ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq, ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq,
FAR struct mqueue_msg_s *mqmsg, FAR struct mqueue_msg_s *mqmsg,
FAR char *ubuffer, unsigned int *prio) FAR char *ubuffer, FAR unsigned int *prio)
{ {
FAR struct tcb_s *btcb; FAR struct tcb_s *btcb;
ssize_t rcvmsglen; ssize_t rcvmsglen;

View File

@ -106,7 +106,7 @@ struct task_group_s; /* Forward reference */
/* Functions defined in mq_initialize.c *****************************************/ /* Functions defined in mq_initialize.c *****************************************/
void weak_function nxmq_initialize(void); void nxmq_initialize(void);
void nxmq_free_msg(FAR struct mqueue_msg_s *mqmsg); void nxmq_free_msg(FAR struct mqueue_msg_s *mqmsg);
/* mq_waitirq.c *****************************************************************/ /* mq_waitirq.c *****************************************************************/
@ -124,7 +124,7 @@ int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq,
int oflags, FAR struct mqueue_msg_s **rcvmsg); int oflags, FAR struct mqueue_msg_s **rcvmsg);
ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq, ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq,
FAR struct mqueue_msg_s *mqmsg, FAR struct mqueue_msg_s *mqmsg,
FAR char *ubuffer, unsigned int *prio); FAR char *ubuffer, FAR unsigned int *prio);
/* mq_sndinternal.c *************************************************************/ /* mq_sndinternal.c *************************************************************/

View File

@ -218,12 +218,7 @@ void nxsched_process_timer(void)
/* Increment the system time (if in the link) */ /* Increment the system time (if in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS clock_timer();
if (clock_timer != NULL)
#endif
{
clock_timer();
}
#ifndef CONFIG_SCHED_CPULOAD_EXTCLK #ifndef CONFIG_SCHED_CPULOAD_EXTCLK
/* Perform CPU load measurements (before any timer-initiated context /* Perform CPU load measurements (before any timer-initiated context

View File

@ -108,12 +108,7 @@ int nxsched_release_tcb(FAR struct tcb_s *tcb, uint8_t ttype)
* disabled here). * disabled here).
*/ */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS timer_deleteall(tcb->pid);
if (timer_deleteall != NULL)
#endif
{
timer_deleteall(tcb->pid);
}
#endif #endif
/* Release the task's process ID if one was assigned. PID /* Release the task's process ID if one was assigned. PID

View File

@ -147,7 +147,7 @@ struct task_group_s;
/* sig_initializee.c */ /* sig_initializee.c */
void weak_function nxsig_initialize(void); void nxsig_initialize(void);
/* sig_action.c */ /* sig_action.c */

View File

@ -81,8 +81,8 @@ extern volatile sq_queue_t g_alloctimers;
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
void weak_function timer_initialize(void); void timer_initialize(void);
void weak_function timer_deleteall(pid_t pid); void timer_deleteall(pid_t pid);
int timer_release(FAR struct posix_timer_s *timer); int timer_release(FAR struct posix_timer_s *timer);
#endif /* __SCHED_TIMER_TIMER_H */ #endif /* __SCHED_TIMER_TIMER_H */

View File

@ -81,7 +81,7 @@ volatile sq_queue_t g_alloctimers;
* *
****************************************************************************/ ****************************************************************************/
void weak_function timer_initialize(void) void timer_initialize(void)
{ {
#if CONFIG_PREALLOC_TIMERS > 0 #if CONFIG_PREALLOC_TIMERS > 0
int i; int i;
@ -122,7 +122,7 @@ void weak_function timer_initialize(void)
* *
****************************************************************************/ ****************************************************************************/
void weak_function timer_deleteall(pid_t pid) void timer_deleteall(pid_t pid)
{ {
FAR struct posix_timer_s *timer; FAR struct posix_timer_s *timer;
FAR struct posix_timer_s *next; FAR struct posix_timer_s *next;