[PATCH] [MTD] Adjust the NOR CFI flash timeouts to round better

David Woodhouse dwmw2 at infradead.org
Mon Oct 15 12:09:40 EDT 2012


On Mon, 2012-10-15 at 16:42 +0300, Artem Bityutskiy wrote:
> On Fri, 2012-10-05 at 12:32 -0600, Jason Gunthorpe wrote:
> > -	/* see comments in do_write_oneword() regarding uWriteTimeo. */
> > -	unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
> > +	/* see comments in do_write_oneword() regarding uWriteTimeo.
> > +	   Note: write_buffer commands take longer so we use a higher
> > +	   time. The AMD 29LV256M for instance has a datasheet max
> > +	   of 1.2ms for page and 600us for byte */
> > +	unsigned long uWriteTimeout = (HZ / 1500) + 2;
> 
> What does HZ / 1500 mean? HZ is amount of timer interrupts per second,
> which may be 1/100, or 1/1000, or 1/300, depending on the system.

If HZ is the amount of timer interrupts per second, then HZ/1500 is the
amount of timer interrupts in 1/1500 of a second, aka 666.7µs.¹

So it's not *entirely* bogus, but it should certainly be cleaned up to
use the msecs_to_jiffies() helpers... or preferably not use jiffies at
all, perhaps.

-- 
dwmw2

¹ That's 'µs', not 'us', for next time the patch is submitted. Welcome
  to the 21st century.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6171 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20121015/6b4cf5ec/attachment.bin>


More information about the linux-mtd mailing list