aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2008-06-19 23:04:33 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-06-25 18:54:30 -0400
commit820943b6fc4781621dee52ba026106758a727dd3 (patch)
tree7431080b202ecad216358bb24a89b7834bbdbc62 /drivers/pci/hotplug
parentb30dd56d1c3786fb0c4e442a58d9a2ea78eeabb9 (diff)
pciehp: cleanup pcie_poll_cmd
Cleanup pcie_poll_cmd(): check the slot status once before entering our completion test loop and convert the loop to a simpler while() block. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index c030c94a4acb..36ea9499e385 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -252,20 +252,23 @@ static inline int pcie_poll_cmd(struct controller *ctrl)
252 u16 slot_status; 252 u16 slot_status;
253 int timeout = 1000; 253 int timeout = 1000;
254 254
255 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) 255 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
256 if (slot_status & CMD_COMPLETED) 256 if (slot_status & CMD_COMPLETED) {
257 goto completed; 257 pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
258 for (timeout = 1000; timeout > 0; timeout -= 100) { 258 return 1;
259 }
260 }
261 while (timeout > 1000) {
259 msleep(100); 262 msleep(100);
260 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) 263 timeout -= 100;
261 if (slot_status & CMD_COMPLETED) 264 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
262 goto completed; 265 if (slot_status & CMD_COMPLETED) {
266 pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
267 return 1;
268 }
269 }
263 } 270 }
264 return 0; /* timeout */ 271 return 0; /* timeout */
265
266completed:
267 pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED);
268 return timeout;
269} 272}
270 273
271static inline void pcie_wait_cmd(struct controller *ctrl, int poll) 274static inline void pcie_wait_cmd(struct controller *ctrl, int poll)