Patch MTD: increase time out value for buffer program

Artem Bityutskiy dedekind1 at gmail.com
Wed Jun 27 06:33:07 EDT 2012


On Wed, 2012-06-27 at 05:23 +0000, Youxin He (youxinhe) wrote:
> Hi Artem,
> How about just change HZ/1000 stuff to msecs_to_jiffies()? Schedule_timeout() is a good idea but I don't see it is necessary to use schedule_timeout() to replace schedule(). The code you add below is just for suspend case, normal case will not go to schedule(), but normal case you should check for timeout otherwise infinite loop in case a program failure occur.  
> 
> +	#define WRITE_TIEMEOUT 4
> .......
> -	unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
> +	unsigned long uWriteTimeout = msecs_to_jiffies(WRITE_TIEMEOUT);

I think that the current code simply buggy and needs to be re-wised.
E.g., what is this:


timeo = jiffies + (HZ / 2); /* FIXME */
mutex_lock(&chip->mutex);
...
if (time_after(jiffies, timeo) && !chip_ready(map, adr)){

What if we are not able to grab the mutex for longer than "HZ/2".

So I suggest you to try to come-up with the general clean-up of the
timeouts in this driver. AFAICS, but not sure because did not think hard
enough, schedule_tiemout() could be use in most places in this driver.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120627/866af8c5/attachment.sig>


More information about the linux-mtd mailing list