Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52958 )
Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern ......................................................................
Patch Set 2:
(1 comment)
File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/52958/comment/a426863c_94757414 PS2, Line 167: struct buspirate_spi_data *buspirate_data = data;
How about an […]
Thank you for this comment, because I started resolving it and so spent some more time staring at the code. And I noticed something! It looks to me that bp_commbuf does not have a global meaning, its value is rewritten for every send operation (and for shutdown as well). Specifically what I mean is for these functions: 1) buspirate_spi_shutdown 2) buspirate_spi_send_command_v1 3) buspirate_spi_send_command_v2 3) buspirate_spi_init I can probably create bp_commbuf as a local variable, alloc at the beginning and free at the end. bp_commbufsize is different, I can see why it needs to be in a spi data in flashctx.
buspirate_commbuf_grow and buspirate_sendrecv can take both as arguments.
What I am worried about is, maybe I am missing something? Why bp_commbuf was initally a global variable, was it just for convenience or for a reason? What do you think?