From patchwork Mon Aug 2 21:54:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 116621 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o72M31DF020111 for ; Mon, 2 Aug 2010 22:03:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755595Ab0HBWDC (ORCPT ); Mon, 2 Aug 2010 18:03:02 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:57754 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755422Ab0HBWCw (ORCPT ); Mon, 2 Aug 2010 18:02:52 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 3ECFF18E618; Mon, 2 Aug 2010 23:56:16 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31130-03; Mon, 2 Aug 2010 23:55:58 +0200 (CEST) Received: from ferrari.localnet (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 124BA18E233; Mon, 2 Aug 2010 23:55:58 +0200 (CEST) From: "Rafael J. Wysocki" To: Jesse Barnes Subject: [PATCH 2/8] PCI / PCIe/ AER: Introduce pci_aer_available() Date: Mon, 2 Aug 2010 23:54:46 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.35-rjw+; KDE/4.4.4; x86_64; ; ) Cc: ACPI Devel Maling List , Len Brown , linux-pm@lists.linux-foundation.org, linux-pci@vger.kernel.org, Hidetoshi Seto , Kenji Kaneshige , Matthew Garrett References: <201008022351.31406.rjw@sisk.pl> In-Reply-To: <201008022351.31406.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201008022354.46369.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 02 Aug 2010 22:03:05 +0000 (UTC) Index: linux-2.6/drivers/pci/pci.h =================================================================== --- linux-2.6.orig/drivers/pci/pci.h +++ linux-2.6/drivers/pci/pci.h @@ -131,8 +131,10 @@ static inline void pci_msi_init_pci_dev( #ifdef CONFIG_PCIEAER void pci_no_aer(void); +bool pci_aer_available(void); #else static inline void pci_no_aer(void) { } +static inline bool pci_aer_available(void) { return false; } #endif static inline int pci_no_d1d2(struct pci_dev *dev) Index: linux-2.6/drivers/pci/pcie/aer/aerdrv.c =================================================================== --- linux-2.6.orig/drivers/pci/pcie/aer/aerdrv.c +++ linux-2.6/drivers/pci/pcie/aer/aerdrv.c @@ -72,6 +72,11 @@ void pci_no_aer(void) pcie_aer_disable = 1; /* has priority over 'forceload' */ } +bool pci_aer_available(void) +{ + return !pcie_aer_disable && pci_msi_enabled(); +} + static int set_device_error_reporting(struct pci_dev *dev, void *data) { bool enable = *((bool *)data); @@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_ */ static int __init aer_service_init(void) { - if (pcie_aer_disable) - return -ENXIO; - if (!pci_msi_enabled()) + if (pci_aer_available()) return -ENXIO; return pcie_port_service_register(&aerdriver); }