aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2008-05-28 01:59:44 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-06-10 13:59:53 -0400
commitd737bdc141f0f040171fffbb7f9e08a825b27aab (patch)
tree11b0777a92a0703a837982b5b726a90b5c6645f0 /drivers/pci/hotplug/pciehp_hpc.c
parent125c39f7d233de28f342d80858025ffed0c4b7f4 (diff)
pciehp: block signals while waiting for command completion
Since we need to wait for command completion for muximum 1sec, waiting command should not be interrupted by a signal. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 6339c638701e..7e3a3d17c334 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -268,9 +268,8 @@ completed:
268 return timeout; 268 return timeout;
269} 269}
270 270
271static inline int pcie_wait_cmd(struct controller *ctrl, int poll) 271static inline void pcie_wait_cmd(struct controller *ctrl, int poll)
272{ 272{
273 int retval = 0;
274 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; 273 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000;
275 unsigned long timeout = msecs_to_jiffies(msecs); 274 unsigned long timeout = msecs_to_jiffies(msecs);
276 int rc; 275 int rc;
@@ -278,16 +277,9 @@ static inline int pcie_wait_cmd(struct controller *ctrl, int poll)
278 if (poll) 277 if (poll)
279 rc = pcie_poll_cmd(ctrl); 278 rc = pcie_poll_cmd(ctrl);
280 else 279 else
281 rc = wait_event_interruptible_timeout(ctrl->queue, 280 rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout);
282 !ctrl->cmd_busy, timeout);
283 if (!rc) 281 if (!rc)
284 dbg("Command not completed in 1000 msec\n"); 282 dbg("Command not completed in 1000 msec\n");
285 else if (rc < 0) {
286 retval = -EINTR;
287 info("Command was interrupted by a signal\n");
288 }
289
290 return retval;
291} 283}
292 284
293/** 285/**
@@ -365,7 +357,7 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
365 if (!(slot_ctrl & HP_INTR_ENABLE) || 357 if (!(slot_ctrl & HP_INTR_ENABLE) ||
366 !(slot_ctrl & CMD_CMPL_INTR_ENABLE)) 358 !(slot_ctrl & CMD_CMPL_INTR_ENABLE))
367 poll = 1; 359 poll = 1;
368 retval = pcie_wait_cmd(ctrl, poll); 360 pcie_wait_cmd(ctrl, poll);
369 } 361 }
370 out: 362 out:
371 mutex_unlock(&ctrl->ctrl_lock); 363 mutex_unlock(&ctrl->ctrl_lock);
@@ -797,7 +789,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
797 if (intr_loc & CMD_COMPLETED) { 789 if (intr_loc & CMD_COMPLETED) {
798 ctrl->cmd_busy = 0; 790 ctrl->cmd_busy = 0;
799 smp_mb(); 791 smp_mb();
800 wake_up_interruptible(&ctrl->queue); 792 wake_up(&ctrl->queue);
801 } 793 }
802 794
803 if (!(intr_loc & ~CMD_COMPLETED)) 795 if (!(intr_loc & ~CMD_COMPLETED))