All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: linux-pm@lists.linux-foundation.org
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	linux-pci@vger.kernel.org,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [linux-pm] [PATCH 2/8] PCI / PCIe/ AER: Introduce pci_aer_available()
Date: Tue, 3 Aug 2010 22:59:28 +0200	[thread overview]
Message-ID: <201008032259.28967.rjw@sisk.pl> (raw)
In-Reply-To: <201008031128.02437.rjw@sisk.pl>

On Tuesday, August 03, 2010, Rafael J. Wysocki wrote:
> On Tuesday, August 03, 2010, Hidetoshi Seto wrote:
> > (2010/08/03 6:54), Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rjw@sisk.pl>
> > > 
> > > Introduce a function allowing the caller to check if PCIe AER should
> > > be enabled.
> > > 
> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > > ---
> > (snip)
> > > 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);
> > >  }
> > 
> > Breaking a big lump into small pieces often makes things clear.
> > You should return error when AER is _NOT_ available.
> > 
> > if (!pci_aer_available())
> > 	return -ENXIO;
> > 
> > Be careful...
> 
> Yup, sorry.

Corrected patch is appended.

Thanks,
Rafael

---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: PCI / PCIe/ AER: Introduce pci_aer_available()

Introduce a function allowing the caller to check whether to try to
enable PCIe AER.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/pci/pci.h             |    2 ++
 drivers/pci/pcie/aer/aerdrv.c |    9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

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);
 }

  parent reply	other threads:[~2010-08-03 21:00 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 21:51 [PATCH 0/8] ACPI / PCI / PCIe: Rework _OSC handling (v2) Rafael J. Wysocki
2010-08-02 21:53 ` [PATCH 1/8] ACPI / PCI: Introduce acpi_pci_osc_control_query() Rafael J. Wysocki
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  9:24     ` Rafael J. Wysocki
2010-08-03  9:24     ` Rafael J. Wysocki
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  5:04   ` Kenji Kaneshige
2010-08-03  9:27     ` Rafael J. Wysocki
2010-08-03 20:58       ` Rafael J. Wysocki
2010-08-03 20:58       ` [linux-pm] " Rafael J. Wysocki
2010-08-04  4:28         ` Kenji Kaneshige
2010-08-04 23:37           ` Rafael J. Wysocki
2010-08-04 23:37           ` [linux-pm] " Rafael J. Wysocki
2010-08-05 23:46             ` Rafael J. Wysocki
2010-08-05 23:46             ` [linux-pm] " Rafael J. Wysocki
2010-08-04  4:28         ` Kenji Kaneshige
2010-08-03  9:27     ` Rafael J. Wysocki
2010-08-03  5:04   ` Kenji Kaneshige
2010-08-02 21:53 ` Rafael J. Wysocki
2010-08-02 21:54 ` [PATCH 2/8] PCI / PCIe/ AER: Introduce pci_aer_available() Rafael J. Wysocki
2010-08-02 21:54 ` Rafael J. Wysocki
2010-08-03  0:46   ` Hidetoshi Seto
2010-08-03  0:46   ` Hidetoshi Seto
2010-08-03  9:28     ` Rafael J. Wysocki
2010-08-03 20:59       ` Rafael J. Wysocki
2010-08-03 20:59       ` Rafael J. Wysocki [this message]
2010-08-03  9:28     ` Rafael J. Wysocki
2010-08-03  9:41   ` Jike Song
2010-08-03  9:41   ` Jike Song
2010-08-03 19:50     ` Rafael J. Wysocki
2010-08-03 19:50     ` Rafael J. Wysocki
2010-08-02 21:55 ` [PATCH 3/8] PCI / PCIe: Introduce commad line switch for disabling port services Rafael J. Wysocki
2010-08-02 21:55 ` Rafael J. Wysocki
2010-08-02 21:56 ` [PATCH 4/8] PCI / PCIe: Ask BIOS for control of all native services at once (v6) Rafael J. Wysocki
2010-08-02 21:56 ` Rafael J. Wysocki
2010-08-03  1:14   ` Hidetoshi Seto
2010-08-03  1:14   ` Hidetoshi Seto
2010-08-03 21:01     ` Rafael J. Wysocki
2010-08-03 21:01     ` Rafael J. Wysocki
2010-08-06  1:33   ` Hidetoshi Seto
2010-08-06  1:33   ` Hidetoshi Seto
2010-08-06 10:47     ` Rafael J. Wysocki
2010-08-02 21:57 ` [PATCH 5/8] PCI / PCIe: Disable PCIe port services during port initialization Rafael J. Wysocki
2010-08-02 21:57 ` Rafael J. Wysocki
2010-08-02 21:58 ` [PATCH 6/8] PCI / PCIe: Remove the port driver module exit routine Rafael J. Wysocki
2010-08-02 21:58 ` Rafael J. Wysocki
2010-08-02 21:59 ` [PATCH 7/8] ACPI / PCI: Do not preserve _OSC control bits returned by a query (v2) Rafael J. Wysocki
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  7:13     ` Hidetoshi Seto
2010-08-03  9:33       ` Rafael J. Wysocki
2010-08-03 21:02         ` [linux-pm] " Rafael J. Wysocki
2010-08-04  5:46           ` Kenji Kaneshige
2010-08-04  8:41             ` Hidetoshi Seto
2010-08-04  9:23               ` Kenji Kaneshige
2010-08-04  9:23               ` [linux-pm] " Kenji Kaneshige
2010-08-04 10:29               ` Rafael J. Wysocki
2010-08-04 10:29               ` [linux-pm] " Rafael J. Wysocki
2010-08-04 23:51                 ` Rafael J. Wysocki
2010-08-05  3:40                   ` Hidetoshi Seto
2010-08-05 14:25                     ` Rafael J. Wysocki
2010-08-05 14:25                     ` [linux-pm] " Rafael J. Wysocki
2010-08-06  1:28                       ` Hidetoshi Seto
2010-08-06  1:28                       ` [linux-pm] " Hidetoshi Seto
2010-08-05  3:40                   ` Hidetoshi Seto
2010-08-04 23:51                 ` Rafael J. Wysocki
2010-08-04  8:41             ` Hidetoshi Seto
2010-08-04  8:43             ` Hidetoshi Seto
2010-08-04  8:43             ` [linux-pm] " Hidetoshi Seto
2010-08-04  9:39               ` Kenji Kaneshige
2010-08-04 12:15                 ` Rafael J. Wysocki
2010-08-05  3:38                   ` [linux-pm] " Hidetoshi Seto
2010-08-05  3:38                   ` Hidetoshi Seto
2010-08-04  9:39               ` Kenji Kaneshige
2010-08-04 10:38               ` Rafael J. Wysocki
2010-08-04 10:38               ` [linux-pm] " Rafael J. Wysocki
2010-08-04  5:46           ` Kenji Kaneshige
2010-08-03 21:02         ` Rafael J. Wysocki
2010-08-03  9:33       ` Rafael J. Wysocki
2010-08-03  7:13     ` Hidetoshi Seto
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-02 21:59 ` Rafael J. Wysocki
2010-08-02 22:00 ` [PATCH 8/8] ACPI / PCI: Reorder checks in acpi_pci_osc_control_set() Rafael J. Wysocki
2010-08-02 22:00 ` Rafael J. Wysocki
2010-08-03  4:51 ` [PATCH 0/8] ACPI / PCI / PCIe: Rework _OSC handling (v2) Kenji Kaneshige
2010-08-03  4:51 ` Kenji Kaneshige

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008032259.28967.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.