Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21602066ybl; Mon, 6 Jan 2020 07:45:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwwK6w4x1s69WXmhfwe8v/XcaCnYmHOAb3ePCpOvkuMPYTiKP/FngdNT4Xk5ehTgdYJM8xN X-Received: by 2002:a9d:4902:: with SMTP id e2mr14557341otf.116.1578325547405; Mon, 06 Jan 2020 07:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578325547; cv=none; d=google.com; s=arc-20160816; b=OmISahv47DYpli7Y8Rz7479o2U024hbb2YP7qZqml94EZOa6UKvs6ZqNmRty0xEIKw BvUO5VD+WWLQUrT9GiYc2dURriFgJBN7+IhXbNiwpGf3glB9dWWEybmkEaDFs5ybgSYJ 6hFcqq2azUWQXr1ONpS1MnzhHa/GKjoQC/crNhoFKizp8zSkV4M2clqU6jEhdAh6ElcJ vTTKhgZXuh176BrngJQ35cX6JnBJNxdlvp/dxKM9d9HFqKFqD3RsheJAU4zQv3ls5nHt xMmaTy5KjQdjQmLn0gp8+B3dogcDAvOdRJHLMkDzzizvn+L0DnSNFG8P7ipzwkBQZFRW jBnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=n0l5A9UoqjVI1sY5PPJyL17z33+kBWrkankas44MyTI=; b=j29hfkWiwA4WPN+E319YlICXWNN6WiKR3nBOQ6+Mb+lMazmk3qc0Psw7f+/Qfl/Xhc TxJWKqwXvygbEVlarTP4eLMuCCdeiBEG/XRhUSMs6XW83/nXIcTnG/pYbxbXCrRQ7A4s wBZS41YBcrGyrAd7XfKICG/T4ggj5aOiZghSMaqW5bcj9E+MB/gVpCuH7iZr+9D+EhCu IEUevc1mysU5+4/to3bq8enX2OvuLPtzqFANUX3DL+rXwZdRv/84RzTTq/KR3ZNsxCmx KoKKTzlOK9nhK8FTCJrMZIO+75m/Gx7OTifBRc1gAQZmLbh5WT8of2h51cTOXnfy7tuV t+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t1HhJyuh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t185si33241875oib.39.2020.01.06.07.45.34; Mon, 06 Jan 2020 07:45:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t1HhJyuh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726497AbgAFPov (ORCPT + 99 others); Mon, 6 Jan 2020 10:44:51 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:39489 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbgAFPou (ORCPT ); Mon, 6 Jan 2020 10:44:50 -0500 Received: by mail-pj1-f68.google.com with SMTP id t101so7931415pjb.4 for ; Mon, 06 Jan 2020 07:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n0l5A9UoqjVI1sY5PPJyL17z33+kBWrkankas44MyTI=; b=t1HhJyuhMF6b2u0cHsve67RMCFv+L2YN1phOPEJ39G+0kiSGSPX12N3z9hbQUyHnP2 qavWAIKWz4aJZrmtIDX6lDLsjNScEXEKoxUAayeV2RpdtN3n8D8fXKUE6B1CSyGPc6Uu qhVHYgAHNZHogm30G35nMn38lRSJES6cnUzsH22Fvcc2CpTZ4FJmyBJ/BLw6Qi0tzCTV I8ed4V4pNvcDUWu7TsAFHsw59BhMgxFITZp9u99jJPwndvwK0czkDXnYZOX3O0BMiKmw eAjeVpm0z3sgjST5Lo3bOuTGYjKJpH6/6Le0qkg97XQ9qLHShGOqSWijJaEli0YvCUyY U8jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n0l5A9UoqjVI1sY5PPJyL17z33+kBWrkankas44MyTI=; b=YjG6JD9NsZlTqYkHGN0Xgm2EZUskQHCfK35LL8QNq65q3j1hmMRE5HTPtlnIFEYgwW 57jpBAsXmgKLI2vbzEaf1K5gdT27ISleS4bGWHDEPhVKzcFxfjqeUOorGwnuAPd/DGwe d8/1ucHDWTsn7jArRQfkP6+3bZ4iFk5/hp3+XiViMKu1/VjnSbjBUk2xHnasTQIuYTU2 o68NAk1DTtJk2Af1naGbpGdiAxQtJydNdtnpmHi7zEEUVvNUKP620KqhiE36GsD3f+TG 3P90SDhSU9taUxryRhX3COcKvY+wgn0ZpUOKAP5tqULZLygwdNR5JPsXmHvelh/1+rvC kSew== X-Gm-Message-State: APjAAAUBasAWjTjrQ/IOmVB+pEWkP5xLRIomTEJsn6mgbLxtQQxxnFxu 5vgQjUuURglQwnJxnZxE+A0WM5Cm X-Received: by 2002:a17:90a:dc82:: with SMTP id j2mr44544482pjv.70.1578325490212; Mon, 06 Jan 2020 07:44:50 -0800 (PST) Received: from localhost.localdomain ([2408:8025:ad:7e20:1523:ae70:55ad:68cb]) by smtp.gmail.com with ESMTPSA id b185sm61935315pfa.102.2020.01.06.07.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 07:44:49 -0800 (PST) From: chengkaitao To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, smuchun@gmail.com, Kaitao Cheng Subject: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code Date: Mon, 6 Jan 2020 07:44:30 -0800 Message-Id: <20200106154430.3413-1-pilgrimtao@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kaitao Cheng Cleanup extra if(test_and_clear_bit), and put the other one in front. Signed-off-by: Kaitao Cheng --- 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