Received: by 10.223.185.116 with SMTP id b49csp388417wrg; Thu, 22 Feb 2018 23:56:44 -0800 (PST) X-Google-Smtp-Source: AH8x227y1KEOaBjYxouLSgdt4WsxI/YuTh0EXKkl50JwT4b1Y04QNuB3OoBpYZr59dOPfVdzXQjG X-Received: by 10.99.123.79 with SMTP id k15mr760099pgn.173.1519372604671; Thu, 22 Feb 2018 23:56:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519372604; cv=none; d=google.com; s=arc-20160816; b=OSPMa3kaC34YEZ8zjvZfN3HHxURfl8vEhtCz2YkP2o7Qsr0Q3J3YBLMIWpaiVzJPr2 N1EDYc2AeUcjRojTuaITZWl+zdrCIZGd+dpmUKaDBUVFKCCDZEfE8E6wuo31tjlEzibS 5Sx+Md9xLimmHkC8GxeWvaaHbdqwYmv9PpG2F7PocKToPr4cWqOnlJ7KGfbQsb+Krlbh 3tlTjhUOTJ68spkWsrdBe+k4Ziqj709pOk9qglHfHX/DpXcT9QPei9WqgpHnbvqlQuM0 cNcnVM2WpzD759Z+NpiEtixl38oZASEIWnMxIirN5JV3/6M3DPxhPmrGj3Rya4bRVvBu 2Jkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=z85c4kQDe7n5tvtMrsB4Tsp7eqnIB1EE0QbY1d5TYi8=; b=nb3YooHkTz8fAH6CTb+HnEDF1vqRxygsu6zgDumPOSafmmHDj8+VuaDc4om6hBkmNm B1ViqAuYCg7IHUf2GeiPdcNyf0dSWv3TRx1Lh7+WrnALskkNC1U1dotN7KD8ZdvVznZo 99+fsTQ8CSjFvgWmikAY0ntVw5/KnGXdWDlm2S10sYnFtRYxGI5b4JieOTdIa6WYLgdh Fshq+0DJ0HrpnkCHKDBnq5CgGJxXGPNgsLTAi2+Hp4aqZQhVoDIdO1SQk6+v3J6Ha3gF 1nZZmMWwAV1sRcfovPF8/SY1naiKv3Wxxh4qz/NZd/ewkKyLaXzIGI6bEYcBYcLqErbM 8Vvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14-v6si1401970plj.307.2018.02.22.23.56.30; Thu, 22 Feb 2018 23:56:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbeBWHyx (ORCPT + 99 others); Fri, 23 Feb 2018 02:54:53 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:11991 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750776AbeBWHyw (ORCPT ); Fri, 23 Feb 2018 02:54:52 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="37192425" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 23 Feb 2018 15:54:50 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id F0E8D48AE762; Fri, 23 Feb 2018 15:54:48 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 23 Feb 2018 15:54:49 +0800 From: Dou Liyang To: , CC: , , , , , Dou Liyang Subject: [PATCH v3 2/2] x86/apic: Replace common tools with new ones Date: Fri, 23 Feb 2018 15:54:30 +0800 Message-ID: <20180223075430.12395-2-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180223075430.12395-1-douly.fnst@cn.fujitsu.com> References: <20180223075430.12395-1-douly.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: F0E8D48AE762.A55C9 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pending interrupt check code is old, update the following code. -Replace for() with for_each_set_bit() -Replace printk() with pr_err() Also merge the printk's code in one line and make curly braces balanced Suggested-by: Andy Shevchenko Signed-off-by: Dou Liyang --- arch/x86/kernel/apic/apic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index be223ebd1bb3..b303b29c71ca 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1412,7 +1412,8 @@ static void apic_pending_intr_clear(void) { long long max_loops = cpu_khz ? cpu_khz : 1000000; unsigned long long tsc = 0, ntsc; - unsigned int value, queued; + unsigned int queued; + unsigned long value; int i, j, acked = 0; if (boot_cpu_has(X86_FEATURE_TSC)) @@ -1435,24 +1436,24 @@ static void apic_pending_intr_clear(void) for (i = APIC_ISR_NR - 1; i >= 0; i--) { value = apic_read(APIC_ISR + i*0x10); - for (j = 31; j >= 0; j--) { - if (value & (1< 256) { - printk(KERN_ERR "LAPIC pending interrupts after %d EOI\n", - acked); + pr_err("LAPIC pending interrupts after %d EOI\n", acked); break; } if (queued) { if (boot_cpu_has(X86_FEATURE_TSC) && cpu_khz) { ntsc = rdtsc(); max_loops = (cpu_khz << 10) - (ntsc - tsc); - } else + } else { max_loops--; + } } } while (queued && max_loops > 0); WARN_ON(max_loops <= 0); -- 2.14.3