Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3957249ybf; Tue, 3 Mar 2020 16:42:02 -0800 (PST) X-Google-Smtp-Source: ADFU+vsqNU3a8qzTtscNSmlym8WJ73Z9lmEpvJ34T0q3EuABH5eP1XkeH1A6A4r/NAQvUSLCZy7X X-Received: by 2002:aca:cc97:: with SMTP id c145mr110444oig.136.1583282522391; Tue, 03 Mar 2020 16:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583282522; cv=none; d=google.com; s=arc-20160816; b=xSFvPmWAUk1+TElcmFHLn6EeVyytAbFu+40wzI17GYVNkU9ehkOkYva87y/djYbEjv jJG1Mv2P4MnUEvpRdcRprXpw0/IwWj5gty4qq+b4CipBS/3F13sGXlpY2ZY781L71+/n jlMP6c4jY6NstY98VEi4Wxuaw6FZiQ2QmOpQbeKKu0EP+yKQEwjWQNmV1927Tknb33iT fRpeB4u1l1V247cJYNje5uMAAHGeHy8AWfz1eb+V/8QKYnf3pglIyiXW0LvaUTtmHvzk BQH5AlE0XqOxGV5X99DIBwSQAi26A0sXJNctipbWk7d5n/pIxjSeV8+/VplGSeKD09HD ImXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=0v4QnmomYtLDKkZhTWixIsZmvX5XApJobfyYR5hOCfc=; b=yfw+ADPnlEp52sl2Ta70elSbG4UFQZQxLhNXhvKhs3nEHRS+0Hv8bmR3JyGlNuIU4n qgqrdPs/c7fmp1Fd+O0CpGPv3VDonWrVceYA4xepXWiLhpu09aLVBDtxG9LLKvlEPmHo tFb7PR1+lZQXxgBn9xCNYXZE66nAA9Zbtd1IrFjD5P01ppdUU8zWcLsSyeUHfGauK0RV ihUunsRVxasek1GLI71THG3OvDHm5qIRL36NARtylGPy6CQZ+n5lOouf8Xp8ds2T3c4s x5CFhXccgL0trcC0W+qAt5pENUyACfDH1wh6AwoIhcB863GHE8EYgmAGyfWqdlBf+eYk Csdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jPg4ZbPc; 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 q72si239505oic.148.2020.03.03.16.41.50; Tue, 03 Mar 2020 16:42:02 -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=jPg4ZbPc; 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 S2387410AbgCDAlY (ORCPT + 99 others); Tue, 3 Mar 2020 19:41:24 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33967 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727903AbgCDAlY (ORCPT ); Tue, 3 Mar 2020 19:41:24 -0500 Received: by mail-pl1-f196.google.com with SMTP id j7so206244plt.1 for ; Tue, 03 Mar 2020 16:41:23 -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; bh=0v4QnmomYtLDKkZhTWixIsZmvX5XApJobfyYR5hOCfc=; b=jPg4ZbPcHFBSU/Btau79OXjm7VZDCp28YCITyUJ8H0fjNnAm9gnxqh+QNGa5auXJyg E1yaJLI9LA4r+9+5fVplhk3IDrFX6AetBZG6IdxqXUIlIKkKlB/04jlmA3JYwRA9pND3 9/vy6DTiTmWPrFhGC75OPyBDkh+1NfhNWdFgWMzTjTKONypvGIM2C0d8W66yFPeCyQyj Jg6UeqUwKk2DTcLzh6pIcaJuFJWH1Mzolv5O1zq2LChVy8TA26on1end9iFLKHzBUiXI GyaGF1hTZSmqdOxY8UkRCdhzsII6mCWomXv2rlktR1rB+1iLfShlV2HLzQNJjnASRv9e PoWw== 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; bh=0v4QnmomYtLDKkZhTWixIsZmvX5XApJobfyYR5hOCfc=; b=fVt6mZfJ+R4XmKt7/y/OM/OfzDhbb8rrWBuGojAKpZvqmz7dHPwGmrhjGq749kX3h7 FAC7/xIUILhSXlNAljpDNtOPEAyLmspK7OgVifusrrfXJ4dTMf96t/GK3wnm1KSfh766 qa9i+2dwbRnjvW4VRYbc7I4ZSJFiv6KKU/lXmHpyENhHzL/V0GJzqNxnFqH7ZaPa1+Fy 03khinyRByUX3emenASMPf/jqqAFpTw1R/YSrD5Ecm1lw0AtD2fi80gt8s0Xr60oowmB Sq0/G88Wa5XV3AfEfCcBn89onKu0kNuMHx2/sveYN9WPgQBPYt0isyNJ2fhsC0Z54s9m 7+8w== X-Gm-Message-State: ANhLgQ2FTDI2zMPgSb4mNfCJNZ9h9mp5wtOxnVQjRgLXfexu7gbsOYvb DQuhrSRwFBilbFuNcB84XXQ= X-Received: by 2002:a17:902:6a84:: with SMTP id n4mr548524plk.294.1583282483035; Tue, 03 Mar 2020 16:41:23 -0800 (PST) Received: from localhost.localdomain ([106.51.232.35]) by smtp.gmail.com with ESMTPSA id f8sm25539697pfn.2.2020.03.03.16.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2020 16:41:22 -0800 (PST) From: afzal mohammed To: linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org Cc: afzal mohammed , Chris Zankel , Max Filippov Subject: [PATCH v3] xtensa: replace setup_irq() by request_irq() Date: Wed, 4 Mar 2020 06:11:11 +0530 Message-Id: <20200304004112.3848-1-afzal.mohd.ma@gmail.com> X-Mailer: git-send-email 2.18.0 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(). Invocations of setup_irq() occur after memory allocators are ready. 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(). [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed --- Hi Max Filippov, i believe you are the maintainer of xtensa, if you are okay w/ this change, please consider taking it thr' your tree, else please let me know. Regards afzal Link to v2 & v1, [v2] https://lkml.kernel.org/r/cover.1582471508.git.afzal.mohd.ma@gmail.com [v1] https://lkml.kernel.org/r/cover.1581478323.git.afzal.mohd.ma@gmail.com v3: * Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers * Modify pr_err displayed in case of error * Re-arrange code & choose pr_err args as required to improve readability * Remove irrelevant parts from commit message & improve v2: * Replace pr_err("request_irq() on %s failed" by pr_err("%s: request_irq() failed" * Commit message massage arch/xtensa/kernel/smp.c | 8 ++------ arch/xtensa/kernel/time.c | 12 +++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c index 83b244ce61ee..cd85a7a2722b 100644 --- a/arch/xtensa/kernel/smp.c +++ b/arch/xtensa/kernel/smp.c @@ -53,16 +53,12 @@ static void system_flush_invalidate_dcache_range(unsigned long start, #define IPI_IRQ 0 static irqreturn_t ipi_interrupt(int irq, void *dev_id); -static struct irqaction ipi_irqaction = { - .handler = ipi_interrupt, - .flags = IRQF_PERCPU, - .name = "ipi", -}; void ipi_init(void) { unsigned irq = irq_create_mapping(NULL, IPI_IRQ); - setup_irq(irq, &ipi_irqaction); + if (request_irq(irq, ipi_interrupt, IRQF_PERCPU, "ipi", NULL)) + pr_err("Failed to request irq %u (ipi)\n", irq); } static inline unsigned int get_core_count(void) diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 69db8c93c1f9..77971fe4cc95 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c @@ -128,12 +128,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct irqaction timer_irqaction = { - .handler = timer_interrupt, - .flags = IRQF_TIMER, - .name = "timer", -}; - void local_timer_setup(unsigned cpu) { struct ccount_timer *timer = &per_cpu(ccount_timer, cpu); @@ -184,6 +178,8 @@ static inline void calibrate_ccount(void) void __init time_init(void) { + int irq; + of_clk_init(NULL); #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT pr_info("Calibrating CPU frequency "); @@ -199,7 +195,9 @@ void __init time_init(void) __func__); clocksource_register_hz(&ccount_clocksource, ccount_freq); local_timer_setup(0); - setup_irq(this_cpu_ptr(&ccount_timer)->evt.irq, &timer_irqaction); + irq = this_cpu_ptr(&ccount_timer)->evt.irq; + if (request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL)) + pr_err("Failed to request irq %d (timer)\n", irq); sched_clock_register(ccount_sched_clock_read, 32, ccount_freq); timer_probe(); } -- 2.25.1