[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <236b7af1f36698b34c01857d0a2a18c4ab850c5f.1634825082.git.naveennaidu479@gmail.com>
Date: Thu, 21 Oct 2021 20:37:45 +0530
From: Naveen Naidu <naveennaidu479@...il.com>
To: bhelgaas@...gle.com
Cc: Naveen Naidu <naveennaidu479@...il.com>,
linux-kernel-mentees@...ts.linuxfoundation.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
skhan@...uxfoundation.org, Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
Krzysztof WilczyĆski <kw@...ux.com>,
Sean V Kelley <sean.v.kelley@...el.com>
Subject: [PATCH v3 20/25] PCI/PME: Use RESPONSE_IS_PCI_ERROR() to check read from hardware
An MMIO read from a PCI device that doesn't exist or doesn't respond
causes a PCI error. There's no real data to return to satisfy the
CPU read, so most hardware fabricates ~0 data.
Use RESPONSE_IS_PCI_ERROR() to check the response we get when we read
data from hardware.
This helps unify PCI error response checking and make error checks
consistent and easier to find.
Compile tested only.
Signed-off-by: Naveen Naidu <naveennaidu479@...il.com>
---
drivers/pci/pcie/pme.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index 1d0dd77fed3a..bad7ba420c18 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -224,7 +224,7 @@ static void pcie_pme_work_fn(struct work_struct *work)
break;
pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
- if (rtsta == (u32) ~0)
+ if (RESPONSE_IS_PCI_ERROR(rtsta))
break;
if (rtsta & PCI_EXP_RTSTA_PME) {
@@ -274,7 +274,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
spin_lock_irqsave(&data->lock, flags);
pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
- if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) {
+ if (RESPONSE_IS_PCI_ERROR(rtsta) || !(rtsta & PCI_EXP_RTSTA_PME)) {
spin_unlock_irqrestore(&data->lock, flags);
return IRQ_NONE;
}
--
2.25.1
Powered by blists - more mailing lists