lkml.org 
[lkml]   [2020]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code
Date
From: Kaitao Cheng <pilgrimtao@gmail.com>

Cleanup extra if(test_and_clear_bit), and put the other one in front.

Signed-off-by: Kaitao Cheng <pilgrimtao@gmail.com>
---
kernel/irq/manage.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 1753486b440c..7266d0d30fa9 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -863,21 +863,15 @@ static int irq_wait_for_interrupt(struct irqaction *action)
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);

- if (kthread_should_stop()) {
- /* may need to run one last time */
- if (test_and_clear_bit(IRQTF_RUNTHREAD,
- &action->thread_flags)) {
- __set_current_state(TASK_RUNNING);
- return 0;
- }
+ if (test_and_clear_bit(IRQTF_RUNTHREAD,
+ &action->thread_flags)) {
__set_current_state(TASK_RUNNING);
- return -1;
+ return 0;
}

- if (test_and_clear_bit(IRQTF_RUNTHREAD,
- &action->thread_flags)) {
+ if (kthread_should_stop()) {
__set_current_state(TASK_RUNNING);
- return 0;
+ return -1;
}
schedule();
}
--
2.20.1
\
 
 \ /
  Last update: 2020-01-06 16:45    [W:0.047 / U:1.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site