From patchwork Tue Oct 16 13:06:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12278 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 26265214A95 for ; Tue, 16 Oct 2012 13:07:01 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id ADD17A1805B for ; Tue, 16 Oct 2012 13:07:00 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so4422171iag.11 for ; Tue, 16 Oct 2012 06:07:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=CtA6y9dSpQ7M72C1ocgnbGw6pSHWcy6u0zIrbR9IFFE=; b=ehJcYN5h0Hl1MALrSC/SYAFsQkEDrFxSNBj9Azvbc0e8nqqerrmLnePgvbuHgY08Ij sxiVWSYvpncka+5zjGUUv5OeQJUBlSlU9s94Z/7YVE5osdwHowyYzex91CbKH2hL5vlj rviYvxMkTMHrRWCjsvTbqUT5QYOKBKHUP+IdKUdAOAvOCBUNulpxsF4wrDgtcyK7rtL9 wwJ+SuKDpI3lXueMBsl3LEAdBtMnnm67/SskUGUxgfH1p5o6KVu/YmKYW6sm/dc/AoOC PugieVtn7VTkR2S/JbwJhRCvlSBhMA2aZxu/347lCffBMmjbZ0+BPSCjRKGRu5Gd4a3/ BNig== Received: by 10.50.152.137 with SMTP id uy9mr11704442igb.62.1350392820151; Tue, 16 Oct 2012 06:07:00 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp722510igt; Tue, 16 Oct 2012 06:06:59 -0700 (PDT) Received: by 10.14.172.195 with SMTP id t43mr20990571eel.17.1350392818640; Tue, 16 Oct 2012 06:06:58 -0700 (PDT) Received: from eu1sys200aog106.obsmtp.com (eu1sys200aog106.obsmtp.com [207.126.144.121]) by mx.google.com with SMTP id l45si13168731eep.63.2012.10.16.06.06.52 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Oct 2012 06:06:58 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.121; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKUH1b652AYTsgGTXWfVgxYzk873aYdcL3@postini.com; Tue, 16 Oct 2012 13:06:58 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C5601D0; Tue, 16 Oct 2012 13:06:39 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5A4EB447B; Tue, 16 Oct 2012 13:06:39 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id EEA2224C2F9; Tue, 16 Oct 2012 15:06:26 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 16 Oct 2012 15:06:33 +0200 From: Linus Walleij To: Cc: Anmar Oueja , Linus Walleij , Rob Herring , Grant Likely Subject: [PATCH] ARM: VIC: use irq_domain_add_simple() Date: Tue, 16 Oct 2012 15:06:26 +0200 Message-ID: <1350392786-29191-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlkDZXJzHQpjYDoZ9ajXy6jUiN3g0KVlaKPeWFlxLEKYlYGtuTohacsk5Fpt01V0nynsk1l From: Linus Walleij Instead of allocating descriptors on-the-fly for the device tree initialization case, use irq_domain_add_simple() which will take care of this if you pass negative as the first_irq. Alter the signature of __vic_init() to pass the first_irq as signed so this works as expected. Switching the VIC to use irq_domain_add_simple() also has the upside of displaying the same WARNING when you boot with pre-allocated descriptors on systems using SPARSE_IRQ but yet not using device tree. Cc: Rob Herring Cc: Grant Likely Signed-off-by: Linus Walleij --- arch/arm/common/vic.c | 18 ++++++------------ arch/arm/include/asm/hardware/vic.h | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c index e0d5388..4fd5d98 100644 --- a/arch/arm/common/vic.c +++ b/arch/arm/common/vic.c @@ -218,7 +218,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq, v->resume_sources = resume_sources; v->irq = irq; vic_id++; - v->domain = irq_domain_add_legacy(node, fls(valid_sources), irq, 0, + v->domain = irq_domain_add_simple(node, fls(valid_sources), irq, &vic_irqdomain_ops, v); } @@ -350,7 +350,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start, vic_register(base, irq_start, vic_sources, 0, node); } -void __init __vic_init(void __iomem *base, unsigned int irq_start, +void __init __vic_init(void __iomem *base, int irq_start, u32 vic_sources, u32 resume_sources, struct device_node *node) { @@ -416,18 +416,12 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent) if (WARN_ON(!regs)) return -EIO; - irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); - if (WARN_ON(irq_base < 0)) - goto out_unmap; - - __vic_init(regs, irq_base, ~0, ~0, node); + /* + * Passing -1 as first IRQ makes the simple domain allocate descriptors + */ + __vic_init(regs, -1, ~0, ~0, node); return 0; - - out_unmap: - iounmap(regs); - - return -EIO; } #endif /* CONFIG OF */ diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h index e14af1a..2bebad3 100644 --- a/arch/arm/include/asm/hardware/vic.h +++ b/arch/arm/include/asm/hardware/vic.h @@ -47,7 +47,7 @@ struct device_node; struct pt_regs; -void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, +void __vic_init(void __iomem *base, int irq_start, u32 vic_sources, u32 resume_sources, struct device_node *node); void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); int vic_of_init(struct device_node *node, struct device_node *parent);