summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorMayurkumar Patel <mayurkumar.patel@intel.com>2016-09-09 09:10:17 -0500
committerBjorn Helgaas <bhelgaas@google.com>2016-09-14 14:24:40 -0500
commit0c923d1da394b96727b813d1e64412b72f1dc580 (patch)
tree7a023b2ba1d8efbbb9a57c97ec40ff9a65a662d4 /drivers/pci/hotplug/pciehp_hpc.c
parentfad214b0aa726ee21adcac4308d388efcb89d6bd (diff)
downloadop-kernel-dev-0c923d1da394b96727b813d1e64412b72f1dc580.zip
op-kernel-dev-0c923d1da394b96727b813d1e64412b72f1dc580.tar.gz
PCI: pciehp: Don't re-read Slot Status when queuing hotplug event
Previously we read Slot Status to learn about hotplug events, then cleared the events, then re-read Slot Status to find out what happened. But Slot Status might have changed before the second read. Capture the Slot Status once before clearing the events. Also capture the Link Status if we had a link status change. [bhelgaas: changelog, split to separate patch] Tested-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Mayurkumar Patel <mayurkumar.patel@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 625fa6a..fe99b45 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -566,6 +566,10 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
if (!events)
return IRQ_NONE;
+ /* Capture link status before clearing interrupts */
+ if (events & PCI_EXP_SLTSTA_DLLSC)
+ link = pciehp_check_link_active(ctrl);
+
pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, events);
ctrl_dbg(ctrl, "pending interrupts %#06x from Slot Status\n", events);
@@ -598,7 +602,7 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
/* Check Presence Detect Changed */
if (events & PCI_EXP_SLTSTA_PDC) {
- pciehp_get_adapter_status(slot, &present);
+ present = !!(status & PCI_EXP_SLTSTA_PDS);
ctrl_info(ctrl, "Card %spresent on Slot(%s)\n",
present ? "" : "not ", slot_name(slot));
pciehp_queue_interrupt_event(slot, present ? INT_PRESENCE_ON :
@@ -613,7 +617,6 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
}
if (events & PCI_EXP_SLTSTA_DLLSC) {
- link = pciehp_check_link_active(ctrl);
ctrl_info(ctrl, "slot(%s): Link %s event\n",
slot_name(slot), link ? "Up" : "Down");
pciehp_queue_interrupt_event(slot, link ? INT_LINK_UP :
OpenPOWER on IntegriCloud