Attention is currently required from: Edward O'Callaghan, Alexander Goncharov.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/72408 )
Change subject: dummyflasher: use new API to register shutdown function ......................................................................
Patch Set 2:
(3 comments)
File dummyflasher.c:
https://review.coreboot.org/c/flashrom/+/72408/comment/7529d834_1e795536 PS2, Line 79: uint8_t refs_cnt; Can you add a comment on this: to explain that dummyflasher can register multiple masters and they all share the same emu_data, so keeping track of reference count is needed to do clean up at shutdown time.
https://review.coreboot.org/c/flashrom/+/72408/comment/71262ae6_032575af PS2, Line 910:
the last owner of the data must release this data
yeah that's a good argument, let's keep it. I mark resolved
https://review.coreboot.org/c/flashrom/+/72408/comment/ed9a83ea_04ffbf74 PS2, Line 1416: data->refs_cnt += ((dummy_buses_supported & BUS_PROG) != BUS_NONE); : data->refs_cnt += ((dummy_buses_supported & BUS_NONSPI) != BUS_NONE); : data->refs_cnt += ((dummy_buses_supported & BUS_SPI) != BUS_NONE); : : #if 0 : data->refs_cnt += (dummy_buses_supported & BUS_PROG) ? 1 : 0; : data->refs_cnt += (dummy_buses_supported & BUS_NONSPI) ? 1 : 0; : data->refs_cnt += (dummy_buses_supported & BUS_SPI) ? 1 : 0; : #endif
Which one is more appropriate?
I have another idea! :) What if you add `refs_cnt++` into every if below. There are the same three if conditions below, already here.