mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chengkaitao <pilgrimtao@gmail.com>
To: tglx@linutronix.de
Cc: pilgrimtao@163.com, smuchun@gmail.com,
	linux-kernel@vger.kernel.org, Kaitao Cheng <pilgrimtao@gmail.com>
Subject: [PATCH] irq: cleanup some duplicate code
Date: Thu, 21 Nov 2019 09:38:32 -0800	[thread overview]
Message-ID: <20191121173832.2734-1-pilgrimtao@gmail.com> (raw)

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


                 reply	other threads:[~2019-11-21 17:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191121173832.2734-1-pilgrimtao@gmail.com \
    --to=pilgrimtao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pilgrimtao@163.com \
    --cc=smuchun@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®