Replace the waitqueue with completion logic. Signed-off-by: Jörn Engel --- drivers/mtd/maps/vmu_flash.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) --- maple/drivers/mtd/maps/vmu_flash.c~cu9 2008-03-24 18:26:56.000000000 +0100 +++ maple/drivers/mtd/maps/vmu_flash.c 2008-03-24 18:36:12.000000000 +0100 @@ -19,8 +19,7 @@ #include #include -static DECLARE_WAIT_QUEUE_HEAD(vmu_read); -static int block_read; +static DECLARE_COMPLETION(read_complete); static DEFINE_MUTEX(dev_mutex); @@ -108,7 +107,6 @@ static void vmu_blockread(struct mapleq card = mdev->private_data; /* copy the read in data */ memcpy(card->blockread, mq->recvbuf + 12, card->blocklen); - block_read = 1; /* fill the cache for this block */ mtd = card->mtd; mpart = mtd->priv; @@ -124,7 +122,7 @@ static void vmu_blockread(struct mapleq pcache->jiffies_atc = jiffies; pcache->valid = 1; wakeup: - wake_up_interruptible(&vmu_read); + complete(&read_complete); } /* Interface with maple bus to read bytes */ @@ -150,7 +148,6 @@ static int maple_vmu_read_block(unsigned sendbuf[1] = cpu_to_be32(partition << 24 | num); mdev->mq->sendbuf = &sendbuf; - block_read = 0; card->blockread = kmalloc(card->blocklen, GFP_KERNEL); if (!card->blockread) { @@ -160,17 +157,11 @@ static int maple_vmu_read_block(unsigned maple_getcond_callback(mdev, vmu_blockread, 0, MAPLE_FUNC_MEMCARD); maple_add_packet(mdev->mq); - wait_event_interruptible_timeout(vmu_read, block_read, HZ * 4); - if (block_read == 0) { - printk(KERN_INFO "Maple: VMU read failed on block 0x%X\n", num); - error = -EIO; - goto fail_blockread; - } + wait_for_completion(&read_complete); memcpy(buf, card->blockread, card->blocklen); error = 0; -fail_blockread: kfree(card->blockread); fail_bralloc: mutex_unlock(&dev_mutex);