Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3531480ybc; Thu, 21 Nov 2019 09:40:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwby5QDg/yd5mXaYVgeZggv9GGIEv2s/bM7scZA1cfAP2pyMMXfxyHuNqMcKe4X4V3/nlNh X-Received: by 2002:a17:906:e289:: with SMTP id gg9mr15256639ejb.71.1574358025280; Thu, 21 Nov 2019 09:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574358025; cv=none; d=google.com; s=arc-20160816; b=B3Cy/KYltk3kcikPe6i07hQZJSPewhQ7p6FtMze6gUIlCsEXr1yEaIjtZ+nRWZiDnz HLdZe8JgjpzkTlSvMspRO+Eryveqo83KOByImZNNqcxXPYw3hVvswHqmHg9+uxpVgYdn 5FiXOw3qucqzrLaBprtCbHlueLttMHKrqh+1C0qq0wlrmmSRO2HpBrTcaxJCPq6Q869U hsHDzwfjAfx5iUIvaLMj5xp/t2zSDr8RWay+GoAbVIhzu+bLneAnhw2ommVY1ei5ksBU 8P2S4lIX/G9AonbwfNDH1dsUEhc7Gw97KYjTpyqK13YPky5Xdncb7O4MxEQQA7aAMQny X3mA== 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=XtQb/GHbTCjmU7zfIXw3heHTmL6dzzUiPu7XahpLAdz7J8TCRLsBWEKSJ3+6yZth+d +llJ/YQMmADPX0e/NxjDslIox1MPW++TNoe1es8/ylsz6Qy1NTwPioW7roky8qwGM0H5 Eoh21gWRVqvwQYIJ6RMyI9LqBLnrsHubGGB4zvZ/Vd+oluKdRnj3hT/vVJTchTSlv1BO qbdWscKFA0yb8/WhMPy6lz+iNIWnjG1pqaJbCPYLSjRIIFDyzcae/wu6aRa6hRch8GkW uj+UUBqn1Ohl8fabOPXG+CGeJHSsjSZXeDuPPIonbgqEjQ0T13riZ4jTRqg6jaN7B7T2 aNig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MybPdpf6; 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 sd4si2402759ejb.261.2019.11.21.09.40.01; Thu, 21 Nov 2019 09:40:25 -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=MybPdpf6; 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 S1726722AbfKURir (ORCPT + 99 others); Thu, 21 Nov 2019 12:38:47 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34352 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfKURir (ORCPT ); Thu, 21 Nov 2019 12:38:47 -0500 Received: by mail-pl1-f196.google.com with SMTP id h13so1897499plr.1 for ; Thu, 21 Nov 2019 09:38:47 -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=MybPdpf6BAPp1aRDB1eeIjw2B/Dq0pyUNJ1csAvdv0Cba2+j5EY7K3OMBKv/jTMlgL T/tn+16bqw0epfRDgtWkYlVlo/JuqVTUZsSnT/73AOxejSWw3iiNzWL7JavsgNDhZ0zJ aW8T7onRojBC1uhhK4gxWj1TDatbOlhrGxy8j33dugQz6BUXqRoBNubAhVby3eRRGmNe /79gN+x4IeKenRaCjn/R+asKt0B2/YduvVXppspcoAnxpNToKKtzPvAdggQSmv4GyVQS IpApIsVenAU8tCvVAlRfxQwUK18kK59hjExBSP+WlHYBsO1tt5IR1SyHt5/7YE6gVAtm U1PA== 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=L5s0OU9hiCUeQSMJbDoVY5tY0mJfeaMpOuTSYa3FKO6h2/6ZQ2t50YOEtqLkPsX7CS uqnHx760jikHx71LqLLKfEuD8naq8xyynpdgBWDDvPBoFyrqzSXdAgFTHbc+Jp573BER PAXCO0CN55XMJyzfOwMlWVhoSNf+Gp+pI7gMjF7AwnIhVcB/E49MXu7V9hH5OXLJRmyU y/guSTL8kz7361nzs/vlObG0wIbjIpu+/ITD8KoAzeQMvLfno6QHx5/TPJBns3lePyoV AQrkZgHVsmvu9Z5f/Ip9u3kr6jEohsmSAwRxRz/QWtgTWDbz6X9dQeuuWYHdvEG6KL0g 7mcg== X-Gm-Message-State: APjAAAVxD0mN4S6cO/+WpK35SP3rKP8g/lRGsPYcjAvf4yNr+0DzowaE LysS9jQC70FjyNxFIQG+ZHI= X-Received: by 2002:a17:90b:4393:: with SMTP id in19mr13261050pjb.132.1574357926843; Thu, 21 Nov 2019 09:38:46 -0800 (PST) Received: from localhost.localdomain ([2408:8025:ad:7e20:1c97:67e5:7b87:2fd3]) by smtp.gmail.com with ESMTPSA id d187sm3753526pgc.1.2019.11.21.09.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 09:38:46 -0800 (PST) From: chengkaitao To: tglx@linutronix.de Cc: pilgrimtao@163.com, smuchun@gmail.com, linux-kernel@vger.kernel.org, Kaitao Cheng Subject: [PATCH] irq: cleanup some duplicate code Date: Thu, 21 Nov 2019 09:38:32 -0800 Message-Id: <20191121173832.2734-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