From patchwork Wed Feb 19 10:35:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 3680151 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 C9F1B9F35F for ; Wed, 19 Feb 2014 10:35:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00921201D5 for ; Wed, 19 Feb 2014 10:35:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F324620127 for ; Wed, 19 Feb 2014 10:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbaBSKfr (ORCPT ); Wed, 19 Feb 2014 05:35:47 -0500 Received: from mail-ee0-f44.google.com ([74.125.83.44]:33228 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825AbaBSKfq (ORCPT ); Wed, 19 Feb 2014 05:35:46 -0500 Received: by mail-ee0-f44.google.com with SMTP id c13so126226eek.17 for ; Wed, 19 Feb 2014 02:35:43 -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; bh=Ye6z8qSi9yzxiAhmrsmOmr6cbthCj0FKECnC4RSfKJg=; b=XZY/R+UMKj6XhMAvV+DcVpodFsDtLjWE7LCz3SPi+tCXugj3ffdo5vX9ptedJzmhck fpDmlZH8bOaYSypblwez6MZUUXN5RY1HwUQIZXDE85YHxo3J3j9sdw51p32f+7hywfSi 9Yxf0WbxrNSZO3O+zaaZ0IZ3XlJGFv2L9sQPXE1j50e1ld0Sm4Zt50hjpv+btcGCcfhI fES5EuZm76Dy5Yw2cLZfWzLwLtKSjK2Jk9+UrIjCZsRK0RsElmM36USmF6SnK9yELoYb ivcS6UKeRlR8VmYVbMN/Ffp4BodRDHfKhgozP0vo2BpNhv6890xvdxfeeqjaX2/XDIZZ NFzA== X-Gm-Message-State: ALoCoQls9HGpE07b5B1IylkzIPBQmMcqDghITf2QKdat2q6RZ+3FTdk9hytdzVNP4K/pcIu2axKz X-Received: by 10.14.29.6 with SMTP id h6mr2488998eea.84.1392806143734; Wed, 19 Feb 2014 02:35:43 -0800 (PST) Received: from tn-HP3-PC.semihalf.com ([80.82.22.190]) by mx.google.com with ESMTPSA id o43sm81524962eef.12.2014.02.19.02.35.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 02:35:42 -0800 (PST) From: Tomasz Nowicki To: lenb@kernel.org, rjw@rjwysocki.net Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Tomasz Nowicki Subject: [PATCH v2 1/1] ACPI, PCI, ISA: Call ISA-specific code only for architectures which support ISA. Date: Wed, 19 Feb 2014 11:35:22 +0100 Message-Id: <1392806122-23318-1-git-send-email-tomasz.nowicki@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.5 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 This commit moves ISA-specific code to separate function and makes that function depend on CONFIG_{E}ISA so that we do not have to maintain acpi_isa_irq_to_gsi() function for architectures which do not support ISA. Signed-off-by: Tomasz Nowicki --- drivers/acpi/pci_irq.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 361b40c..0a553a0 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -370,6 +370,30 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) return NULL; } +#if IS_ENABLED(CONFIG_ISA) || IS_ENABLED(CONFIG_EISA) +static int acpi_isa_register_gsi(struct pci_dev *dev) +{ + u32 dev_gsi; + + /* Interrupt Line values above 0xF are forbidden */ + if (dev->irq > 0 && (dev->irq <= 0xF) && + (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { + dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", + pin_name(dev->pin), dev->irq); + acpi_register_gsi(&dev->dev, dev_gsi, + ACPI_LEVEL_SENSITIVE, + ACPI_ACTIVE_LOW); + return 0; + } + return -EINVAL; +} +#else +static inline int acpi_isa_register_gsi(struct pci_dev *dev) +{ + return -ENODEV; +} +#endif + int acpi_pci_irq_enable(struct pci_dev *dev) { struct acpi_prt_entry *entry; @@ -416,16 +440,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * driver reported one, then use it. Exit in any case. */ if (gsi < 0) { - u32 dev_gsi; - /* Interrupt Line values above 0xF are forbidden */ - if (dev->irq > 0 && (dev->irq <= 0xF) && - (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { - dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", - pin_name(pin), dev->irq); - acpi_register_gsi(&dev->dev, dev_gsi, - ACPI_LEVEL_SENSITIVE, - ACPI_ACTIVE_LOW); - } else { + if (acpi_isa_register_gsi(dev)) { dev_warn(&dev->dev, "PCI INT %c: no GSI\n", pin_name(pin)); }