sched: remove unnecessary type cast
fix code style issues Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
b6d9d4e92f
commit
5b4e12774c
@ -86,12 +86,12 @@ bool nxsched_add_prioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
||||
* is the g_pendingtasks list!
|
||||
*/
|
||||
|
||||
if (!next)
|
||||
if (next == NULL)
|
||||
{
|
||||
/* The tcb goes at the end of the list. */
|
||||
|
||||
prev = (FAR struct tcb_s *)list->tail;
|
||||
if (!prev)
|
||||
if (prev == NULL)
|
||||
{
|
||||
/* Special case: The list is empty */
|
||||
|
||||
@ -115,8 +115,8 @@ bool nxsched_add_prioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list)
|
||||
{
|
||||
/* The tcb goes just before next */
|
||||
|
||||
prev = (FAR struct tcb_s *)next->blink;
|
||||
if (!prev)
|
||||
prev = next->blink;
|
||||
if (prev == NULL)
|
||||
{
|
||||
/* Special case: Insert at the head of the list */
|
||||
|
||||
|
@ -178,7 +178,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
|
||||
|
||||
/* Get the task currently running on the CPU (may be the IDLE task) */
|
||||
|
||||
rtcb = (FAR struct tcb_s *)g_assignedtasks[cpu].head;
|
||||
rtcb = current_task(cpu);
|
||||
|
||||
/* Determine the desired new task state. First, if the new task priority
|
||||
* is higher then the priority of the lowest priority, running task, then
|
||||
@ -316,7 +316,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
|
||||
*/
|
||||
|
||||
DEBUGASSERT(btcb->flink != NULL);
|
||||
next = (FAR struct tcb_s *)btcb->flink;
|
||||
next = btcb->flink;
|
||||
|
||||
if ((next->flags & TCB_FLAG_CPU_LOCKED) != 0)
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ bool nxsched_merge_pending(void)
|
||||
/* The ptcb goes just before rtcb */
|
||||
|
||||
rprev = rtcb->blink;
|
||||
if (!rprev)
|
||||
if (rprev == NULL)
|
||||
{
|
||||
/* Special case: Inserting ptcb at the head of the list */
|
||||
|
||||
|
@ -146,8 +146,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, bool merge)
|
||||
* assigned to a CPU, and (2) and the g_assignedtasks[] lists which hold
|
||||
* tasks assigned a CPU, including the task that is currently running on
|
||||
* that CPU. Only this latter list contains the currently active task
|
||||
* only only removing the head of that list can result in a context
|
||||
* switch.
|
||||
* only removing the head of that list can result in a context switch.
|
||||
*
|
||||
* rtcb->blink == NULL will tell us if the TCB is at the head of the
|
||||
* ready-to-run list and, hence, a candidate for the new running task.
|
||||
@ -167,7 +166,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, bool merge)
|
||||
* after the TCB being removed.
|
||||
*/
|
||||
|
||||
nxttcb = (FAR struct tcb_s *)rtcb->flink;
|
||||
nxttcb = rtcb->flink;
|
||||
DEBUGASSERT(nxttcb != NULL);
|
||||
|
||||
/* If we are modifying the head of some assigned task list other than
|
||||
@ -206,7 +205,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, bool merge)
|
||||
|
||||
for (rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtrtcb != NULL && !CPU_ISSET(cpu, &rtrtcb->affinity);
|
||||
rtrtcb = (FAR struct tcb_s *)rtrtcb->flink);
|
||||
rtrtcb = rtrtcb->flink);
|
||||
}
|
||||
|
||||
/* Did we find a task in the g_readytorun list? Which task should
|
||||
|
@ -56,7 +56,7 @@
|
||||
#ifdef CONFIG_SMP
|
||||
static FAR struct tcb_s *nxsched_nexttcb(FAR struct tcb_s *tcb)
|
||||
{
|
||||
FAR struct tcb_s *nxttcb = (FAR struct tcb_s *)tcb->flink;
|
||||
FAR struct tcb_s *nxttcb = tcb->flink;
|
||||
FAR struct tcb_s *rtrtcb;
|
||||
|
||||
/* Which task should run next? It will be either the next tcb in the
|
||||
@ -74,7 +74,7 @@ static FAR struct tcb_s *nxsched_nexttcb(FAR struct tcb_s *tcb)
|
||||
|
||||
for (rtrtcb = (FAR struct tcb_s *)g_readytorun.head;
|
||||
rtrtcb != NULL && !CPU_ISSET(tcb->cpu, &rtrtcb->affinity);
|
||||
rtrtcb = (FAR struct tcb_s *)rtrtcb->flink);
|
||||
rtrtcb = rtrtcb->flink);
|
||||
|
||||
/* Return the TCB from the readyt-to-run list if it is the next
|
||||
* highest priority task.
|
||||
@ -128,7 +128,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb,
|
||||
#ifdef CONFIG_SMP
|
||||
nxttcb = nxsched_nexttcb(tcb);
|
||||
#else
|
||||
nxttcb = (FAR struct tcb_s *)tcb->flink;
|
||||
nxttcb = tcb->flink;
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(nxttcb != NULL);
|
||||
|
@ -322,7 +322,7 @@ static int nxsem_recoverholders(FAR struct semholder_s *pholder,
|
||||
static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
|
||||
FAR sem_t *sem, FAR void *arg)
|
||||
{
|
||||
FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb;
|
||||
FAR struct tcb_s *htcb = pholder->htcb;
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)arg;
|
||||
|
||||
/* If the priority of the thread that is waiting for a count is less than
|
||||
@ -357,7 +357,7 @@ static int nxsem_verifyholder(FAR struct semholder_s *pholder,
|
||||
*/
|
||||
|
||||
#if 0
|
||||
FAR struct tcb_s *htcb = (FAR struct tcb_s *)pholder->htcb;
|
||||
FAR struct tcb_s *htcb = pholder->htcb;
|
||||
|
||||
/* Called after a semaphore has been released (incremented), the semaphore
|
||||
* could be non-negative, and there is no thread waiting for the count.
|
||||
|
@ -192,7 +192,7 @@ static void nxsig_null_action(int signo)
|
||||
#ifdef HAVE_NXSIG_ABNORMAL_TERMINANTION
|
||||
static void nxsig_abnormal_termination(int signo)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)this_task();
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
|
||||
/* Careful: In the multi-threaded task, the signal may be handled on a
|
||||
* child pthread.
|
||||
@ -248,7 +248,7 @@ static void nxsig_abnormal_termination(int signo)
|
||||
#ifdef CONFIG_SIG_SIGSTOP_ACTION
|
||||
static void nxsig_stop_task(int signo)
|
||||
{
|
||||
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)this_task();
|
||||
FAR struct tcb_s *rtcb = this_task();
|
||||
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
|
||||
FAR struct task_group_s *group;
|
||||
|
||||
|
@ -81,7 +81,7 @@ int nxtask_delete(pid_t pid)
|
||||
|
||||
/* Get the TCB of the task to be deleted */
|
||||
|
||||
dtcb = (FAR struct tcb_s *)nxsched_get_tcb(pid);
|
||||
dtcb = nxsched_get_tcb(pid);
|
||||
if (dtcb == NULL)
|
||||
{
|
||||
/* The pid does not correspond to any known thread. The task
|
||||
|
Loading…
Reference in New Issue
Block a user