PCI: pciehp: Simplify "Power Fault Detected" checking/clearing
authorBjorn Helgaas <bhelgaas@google.com>
Sat, 14 Dec 2013 20:06:40 +0000 (13:06 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 16 Dec 2013 01:00:00 +0000 (18:00 -0700)
It's simpler to test the PCI_EXP_SLTSTA_PFD bit directly and to write the
constant back to PCI_EXP_SLTSTA.

No functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/pciehp_hpc.c

index 55109d6d8a9016d9d759eabd60b9d29f55490f6e..cb3100af7e8c8e6d707713719392c0bd586333f8 100644 (file)
@@ -501,9 +501,9 @@ int pciehp_power_on_slot(struct slot * slot)
 
        /* Clear sticky power-fault bit from previous power failures */
        pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
-       slot_status &= PCI_EXP_SLTSTA_PFD;
-       if (slot_status)
-               pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, slot_status);
+       if (slot_status & PCI_EXP_SLTSTA_PFD)
+               pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
+                                          PCI_EXP_SLTSTA_PFD);
        ctrl->power_fault_detected = 0;
 
        slot_cmd = POWER_ON;