Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5797098ybv; Wed, 12 Feb 2020 00:06:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwfMP/1fuSIJJgKsLIDvUynNl23bs9lOn2shhX8pNhoVFh7pmyC6o0mEaryIzRXVym2uvdv X-Received: by 2002:a05:6830:15d2:: with SMTP id j18mr8456572otr.216.1581494809487; Wed, 12 Feb 2020 00:06:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581494809; cv=none; d=google.com; s=arc-20160816; b=iYpjy73oV7ynpsWUcQquS9UjatOGpGmHbXivmw5MsvYYMMNJuC2Tqqr/FFiLi2zPBt WHBbHP+OaOxt69uKjHB0sn+CgNKDxvBOmQFhlok2AVMLxdHvR3apjeqe0Rz/dyJCO947 I7vK5xNCf5y4XWal9YZi8uCjuO+nEyxYqrC7bsxYRhu2z0QSXjYZzyEKv/+r2zu1pXJ+ TKF0YzXJRCZ4YPC/THU86127bMnIXNhhy7N6yJTirF1TLF1gXbw3AxYgtoeP73tj49rj AYm0St6vjAoeTefUPO/N1iQxWMD4cfayvNay32h+xTD7ni1r1LDdZfRj1ruuiIqfffxZ ritQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FZfa1ntXH/LJudRBtNOhayVMjjFYZbRf83XEbL/qtd0=; b=yF7XUzSxOm+tKskhxytOyg5L2xs6E/mba2PxM3DD9LKjGsHJDuveG8F7/7OedAb96Z HhX96VcdrdlCLwhR79rwUxiE913q5xYKqLFBrmqRwovMb9vYYtBVVe2TUgcocu9QybSI EhfaxwZRxeV3jBrtHlRr39kTM7LKOjeDwkPKfoEYdcgChr1QGFE6daampNrRjN4LykUC TJVrSPdebEFo/SR/xBgBUCG2+4nVQCXZRYYI4K2pEXefJv//iDwn9bBlisyfokriDXBR XwYroSRLilWWBMcywQApOIarrwTVcAvrZjvklmZslZlgT4SAzL3gl4OAuBWGjqBzbEXM AkYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="LYOjJ/m+"; 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 a25si3408575otr.39.2020.02.12.00.06.37; Wed, 12 Feb 2020 00:06:49 -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="LYOjJ/m+"; 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 S1728575AbgBLIFT (ORCPT + 99 others); Wed, 12 Feb 2020 03:05:19 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46024 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728323AbgBLIFS (ORCPT ); Wed, 12 Feb 2020 03:05:18 -0500 Received: by mail-pg1-f196.google.com with SMTP id b9so649875pgk.12 for ; Wed, 12 Feb 2020 00:05:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FZfa1ntXH/LJudRBtNOhayVMjjFYZbRf83XEbL/qtd0=; b=LYOjJ/m+Ftmip5MezRU4MNIxQdV1fJuaEXlIoCSw0GzUInk8kM76L43Iilb9VU1P2a HTYl5XAfEFJu07YFBjkE6DIhdVjE6UDYhTbgHepAi00+Xdddgw+RE2eCdyF2jFZuJjXZ eTANg9AVD0rd5pE6KQvHMcp+IjXGP789SguOvfYOsml3iYTECK672BOMzQqcNbiyW2EU 1E/zQPIo5Uh8EtfhCCLUZ2NHIX2IzYTfq9RZZuhziM1RMmJrWu2TOgIbKp/JkMtDzfrQ AeKWqjBuyhKspCxyXwn7P8awsAVrsDWuFH6L+4SQRELrF3fxjwEU+HHqe4L7c6JjtK+K PpEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FZfa1ntXH/LJudRBtNOhayVMjjFYZbRf83XEbL/qtd0=; b=sZDG+nwpcVRJB7AQjpq708Uq5gsY1udwSRMxruj69EpfksEZag5AIg92xFu6euAKl9 J27w4cZrKARzuSLMYxOnGcmIWsOAb3GruS0zxVqX9e/vh8nHajeP5eZ0DTOi7/lSm3mw gVLiMzp6ZFynLSk9YRoKTvH7GHjBmJIrlJ/5rH7+aLFOntJ/sXaYYU+Kq0HUvQH8DRAH YYHh+wv2ubNDtockIA+Rlh8UnXpjXDornHO5nK7Ia4XmP2LjFCCFlczOCWH2J2+XdMHZ +mdM9pdQXNZqxxJd68C/+wHxURMYtyAOeilvj33rf/JtBqpGvr9FmvdrGUkDHhZrr3fv aE0w== X-Gm-Message-State: APjAAAVTEYAUg5+OnAbVgDqPe+NeSS6yONORTZpMtn5y/YYlCGdDdWD4 /lPSgmJf9Eo5Vsbm/XNd3CVYlArEZGU= X-Received: by 2002:a62:790e:: with SMTP id u14mr10834140pfc.174.1581494717874; Wed, 12 Feb 2020 00:05:17 -0800 (PST) Received: from localhost ([106.51.21.91]) by smtp.gmail.com with ESMTPSA id k4sm7033045pfg.40.2020.02.12.00.05.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Feb 2020 00:05:17 -0800 (PST) Date: Wed, 12 Feb 2020 13:35:15 +0530 From: afzal mohammed To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juergen Gross , Josh Poimboeuf , Masami Hiramatsu , Peter Zijlstra Subject: [PATCH 14/18] x86: Replace setup_irq() by request_irq() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org request_irq() is preferred over setup_irq(). Existing callers of setup_irq() reached mostly via 'init_IRQ()' & 'time_init()', while memory allocators are ready by 'mm_init()'. Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized. Hence replace setup_irq() by request_irq(). Seldom remove_irq() usage has been observed coupled with setup_irq(), wherever that has been found, it too has been replaced by free_irq(). [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed --- Since cc'ing cover letter to all maintainers/reviewers would be too many, refer for cover letter, https://lkml.kernel.org/r/cover.1581478323.git.afzal.mohd.ma@gmail.com arch/x86/kernel/irqinit.c | 18 +++++++----------- arch/x86/kernel/time.c | 10 +++------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 16919a9671fa..8147075238bf 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c @@ -44,15 +44,6 @@ * (these are usually mapped into the 0x30-0xff vector range) */ -/* - * IRQ2 is cascade interrupt to second interrupt controller - */ -static struct irqaction irq2 = { - .handler = no_action, - .name = "cascade", - .flags = IRQF_NO_THREAD, -}; - DEFINE_PER_CPU(vector_irq_t, vector_irq) = { [0 ... NR_VECTORS - 1] = VECTOR_UNUSED, }; @@ -104,6 +95,11 @@ void __init native_init_IRQ(void) idt_setup_apic_and_irq_gates(); lapic_assign_system_vectors(); - if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) - setup_irq(2, &irq2); + if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) { + /* + * IRQ2 is cascade interrupt to second interrupt controller + */ + if (request_irq(2, no_action, IRQF_NO_THREAD, "cascade", NULL)) + pr_err("request_irq() on %s failed\n", "cascade"); + } } diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index d8673d8a779b..0f9cb386d71f 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c @@ -62,19 +62,15 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct irqaction irq0 = { - .handler = timer_interrupt, - .flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, - .name = "timer" -}; - static void __init setup_default_timer_irq(void) { /* * Unconditionally register the legacy timer; even without legacy * PIC/PIT we need this for the HPET0 in legacy replacement mode. */ - if (setup_irq(0, &irq0)) + if (request_irq(0, timer_interrupt, + IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, "timer", + NULL)) pr_info("Failed to register legacy timer interrupt\n"); } -- 2.24.1