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: 21988 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5E892202AE for ; Tue, 3 Dec 2013 16:41:03 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf46729789obc.9 for ; Tue, 03 Dec 2013 08:41:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=bVC0MBnxWKccHBUaQAPr4rQ1t7vheA4I+g1zeWx0/u8=; b=PlZTT2ElUTW8oWuG1GTQsFw/9z7PVCDKfbKnNKY7n7MI8uhBMsp3q5IhUvWzxNFh/0 TWfrLxmba34yUvZ/AzKN1GSj+RRMmK6/MQSmOoF8RmGxZtMcgF2x8KqTkHcgV5yyqedO lZAJBvmlXHiFLUH1/FdDNFb7koExq+cI3/u29enZXq3otln4YAcjoB9BNycaD7VCNhBD cTxuA2yeqrpk+ZPe9EjJfsQL3rWVzJgI4izZU76i7gNmAz+tZXcMcb//iRS12Pq38K6y ZlzylU5vsp2Q4L+K6CKCNkwe2mRO5xGoJ36+yXEnNrjFRF9HEGwTNiIJSQ9STdnKGXIy TUmw== X-Gm-Message-State: ALoCoQnqBwOFzZftN4DB1mMOLUD7YNqRnKw53pYQS213Efa0v7Fl3j+uRwp54mjMTZi4u+ZPmTL1 X-Received: by 10.42.175.73 with SMTP id az9mr592010icb.4.1386088862821; Tue, 03 Dec 2013 08:41:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.46 with SMTP id nd14ls5471896qeb.19.gmail; Tue, 03 Dec 2013 08:41:02 -0800 (PST) X-Received: by 10.221.51.206 with SMTP id vj14mr56905479vcb.17.1386088862725; Tue, 03 Dec 2013 08:41:02 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id tl2si4406417vdc.77.2013.12.03.08.41.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:41:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id ht10so10314588vcb.1 for ; Tue, 03 Dec 2013 08:41:02 -0800 (PST) X-Received: by 10.52.164.16 with SMTP id ym16mr1714357vdb.39.1386088862576; Tue, 03 Dec 2013 08:41:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp222662vcz; Tue, 3 Dec 2013 08:41:02 -0800 (PST) X-Received: by 10.67.22.38 with SMTP id hp6mr76422806pad.53.1386088861646; Tue, 03 Dec 2013 08:41:01 -0800 (PST) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id ty3si47158937pbc.347.2013.12.03.08.41.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:41:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id y10so20397110pdj.37 for ; Tue, 03 Dec 2013 08:41:01 -0800 (PST) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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