* mtdchar, parallel erase with ioctl
@ 2011-08-02 9:30 srimugunthan dhandapani
2011-08-15 15:24 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: srimugunthan dhandapani @ 2011-08-02 9:30 UTC (permalink / raw)
To: linux-mtd
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mtdchar, parallel erase with ioctl
2011-08-02 9:30 mtdchar, parallel erase with ioctl srimugunthan dhandapani
@ 2011-08-15 15:24 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2011-08-15 15:24 UTC (permalink / raw)
To: srimugunthan dhandapani; +Cc: linux-mtd
On Tue, 2011-08-02 at 15:00 +0530, srimugunthan dhandapani wrote:
> 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?
No, mtd_mutex is needed e.g., because it makes sure that no-one removes
the MTD device meanwhile. I do not see why exactly mtd_mutex prevents
parallel erase.
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-15 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 9:30 mtdchar, parallel erase with ioctl srimugunthan dhandapani
2011-08-15 15:24 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox