]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/pciehp_hpc.c
pciehp: change command polling frequency
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / pciehp_hpc.c
index c030c94a4acb82952bb34ad408521de523722959..5ef4baecac7973b07edfd04513e6f902b48c4e57 100644 (file)
@@ -252,20 +252,23 @@ static inline int pcie_poll_cmd(struct controller *ctrl)
        u16 slot_status;
        int timeout = 1000;
 
-       if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status))
-               if (slot_status & CMD_COMPLETED)
-                       goto completed;
-       for (timeout = 1000; timeout > 0; timeout -= 100) {
-               msleep(100);
-               if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status))
-                       if (slot_status & CMD_COMPLETED)
-                               goto completed;
+       if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
+               if (slot_status & CMD_COMPLETED) {
+                       pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
+                       return 1;
+               }
+       }
+       while (timeout > 1000) {
+               msleep(10);
+               timeout -= 10;
+               if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
+                       if (slot_status & CMD_COMPLETED) {
+                               pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
+                               return 1;
+                       }
+               }
        }
        return 0;       /* timeout */
-
-completed:
-       pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
-       return timeout;
 }
 
 static inline void pcie_wait_cmd(struct controller *ctrl, int poll)