lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200106154430.3413-1-pilgrimtao@gmail.com>
Date:   Mon,  6 Jan 2020 07:44:30 -0800
From:   chengkaitao <pilgrimtao@...il.com>
To:     tglx@...utronix.de
Cc:     linux-kernel@...r.kernel.org, smuchun@...il.com,
        Kaitao Cheng <pilgrimtao@...il.com>
Subject: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code

From: Kaitao Cheng <pilgrimtao@...il.com>

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

Signed-off-by: Kaitao Cheng <pilgrimtao@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ