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
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);
list_add(&wait->list, &i2o_exec_wait_list);
if (!iwait->complete)
msleep_interruptible(timeout * 1000);
wait_event_interruptible_timeout(wq, wait->complete,
timeout * HZ);
finish_wait(&wq, &wait);
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
......
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