From patchwork Tue Dec 3 16:39:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3277941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28EC3C0D4A for ; Tue, 3 Dec 2013 17:16:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04FD5203EC for ; Tue, 3 Dec 2013 17:16:31 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AB782022F for ; Tue, 3 Dec 2013 17:16:28 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnt2W-00079n-UB; Tue, 03 Dec 2013 16:41:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnt2M-0001Dv-KY; Tue, 03 Dec 2013 16:41:26 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vnt2I-0001Au-V5 for linux-arm-kernel@lists.infradead.org; Tue, 03 Dec 2013 16:41:24 +0000 Received: by mail-pd0-f180.google.com with SMTP id q10so20356954pdj.39 for ; Tue, 03 Dec 2013 08:41:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bVC0MBnxWKccHBUaQAPr4rQ1t7vheA4I+g1zeWx0/u8=; b=bdwdv+n7fsw6MFjf81nGyy11wwCrb+46sSWyR2p5MANQrRmhucVL+NI0Nl5hcxk7Bw Jtbi9W8ITCvScL/DbK6ltVnfQsQ1dFtf8wM7LpNDWQo65EC45S9e2Jp6+3R5LgQMisVw hpxEIeG6aaOnoX6RYho986VO/jIKa4SrdlpdHCoLBWGdTOBQB2l/GpGK6qDOW4Ok6WSA /8LLj/gOqiQTAEc9UGNqgcsjh1v6Fm0H5CSF0agdk5ty4FocJCv4TdZffLAkTW/NllB6 WTvaNqLTCrmVMXTyQOp51QRmc2vrkmt68BW+VcvDD2u6s25PctB50y1Y3uluojQd3CUg c7XA== X-Gm-Message-State: ALoCoQmOQD1bcK/rjBC/fgjlEvCswAZBwQRxm1SKMFTXkliQaXl380R/DqAXwPQlH+kj8QNbVcJ2 X-Received: by 10.68.163.33 with SMTP id yf1mr15172754pbb.143.1386088861185; Tue, 03 Dec 2013 08:41:01 -0800 (PST) Received: from localhost ([219.142.3.202]) by mx.google.com with ESMTPSA id og5sm89485202pbb.10.2013.12.03.08.40.52 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:41:00 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux , Daniel Lezcano Subject: [RFC part2 PATCH 7/9] irqdomain: Add a new API irq_create_acpi_mapping() Date: Wed, 4 Dec 2013 00:39:11 +0800 Message-Id: <1386088753-2850-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386088753-2850-1-git-send-email-hanjun.guo@linaro.org> References: <1386088753-2850-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131203_114123_111869_BA06C4E8 X-CRM114-Status: GOOD ( 15.19 ) X-Spam-Score: -1.9 (-) Cc: Mark Rutland , Matthew Garrett , linaro-kernel@lists.linaro.org, patches@linaro.org, Linus Walleij , Olof Johansson , linux-kernel@vger.kernel.org, Rob Herring , linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org, Amit Daniel Kachhap , Jon Masters , Grant Likely , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Hanjun Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Amit Daniel Kachhap This patch introduces a new API for acpi based irq mapping. [hanjun: Rework this patch to delete the reference to gic_irq_domain_xlate() which can simplify the code a lot.] Signed-off-by: Amit Daniel Kachhap Signed-off-by: Hanjun Guo --- include/linux/acpi.h | 2 ++ kernel/irq/irqdomain.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 1e6a0ac..edd5806 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -141,6 +141,8 @@ int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu); int acpi_unmap_lsapic(int cpu); #endif /* CONFIG_ACPI_HOTPLUG_CPU */ +unsigned int irq_create_acpi_mapping(irq_hw_number_t hwirq, + unsigned int type); int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); void acpi_irq_stats_init(void); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index cf68bb3..c661552 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -501,6 +501,33 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) } EXPORT_SYMBOL_GPL(irq_create_of_mapping); +#ifdef CONFIG_ACPI +unsigned int irq_create_acpi_mapping(irq_hw_number_t hwirq, + unsigned int type) +{ + struct irq_domain *domain; + unsigned int virq; + + domain = irq_default_domain; + if (!domain) { + pr_warn("no irq domain found !\n"); + return 0; + } + + /* Create mapping */ + virq = irq_create_mapping(domain, hwirq); + if (!virq) + return virq; + + /* Set type if specified and different than the current one */ + if (type != IRQ_TYPE_NONE && + type != irq_get_trigger_type(virq)) + irq_set_irq_type(virq, type); + return virq; +} +EXPORT_SYMBOL_GPL(irq_create_acpi_mapping); +#endif + /** * irq_dispose_mapping() - Unmap an interrupt * @virq: linux irq number of the interrupt to unmap