Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons, Nikolai Artemiev, Sergii Dmytruk. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58479 )
Change subject: libflashrom,writeprotect: add support for reading/writing WP configs ......................................................................
Patch Set 9:
(7 comments)
File libflashrom.h:
https://review.coreboot.org/c/flashrom/+/58479/comment/8a6c2b8e_8dbbc368 PS9, Line 131: int flashrom_wp_read_chip_config(const struct flashrom_flashctx *flash, struct flashrom_wp_chip_config *cfg); : int flashrom_wp_write_chip_config(struct flashrom_flashctx *flash, const struct flashrom_wp_chip_config *cfg); : int flashrom_wp_compare_chip_configs(const struct flashrom_wp_chip_config *cfga, const struct flashrom_wp_chip_config *cfgb); You can omit parameter names if they are self-explanatory from parameter type, which all of these seems to be (see existing declarations in this header).
File writeprotect.c:
https://review.coreboot.org/c/flashrom/+/58479/comment/328d703b_795e062b PS9, Line 4: 2010 Does anyone know, should we add 2021 here? Does it even matter? The file is completely re-written.
https://review.coreboot.org/c/flashrom/+/58479/comment/f81f657d_7873ed6a PS9, Line 27: #define wp_chip_config flashrom_wp_chip_config : #define wp_range flashrom_wp_range : #define wp_mode flashrom_wp_mode Oh, so why this prefix was added from the very beginning? ;)
https://review.coreboot.org/c/flashrom/+/58479/comment/d3162d71_fbdc6f4c PS9, Line 39: if (spi_read_register(flash, bit.reg, value)) : return 1; Let's propagate return value, ret = spi_read_register if (ret) return ret
Maybe now it's always 1 on error, but who knows, may change in future.
https://review.coreboot.org/c/flashrom/+/58479/comment/35188478_988d0c0d PS9, Line 128: return ret; This should be on its own line (and same below).
https://review.coreboot.org/c/flashrom/+/58479/comment/0ea74958_2a7a3bdf PS9, Line 158: if (ord == 0) ord = cfga->srp[i] - cfgb->srp[i]; How does it work? If ord becomes non-0 in the first loop cycle, then the rest of (ord == 0) are skipped? is it the same as having `else return ord`?
https://review.coreboot.org/c/flashrom/+/58479/comment/8ae08f38_3df56450 PS9, Line 161: ord = cfga->cmp - cfgb->cmp; Please make it on its own line, and the same for other conditionals below (including ones inside for loops).