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);
void weak_function clock_initialize(void);
void clock_initialize(void);
#ifndef CONFIG_SCHED_TICKLESS
void weak_function clock_timer(void);
void clock_timer(void);
#else
# define clock_timer()
#endif
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
void weak_function task_initialize(void);
void task_initialize(void);
#else
# define task_initialize()
#endif
/* Task group data structure management */

View File

@ -564,16 +564,9 @@ void nx_start(void)
g_nx_initstate = OSINIT_MEMORY;
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
/* Initialize tasking data structures */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (task_initialize != NULL)
#endif
{
task_initialize();
}
#endif
task_initialize();
/* Disables context switching because we need take the memory manager
* 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) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (irq_initialize != NULL)
#endif
{
irq_initialize();
}
irq_initialize();
/* Initialize the POSIX timer facility (if included in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (clock_initialize != NULL)
#endif
{
clock_initialize();
}
clock_initialize();
#ifndef CONFIG_DISABLE_POSIX_TIMERS
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (timer_initialize != NULL)
#endif
{
timer_initialize();
}
timer_initialize();
#endif
/* Initialize the signal facility (if in link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (nxsig_initialize != NULL)
#endif
{
nxsig_initialize();
}
nxsig_initialize();
#ifndef CONFIG_DISABLE_MQUEUE
/* Initialize the named message queue facility (if in link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (nxmq_initialize != NULL)
#endif
{
nxmq_initialize();
}
nxmq_initialize();
#endif
#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

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,
FAR struct mqueue_msg_s *mqmsg,
FAR char *ubuffer, unsigned int *prio)
FAR char *ubuffer, FAR unsigned int *prio)
{
FAR struct tcb_s *btcb;
ssize_t rcvmsglen;

View File

@ -106,7 +106,7 @@ struct task_group_s; /* Forward reference */
/* 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);
/* 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);
ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq,
FAR struct mqueue_msg_s *mqmsg,
FAR char *ubuffer, unsigned int *prio);
FAR char *ubuffer, FAR unsigned int *prio);
/* mq_sndinternal.c *************************************************************/

View File

@ -218,12 +218,7 @@ void nxsched_process_timer(void)
/* Increment the system time (if in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (clock_timer != NULL)
#endif
{
clock_timer();
}
clock_timer();
#ifndef CONFIG_SCHED_CPULOAD_EXTCLK
/* 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).
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (timer_deleteall != NULL)
#endif
{
timer_deleteall(tcb->pid);
}
timer_deleteall(tcb->pid);
#endif
/* Release the task's process ID if one was assigned. PID

View File

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

View File

@ -81,8 +81,8 @@ extern volatile sq_queue_t g_alloctimers;
* Public Function Prototypes
****************************************************************************/
void weak_function timer_initialize(void);
void weak_function timer_deleteall(pid_t pid);
void timer_initialize(void);
void timer_deleteall(pid_t pid);
int timer_release(FAR struct posix_timer_s *timer);
#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
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 *next;