Skip to content

Commit

Permalink
No need to call sched_lock explicitly after call spin_lock_irqsave, s…
Browse files Browse the repository at this point in the history
…ince it will be called in func spin_lock_irqsave.

Signed-off-by: wangzhi16 <[email protected]>
  • Loading branch information
wangzhi-art authored and xiaoxiang781216 committed Jan 24, 2025
1 parent 1655537 commit 8f3a2a6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 14 deletions.
2 changes: 0 additions & 2 deletions sched/clock/clock_adjtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ static int adjtime_start(long long adjust_usec)
}

flags = spin_lock_irqsave(&g_adjtime_lock);
sched_lock();

/* Set new adjustment */

Expand All @@ -142,7 +141,6 @@ static int adjtime_start(long long adjust_usec)
}

spin_unlock_irqrestore(&g_adjtime_lock, flags);
sched_unlock();

return ret;
}
Expand Down
2 changes: 0 additions & 2 deletions sched/misc/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ void _assert(FAR const char *filename, int linenum,
if (os_ready)
{
flags = spin_lock_irqsave(&g_assert_lock);
sched_lock();
}

#if CONFIG_BOARD_RESET_ON_ASSERT < 2
Expand Down Expand Up @@ -914,6 +913,5 @@ void _assert(FAR const char *filename, int linenum,
if (os_ready)
{
spin_unlock_irqrestore(&g_assert_lock, flags);
sched_unlock();
}
}
3 changes: 0 additions & 3 deletions sched/wqueue/kwork_notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <sched.h>
#include <assert.h>

#include <nuttx/arch.h>
Expand Down Expand Up @@ -361,7 +360,6 @@ void work_notifier_signal(enum work_evtype_e evtype,
*/

flags = spin_lock_irqsave(&g_notifier_lock);
sched_lock();

/* Process the notification at the head of the pending list until the
* pending list is empty
Expand Down Expand Up @@ -405,7 +403,6 @@ void work_notifier_signal(enum work_evtype_e evtype,
}

spin_unlock_irqrestore(&g_notifier_lock, flags);
sched_unlock();
}

#endif /* CONFIG_WQUEUE_NOTIFIER */
4 changes: 0 additions & 4 deletions sched/wqueue/kwork_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static void work_timer_expiry(wdparm_t arg)
FAR struct work_s *work = (FAR struct work_s *)arg;

irqstate_t flags = spin_lock_irqsave(&work->wq->lock);
sched_lock();

/* We have being canceled */

Expand All @@ -79,7 +78,6 @@ static void work_timer_expiry(wdparm_t arg)
}

spin_unlock_irqrestore(&work->wq->lock, flags);
sched_unlock();
}

static bool work_is_canceling(FAR struct kworker_s *kworkers, int nthreads,
Expand Down Expand Up @@ -184,10 +182,8 @@ int work_queue_wq(FAR struct kwork_wqueue_s *wqueue,

if (!delay)
{
sched_lock();
queue_work(wqueue, work);
spin_unlock_irqrestore(&wqueue->lock, flags);
sched_unlock();
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions sched/wqueue/kwork_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <nuttx/config.h>

#include <unistd.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -205,9 +204,7 @@ static int work_thread(int argc, FAR char *argv[])
while (kworker->wait_count > 0)
{
kworker->wait_count--;
sched_lock();
nxsem_post(&kworker->wait);
sched_unlock();
}
}

Expand Down

0 comments on commit 8f3a2a6

Please sign in to comment.