mtdchar, parallel erase with ioctl

srimugunthan dhandapani srimugunthan.dhandapani at gmail.com
Tue Aug 2 05:30:43 EDT 2011


Hi all,
The mtdchar layer when it does erase using ioctl, it takes  a lock
mtd_mutex.So the erases can only be done sequentially one after
another. The hardware that i am working on has multiple banks and
supports parallel erase operations. I have modified mtd_unlocked_ioctl
function in mtdchar.c, to not take lock for erase commands(as shown
below). With that i am able to do parallel erases. Is this patch an
acceptable solution or what is the correct way to do this?

static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{
       int ret;

       /* allow parallel-erase by not taking the lock */
#if 1
       if(cmd == MEMERASE || cmd == MEMERASE64){

               ret = mtd_ioctl(file, cmd, arg);
       }
       else
#endif
       {
               mutex_lock(&mtd_mutex);
               ret = mtd_ioctl(file, cmd, arg);
               mutex_unlock(&mtd_mutex);
       }
       return ret;
}

thanks,
mugunthan



More information about the linux-mtd mailing list