diff options
| author | Markus Lidel <markus.lidel@shadowconnect.com> | 2004-11-15 04:12:25 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-15 04:12:25 -0800 |
| commit | afd60c7d72175a4d5432cd30203d5d82a0dc92ca (patch) | |
| tree | 4ca11c458785f414996ba8f35490d510328fc619 | |
| parent | 1e0fa7a2dbdf88eb0bdf95ee17bf7cc3d8663da1 (diff) | |
[PATCH] i2o: changed old queueing code with wait_event API
- removed old queueing code and replaced it with new wait_event API
Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | drivers/message/i2o/exec-osm.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 34aece2864d2..120b3a813221 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c @@ -112,21 +112,20 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long timeout, struct i2o_dma *dma) { DECLARE_WAIT_QUEUE_HEAD(wq); - DEFINE_WAIT(wait); - struct i2o_exec_wait *iwait; + struct i2o_exec_wait *wait; static u32 tcntxt = 0x80000000; struct i2o_message *msg = c->in_queue.virt + m; int rc = 0; - iwait = i2o_exec_wait_alloc(); - if (!iwait) + wait = i2o_exec_wait_alloc(); + if (!wait) return -ENOMEM; if (tcntxt == 0xffffffff) tcntxt = 0x80000000; if (dma) - iwait->dma = *dma; + wait->dma = *dma; /* * Fill in the message initiator context and transaction context. @@ -134,8 +133,8 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long * so we could find a POST WAIT reply easier in the reply handler. */ writel(i2o_exec_driver.context, &msg->u.s.icntxt); - iwait->tcntxt = tcntxt++; - writel(iwait->tcntxt, &msg->u.s.tcntxt); + wait->tcntxt = tcntxt++; + writel(wait->tcntxt, &msg->u.s.tcntxt); /* * Post the message to the controller. At some point later it will @@ -143,31 +142,27 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long */ i2o_msg_post(c, m); - if (!iwait->complete) { - iwait->wq = &wq; + if (!wait->complete) { + wait->wq = &wq; /* * we add elements add the head, because if a entry in the list * will never be removed, we have to iterate over it every time */ - list_add(&iwait->list, &i2o_exec_wait_list); - - prepare_to_wait(&wq, &wait, TASK_INTERRUPTIBLE); - - if (!iwait->complete) - msleep_interruptible(timeout * 1000); + list_add(&wait->list, &i2o_exec_wait_list); - finish_wait(&wq, &wait); + wait_event_interruptible_timeout(wq, wait->complete, + timeout * HZ); - iwait->wq = NULL; + wait->wq = NULL; } barrier(); - if (iwait->complete) { - if (readl(&iwait->msg->body[0]) >> 24) - rc = readl(&iwait->msg->body[0]) & 0xff; - i2o_flush_reply(c, iwait->m); - i2o_exec_wait_free(iwait); + if (wait->complete) { + if (readl(&wait->msg->body[0]) >> 24) + rc = readl(&wait->msg->body[0]) & 0xff; + i2o_flush_reply(c, wait->m); + i2o_exec_wait_free(wait); } else { /* * We cannot remove it now. This is important. When it does |
