From patchwork Sun Dec 13 11:15:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 7838991 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 306E99F6CD for ; Sun, 13 Dec 2015 11:16:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B0FA20340 for ; Sun, 13 Dec 2015 11:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AF5720389 for ; Sun, 13 Dec 2015 11:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbbLMLQI (ORCPT ); Sun, 13 Dec 2015 06:16:08 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:32850 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbbLMLQF (ORCPT ); Sun, 13 Dec 2015 06:16:05 -0500 Received: by mail-wm0-f54.google.com with SMTP id n186so10270813wmn.0; Sun, 13 Dec 2015 03:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+DeeCAvRhp4qNM3PeA5yOOEgLQoTsp0lzii++FoWS8Y=; b=XNayjq91JxGGJJ24EXcE1HqZhLaHW5Rp7AV0qTrbPBUWIWSAjxemiRhJOEnrLiiMSL utU2KWBwXdg9ffdJ47bcHRJ7MQKfGSs0E8pcQ9v9nLUsRr/T640Mkbkxpy5z10NAyDgP 6a8xsHEkjAtdJeLj2iAW9ZCePFen8KWm4I4tpFCEvRdvsVPpG2jyDzOaf29OG+N0AHry UtBcKHSaghMtsPwII4igifp+d0rehN5joDT4szQkv9xDJplK843aBvObA3BOXoU+6zVT WIAZpFVH93G8KUMob4gfc21San7dEGyC6R8tQzqr3ynf4IstzpU9s2T+jT5YJh2qwTXh XhdA== X-Received: by 10.28.218.75 with SMTP id r72mr16785411wmg.59.1450005364486; Sun, 13 Dec 2015 03:16:04 -0800 (PST) Received: from localhost.localdomain (ax113-6-78-236-204-66.fbx.proxad.net. [78.236.204.66]) by smtp.gmail.com with ESMTPSA id 193sm11265773wmp.16.2015.12.13.03.16.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 Dec 2015 03:16:03 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: rjw@rjwysocki.net, lenb@kernel.org, linus.walleij@linaro.org, gnurou@gmail.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, Christophe Ricard Subject: [PATCH v6 1/3] acpi: Rename acpi_gsi_get_irq_type to acpi_dev_get_irq_type and export symbol Date: Sun, 13 Dec 2015 12:15:53 +0100 Message-Id: <1450005355-6633-2-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450005355-6633-1-git-send-email-christophe-h.ricard@st.com> References: <1450005355-6633-1-git-send-email-christophe-h.ricard@st.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 acpi_gsi_get_irq_type could be use out of gsi purpose. Rename and make it available as a resource function. Signed-off-by: Christophe Ricard --- drivers/acpi/gsi.c | 21 +-------------------- drivers/acpi/resource.c | 26 ++++++++++++++++++++++++++ include/linux/acpi.h | 1 + 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a..ee9e0f2 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c @@ -17,25 +17,6 @@ enum acpi_irq_model_id acpi_irq_model; static struct fwnode_handle *acpi_gsi_domain_id; -static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) -{ - switch (polarity) { - case ACPI_ACTIVE_LOW: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_FALLING : - IRQ_TYPE_LEVEL_LOW; - case ACPI_ACTIVE_HIGH: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_RISING : - IRQ_TYPE_LEVEL_HIGH; - case ACPI_ACTIVE_BOTH: - if (trigger == ACPI_EDGE_SENSITIVE) - return IRQ_TYPE_EDGE_BOTH; - default: - return IRQ_TYPE_NONE; - } -} - /** * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI * @gsi: GSI IRQ number to map @@ -82,7 +63,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, fwspec.fwnode = acpi_gsi_domain_id; fwspec.param[0] = gsi; - fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity); + fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity); fwspec.param_count = 2; return irq_create_fwspec_mapping(&fwspec); diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 15d22db..521b5ac 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef CONFIG_X86 #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) @@ -333,6 +334,31 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) } EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); +/** + * acpi_dev_get_irq_type - Determine irq type. + * @triggering: Triggering type as provided by ACPI. + * @polarity: Interrupt polarity as provided by ACPI. + */ +unsigned int acpi_dev_get_irq_type(int triggering, int polarity) +{ + switch (polarity) { + case ACPI_ACTIVE_LOW: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_FALLING : + IRQ_TYPE_LEVEL_LOW; + case ACPI_ACTIVE_HIGH: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_RISING : + IRQ_TYPE_LEVEL_HIGH; + case ACPI_ACTIVE_BOTH: + if (triggering == ACPI_EDGE_SENSITIVE) + return IRQ_TYPE_EDGE_BOTH; + default: + return IRQ_TYPE_NONE; + } +} +EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); + static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) { res->start = gsi; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d863e12..c14db41 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -299,6 +299,7 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares, bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, struct resource_win *win); unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); +unsigned int acpi_dev_get_irq_type(int triggering, int polarity); bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, struct resource *res);