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: 3277791 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6EE39F380 for ; Tue, 3 Dec 2013 16:44:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3B8120173 for ; Tue, 3 Dec 2013 16:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F803203EB for ; Tue, 3 Dec 2013 16:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753949Ab3LCQlS (ORCPT ); Tue, 3 Dec 2013 11:41:18 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:59960 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754704Ab3LCQlE (ORCPT ); Tue, 3 Dec 2013 11:41:04 -0500 Received: by mail-pd0-f177.google.com with SMTP id q10so20127436pdj.8 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=MeOmXSL8dxsKsP6ppKFrreCVg6MqZ9RF10oPOzpCKlxlWqmIPQeCk1uest3PUDBMib FIvEn70oapJ0DeC2B+tIYgQzdg5eh32elRa+n/NM+wFMqjW6MHuAlLGFjPPXUEoveb6a z9fnIwu8Gly9t7oCScgUQ61yhVHB8E/Ubq09ImbSGM18xRdnUbJdfMeBJi277pjQYXSQ x69a83S26DGrFXEasYhafMnXBo5fRBjQHmZfgoMuFPH6lxIyGF9BGDv1tEbjt84BRiFL tFhDP5R485g0bAd/Fz/zV1UpMroPkC9QZuEuiRzfzUwEJ+TH0+Q/hR8KpDHGE+TxxCbw xsPA== X-Gm-Message-State: ALoCoQmVwKmEa2jrOQKeLdNhg/NxRaFBgunjc6DOY9GGhcB3/Uao9A9Smxj/PRiNWhEcQMoFV+cS 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 Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Grant Likely , Matthew Garrett , Olof Johansson , Linus Walleij , Bjorn Helgaas , Rob Herring , Mark Rutland , Jon Masters , patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Amit Daniel Kachhap , Hanjun Guo 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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