From patchwork Thu Feb 20 13:27:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 3686991 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB48BBF13A for ; Thu, 20 Feb 2014 13:28:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5D4220155 for ; Thu, 20 Feb 2014 13:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83DC620158 for ; Thu, 20 Feb 2014 13:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753944AbaBTN2E (ORCPT ); Thu, 20 Feb 2014 08:28:04 -0500 Received: from mail-ea0-f172.google.com ([209.85.215.172]:59674 "EHLO mail-ea0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915AbaBTN2D (ORCPT ); Thu, 20 Feb 2014 08:28:03 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so923517eaj.3 for ; Thu, 20 Feb 2014 05:28:01 -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=5KaPFY9VNz9itANcGQduZ3+l3OeursE1j73gbcxcIrs=; b=aKQcI0sCtFuEFG9mcQ2rG8Rav73FPZwRSIUHIKqjLarF4P0SWZSCfA+qJAWPi1Byy+ AbJPSQIQ66mqLJD8mDYKS7m/0ddMDGezGuY2JlacsdGJYREALhb2wesqf+IleQz5utS0 T8jld+0kk1eWrW5hU5Df1eMne7HbFEw1httE7PekkwQF9J4+bvlUjNwuvhMOTsS82cHD MO0QazfmjWXMVWovVsnYTMlYW6zsJGgB7QPuw6svzj2HACiLLYuIE6IGLweUesjOru/W 2wJEkFhUazRm0q0oxj2iGuWxeNqiFobnfURRpRmEf/teumkZztNcb6t5jAdpirpstw3V B5zw== X-Gm-Message-State: ALoCoQlari/mwQQdpl514lsnSDW4IPgdHwP1MSS04kJM7yiZHsw7WAcfCEK+NVUrgA8q8o+Xadx1 X-Received: by 10.14.103.134 with SMTP id f6mr1869498eeg.41.1392902881197; Thu, 20 Feb 2014 05:28:01 -0800 (PST) Received: from tn-HP3-PC.semihalf.com ([80.82.22.190]) by mx.google.com with ESMTPSA id v6sm13839690eef.2.2014.02.20.05.27.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 05:28:00 -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 v3 1/1] ACPI, PCI, ISA: Call ISA-specific code only for architectures which support ISA. Date: Thu, 20 Feb 2014 14:27:46 +0100 Message-Id: <1392902866-5256-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 | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 361b40c..9c62340 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,19 +440,9 @@ 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)); - } kfree(entry); return 0;