Commit afd60c7d authored by Markus Lidel's avatar Markus Lidel Committed by Linus Torvalds

[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: default avatarMarkus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1e0fa7a2
...@@ -112,21 +112,20 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long ...@@ -112,21 +112,20 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long
timeout, struct i2o_dma *dma) timeout, struct i2o_dma *dma)
{ {
DECLARE_WAIT_QUEUE_HEAD(wq); DECLARE_WAIT_QUEUE_HEAD(wq);
DEFINE_WAIT(wait); struct i2o_exec_wait *wait;
struct i2o_exec_wait *iwait;
static u32 tcntxt = 0x80000000; static u32 tcntxt = 0x80000000;
struct i2o_message *msg = c->in_queue.virt + m; struct i2o_message *msg = c->in_queue.virt + m;
int rc = 0; int rc = 0;
iwait = i2o_exec_wait_alloc(); wait = i2o_exec_wait_alloc();
if (!iwait) if (!wait)
return -ENOMEM; return -ENOMEM;
if (tcntxt == 0xffffffff) if (tcntxt == 0xffffffff)
tcntxt = 0x80000000; tcntxt = 0x80000000;
if (dma) if (dma)
iwait->dma = *dma; wait->dma = *dma;
/* /*
* Fill in the message initiator context and transaction context. * 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 ...@@ -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. * so we could find a POST WAIT reply easier in the reply handler.
*/ */
writel(i2o_exec_driver.context, &msg->u.s.icntxt); writel(i2o_exec_driver.context, &msg->u.s.icntxt);
iwait->tcntxt = tcntxt++; wait->tcntxt = tcntxt++;
writel(iwait->tcntxt, &msg->u.s.tcntxt); writel(wait->tcntxt, &msg->u.s.tcntxt);
/* /*
* Post the message to the controller. At some point later it will * 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 ...@@ -143,31 +142,27 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, u32 m, unsigned long
*/ */
i2o_msg_post(c, m); i2o_msg_post(c, m);
if (!iwait->complete) { if (!wait->complete) {
iwait->wq = &wq; wait->wq = &wq;
/* /*
* we add elements add the head, because if a entry in the list * 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 * will never be removed, we have to iterate over it every time
*/ */
list_add(&iwait->list, &i2o_exec_wait_list); list_add(&wait->list, &i2o_exec_wait_list);
prepare_to_wait(&wq, &wait, TASK_INTERRUPTIBLE);
if (!iwait->complete) wait_event_interruptible_timeout(wq, wait->complete,
msleep_interruptible(timeout * 1000); timeout * HZ);
finish_wait(&wq, &wait); wait->wq = NULL;
iwait->wq = NULL;
} }
barrier(); barrier();
if (iwait->complete) { if (wait->complete) {
if (readl(&iwait->msg->body[0]) >> 24) if (readl(&wait->msg->body[0]) >> 24)
rc = readl(&iwait->msg->body[0]) & 0xff; rc = readl(&wait->msg->body[0]) & 0xff;
i2o_flush_reply(c, iwait->m); i2o_flush_reply(c, wait->m);
i2o_exec_wait_free(iwait); i2o_exec_wait_free(wait);
} else { } else {
/* /*
* We cannot remove it now. This is important. When it does * We cannot remove it now. This is important. When it does
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment