Hi Charles,
Sorry to mail you about bugs in nandemul2k again. As
to the email yesterday, erase will crash your nandemul2k. I found the reasons:
In your nand_erase() functions, you should add:
instr->state = MTD_ERASE_DONE; //change state
to ERASE_DONE
instr->callback(instr); // this callback will
wake up process waiting erased!
before “return
Without calling the callback, process will die after
added to wait_queue in mtdchar.c here:
case MEMERASE:
{
...
ret = mtd->erase(mtd, erase);
if (!ret)
{
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&waitq, &wait);
if (erase->state !=
MTD_ERASE_DONE && erase->state != MTD_ERASE_FAILED)
schedule();
remove_wait_queue(&waitq, &wait);
set_current_state(TASK_RUNNING);
ret = (erase->state
== MTD_ERASE_FAILED) ? - EIO: 0;
}
kfree(erase);
}
break;
}
Callback in mtdchar.c will wake up it:
static void mtdchar_erase_callback (struct erase_info
*instr)
{
wake_up((wait_queue_head_t *)instr->priv);
}
Per my test, the bug was fixed by changing like that.
Thanks and best regards
Baohua Song