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

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Mon Oct 15 15:08:13 EDT 2012


On Mon, Oct 15, 2012 at 11:32:53AM -0700, David Woodhouse wrote:

> Yes, HZ/1500+1 I could understand. That's the number of jiffies that
> give you '666µs or more'. The +2 is odd though.

Looking more closely I agree, it seems bogus - the use of time_after
takes care of the short first jiffy problem, the real problem I see is
that 1500 was supposed to be µs, that is close to the datasheet spec
for the flash I have. Fixing that will almost double the timeout on my
systems...

> > > I'd like someone with infinite amounts of free time to go through and
> > > clean them all up :)
> > 
> > lol! Would you accept msecs_to_jiffies conversion for the cfi files?
> 
> Absolutely. Although I'd like to take a little step back and take a more
> thoughtful view of how we *should* be handing these timeouts, rather
> than a simple janitor-style conversion of the existing code.

Okay, well, I'll send a patch in a few days, if there is a better way
than:

 unsigned long uWriteTimeout = usecs_to_jiffies(1500);
 timeo = jiffies + uWriteTimeout;
 if (time_after(jiffies, timeo)) // TIMEOUT

Maybe someone will pipe up?

Jason



More information about the linux-mtd mailing list