diff options
author | Yijing Wang <wangyijing@huawei.com> | 2015-06-19 09:57:45 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-07-16 05:03:33 +0200 |
commit | ac10836b681289f7e430e52b106a209bbdcaa75e (patch) | |
tree | d75f5e273236d2a707867d81c9b288a767d4afa9 /drivers/pci | |
parent | PCI: Use "slot" and "pci_slot" for struct hotplug_slot and struct pci_slot (diff) | |
download | linux-ac10836b681289f7e430e52b106a209bbdcaa75e.tar.xz linux-ac10836b681289f7e430e52b106a209bbdcaa75e.zip |
PCI: pciehp: Simplify pcie_poll_cmd()
Move first slot status read into while to simplify code.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 2913f7e68a10..daf54bee720d 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -109,21 +109,17 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) struct pci_dev *pdev = ctrl_dev(ctrl); u16 slot_status; - pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); - if (slot_status & PCI_EXP_SLTSTA_CC) { - pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, - PCI_EXP_SLTSTA_CC); - return 1; - } - while (timeout > 0) { - msleep(10); - timeout -= 10; + while (true) { pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); if (slot_status & PCI_EXP_SLTSTA_CC) { pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, PCI_EXP_SLTSTA_CC); return 1; } + if (timeout < 0) + break; + msleep(10); + timeout -= 10; } return 0; /* timeout */ } |