[PATCH 2/3] flash_eraseall: move constants out of for loop

Jamie Lokier jamie at shareable.org
Tue Jun 22 20:23:35 EDT 2010


Mike Frysinger wrote:
> NAK: no explanation why you're doing this, and current code has the
> variables scoped to where they actually get used.
> 
> i wonder though why this code even bothers with "static".

The array is static to avoid compiling to code which fills in the
array at runtime.  I.e. it makes the code smaller, to the same size as
if they were globals.  And then, only because its static, the const
can put them in the .rodata section, reducing unshared data size.

Because they're static there's no benefit to moving them to another
scope.

-- Jamie



More information about the linux-mtd mailing list