Patch MTD: increase time out value for buffer program
Artem Bityutskiy
dedekind1 at gmail.com
Tue Jun 26 11:58:54 EDT 2012
On Wed, 2012-06-13 at 04:29 +0000, Changming Chen (changmingche) wrote:
> The time out value(1ms:typical HZ defined smaller than 1000) defined for function "do_write_buffer" in "cfi_cmdset_0002.c" is not enough. Because the enlargement of buffer size, much time will cost for buffer program. It's has risk that time out will be triggered before buffer program finished and make misjudge for buffer program. we suggest that 4ms is more appropriate compare to 1ms. This change has no impact of program performance.
>
> diff --git a/a/drivers/mtd/chips/cfi_cmdset_0002.c b/b/drivers/mtd/chips/cfi_cmd
> index 9d93c45..7da8fca 100755
> --- a/a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -1312,7 +1312,7 @@ static int __xipram do_write_buffer(struct map_info *map,
> struct cfi_private *cfi = map->fldrv_priv;
> unsigned long timeo = jiffies + HZ;
> /* see comments in do_write_oneword() regarding uWriteTimeo. */
> - unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
> + unsigned long uWriteTimeout = ( HZ / 1000 ) + 4;
No, sorry, this is not a fix, this is a band-aid. The whole HZ/1000
thing is broken. You should not use HZ at all. For this driver it looks
like you should use ' schedule_timeout()' with the right timout instead
of 'schedule()' and get rid of all the HZ and jiffies stuff.
--
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/20120626/59c55a40/attachment.sig>
More information about the linux-mtd
mailing list