Commit 0c923d1d authored by Mayurkumar Patel's avatar Mayurkumar Patel Committed by Bjorn Helgaas

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: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarMayurkumar Patel <mayurkumar.patel@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent fad214b0
...@@ -566,6 +566,10 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id) ...@@ -566,6 +566,10 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
if (!events) if (!events)
return IRQ_NONE; 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); pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, events);
ctrl_dbg(ctrl, "pending interrupts %#06x from Slot Status\n", 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) ...@@ -598,7 +602,7 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
/* Check Presence Detect Changed */ /* Check Presence Detect Changed */
if (events & PCI_EXP_SLTSTA_PDC) { 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", ctrl_info(ctrl, "Card %spresent on Slot(%s)\n",
present ? "" : "not ", slot_name(slot)); present ? "" : "not ", slot_name(slot));
pciehp_queue_interrupt_event(slot, present ? INT_PRESENCE_ON : pciehp_queue_interrupt_event(slot, present ? INT_PRESENCE_ON :
...@@ -613,7 +617,6 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id) ...@@ -613,7 +617,6 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id)
} }
if (events & PCI_EXP_SLTSTA_DLLSC) { if (events & PCI_EXP_SLTSTA_DLLSC) {
link = pciehp_check_link_active(ctrl);
ctrl_info(ctrl, "slot(%s): Link %s event\n", ctrl_info(ctrl, "slot(%s): Link %s event\n",
slot_name(slot), link ? "Up" : "Down"); slot_name(slot), link ? "Up" : "Down");
pciehp_queue_interrupt_event(slot, link ? INT_LINK_UP : pciehp_queue_interrupt_event(slot, link ? INT_LINK_UP :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment