Am Montag, den 12.07.2010, 03:23 +0200 schrieb Carl-Daniel Hailfinger:
Thanks! Your suggestions indeed make sense, and the code is now a lot simpler. New version follows. I'm not sure if I should move start+=len into the counting expression of the for loop. Comments welcome.
My personal preference: Keep it outside. I expect the counting expression to only affect the variable(s) initialized in the init expression and/or tested in the loop condition. Logically, the increase of the start address seems (to me) more as part of the "do_something" than as part of the loop.
+static int walk_eraseregions(struct flashchip *flash, int erasefunction, int (*do_something) (struct flashchip *flash, unsigned int addr, unsigned int len))
This is an overly long line, please wrap it.
My Ack still stands.
Regards, Michael Karcher