Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40477 )
Change subject: ft2232_spi.c: Pack WREN and op in one ftdi_write_data() call ......................................................................
Patch Set 16:
(1 comment)
https://review.coreboot.org/c/flashrom/+/40477/16/ft2232_spi.c File ft2232_spi.c:
https://review.coreboot.org/c/flashrom/+/40477/16/ft2232_spi.c@497 PS16, Line 497: bufsize = max(writecnt + 19, 261 + 19);
What do you want to drop? Just the change from 260+9 to 261+19 or the whole max()-line?
I meant dropping the max(). Just `bufsize = writecnt + 9` (or `+ 19`) would have worked to. The optimization is only that with the max(), you probably get less realloc() calls. But the overhead of realloc() (so far my impres- sion) is insignificant in a program that does USB transfers (which have a much higher overhead). I don't know but assume that this max(), and the fewer realloc() calls, save us about 1us per flashrom run, in the best case. (If this were a compute intensive program, avoiding realloc() would make sense.)
And yes, starting with 4K and only increasing the buffer on demand would work well. But then again, realloc() really isn't that expensive.
PS. Looked at PS11 now, that would work too. But needs a check that we never exceed the buffer ofc.