From patchwork Mon Dec 7 22:39:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 7792391 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 149ACBEEE1 for ; Mon, 7 Dec 2015 22:39:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B09A2038A for ; Mon, 7 Dec 2015 22:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E97902056E for ; Mon, 7 Dec 2015 22:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933381AbbLGWjX (ORCPT ); Mon, 7 Dec 2015 17:39:23 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37550 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933357AbbLGWjV (ORCPT ); Mon, 7 Dec 2015 17:39:21 -0500 Received: by wmww144 with SMTP id w144so6796089wmw.0; Mon, 07 Dec 2015 14:39:19 -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=RpP6rayCbVTWoeX+88KCjvIMikEYkkwZRIjo0AXkdtQ=; b=VWcpIgIYzerfWJnuHL8kNUmP6klfnD3HErx0QFg0V24+7ueoK5s6P0E4Yj9OUJxZs3 PnGYaLoL3vGqbFkzylnqeFnODhyE8mYoFDsb4Lm0IL+CdZlZjxsuhTHA4OLAUGdaHywW zOmrlioTcK3AeyZfjVS7i5eiyQKXrwigTlki6n6upo/KVqEaZTDgGFEPPhGf9dMjucyI a1BA5gkbq/rN9PJaEdqYZHb4egDx5dU8v5muDKxFt2MnbzCb7S6A+JYOtX7hUi2G4TDl IfsGVgmqkjHU9f+6/7sFJ5OpIQmC/JTs/zyy387mvI3DWQDkYx6MV0zy/Tc070ceBp1C hdNQ== X-Received: by 10.28.51.135 with SMTP id z129mr23614540wmz.19.1449527959716; Mon, 07 Dec 2015 14:39:19 -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 w67sm650187wmw.17.2015.12.07.14.39.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Dec 2015 14:39:18 -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 v4 1/3] acpi: Rename acpi_gsi_get_irq_type to acpi_get_irq_type and export symbol Date: Mon, 7 Dec 2015 23:39:10 +0100 Message-Id: <1449527952-8399-2-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449527952-8399-1-git-send-email-christophe-h.ricard@st.com> References: <1449527952-8399-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 utility function. Signed-off-by: Christophe Ricard --- drivers/acpi/gsi.c | 21 +-------------------- drivers/acpi/utils.c | 21 +++++++++++++++++++++ include/linux/acpi.h | 2 ++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a..2828351 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_get_irq_type(trigger, polarity); fwspec.param_count = 2; return irq_create_fwspec_mapping(&fwspec); diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 475c907..715b24b 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -33,6 +33,27 @@ #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME("utils"); +unsigned int acpi_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; + } +} +EXPORT_SYMBOL_GPL(acpi_get_irq_type); + + /* -------------------------------------------------------------------------- Object Evaluation Helpers -------------------------------------------------------------------------- */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d863e12..b0c5a11 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -204,6 +204,8 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); void acpi_set_irq_model(enum acpi_irq_model_id model, struct fwnode_handle *fwnode); +unsigned int acpi_get_irq_type(int trigger, int polarity); + #ifdef CONFIG_X86_IO_APIC extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); #else