From patchwork Fri Apr 14 18:40:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fu Wei Fu X-Patchwork-Id: 97447 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp404606qgf; Fri, 14 Apr 2017 11:42:45 -0700 (PDT) X-Received: by 10.84.128.67 with SMTP id 61mr10622958pla.184.1492195365051; Fri, 14 Apr 2017 11:42:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si3126073pgf.39.2017.04.14.11.42.44; Fri, 14 Apr 2017 11:42:45 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbdDNSmm (ORCPT + 14 others); Fri, 14 Apr 2017 14:42:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34926 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754486AbdDNSmf (ORCPT ); Fri, 14 Apr 2017 14:42:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93CF92E6058; Fri, 14 Apr 2017 18:42:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 93CF92E6058 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fu.wei@linaro.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 93CF92E6058 Received: from Rei-Ayanami.localdomain.com (ovpn-8-47.pek2.redhat.com [10.72.8.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52F1962925; Fri, 14 Apr 2017 18:42:21 +0000 (UTC) From: fu.wei@linaro.org To: rjw@rjwysocki.net, lenb@kernel.org, daniel.lezcano@linaro.org, tglx@linutronix.de, marc.zyngier@arm.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, hanjun.guo@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, rruigrok@codeaurora.org, harba@codeaurora.org, cov@codeaurora.org, timur@codeaurora.org, graeme.gregory@linaro.org, al.stone@linaro.org, jcm@redhat.com, wei@redhat.com, arnd@arndb.de, catalin.marinas@arm.com, will.deacon@arm.com, Suravee.Suthikulpanit@amd.com, leo.duran@amd.com, wim@iguana.be, linux@roeck-us.net, linux-watchdog@vger.kernel.org, tn@semihalf.com, christoffer.dall@linaro.org, julien.grall@arm.com, Fu Wei Subject: [PATCH v24 08/11] acpi: Introduce acpi_unregister_irq function Date: Sat, 15 Apr 2017 02:40:11 +0800 Message-Id: <20170414184014.8524-9-fu.wei@linaro.org> In-Reply-To: <20170414184014.8524-1-fu.wei@linaro.org> References: <20170414184014.8524-1-fu.wei@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 14 Apr 2017 18:42:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fu Wei This patch introduces acpi_unregister_irq function to free a linux IRQ number<->GSI mapping by a given linux IRQ number. Even we have successfully registered the GSI, when some error occurs, we may need to unmap it for freeing the IRQ resource. But in some cases, we only have IRQ, but not GSI. This patch is the preparation for memory-mapped timer support in GTDT driver. Signed-off-by: Fu Wei --- drivers/acpi/irq.c | 10 ++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 17 insertions(+) -- 2.9.3 diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c index 830299a..59de777 100644 --- a/drivers/acpi/irq.c +++ b/drivers/acpi/irq.c @@ -85,6 +85,16 @@ void acpi_unregister_gsi(u32 gsi) EXPORT_SYMBOL_GPL(acpi_unregister_gsi); /** + * acpi_unregister_irq() - Free a linux IRQ number<->GSI mapping + * @irq: linux IRQ number + */ +void acpi_unregister_irq(int irq) +{ + irq_dispose_mapping(irq); +} +EXPORT_SYMBOL_GPL(acpi_unregister_irq); + +/** * acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source. * @source: acpi_resource_source to use for the lookup. * diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4b5c146..728d1ed 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -336,6 +336,13 @@ extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); */ void acpi_unregister_gsi (u32 gsi); +/* + * This function undoes the effect of one call to acpi_register_gsi(). + * The irq should be the return value of acpi_register_gsi(). + * If the irq is valid, free a linux IRQ number<->GSI mapping. + */ +void acpi_unregister_irq(int irq); + struct pci_dev; int acpi_pci_irq_enable (struct pci_dev *dev);