mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 22:21:16 +02:00
tree/: Drop default_spi_probe_opcode for NULL case
A NULL func pointer is necessary and sufficient for the condition `NULL func pointer => true' as to not need this boilerplate as it implies default behaviour of a supported opcode within the `check_block_eraser()` match supported loop. Ran; ``` $ find . -name '*.[c,h]' -exec sed -i '/.probe_opcode = default_spi_probe_opcode,/d' '{}' \; ``` Change-Id: Id502c5d2596ad1db52faf05723083620e4c52c12 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/70264 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:

committed by
Thomas Heijligen

parent
c66d2bd1ca
commit
e1f30bbce7
9
spi.c
9
spi.c
@ -139,9 +139,11 @@ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start
|
||||
return default_spi_write_aai(flash, buf, start, len);
|
||||
}
|
||||
|
||||
bool default_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
|
||||
bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
|
||||
{
|
||||
return true;
|
||||
if (!flash->mst->spi.probe_opcode)
|
||||
return true; /* no probe_opcode implies default of supported. */
|
||||
return flash->mst->spi.probe_opcode(flash, opcode);
|
||||
}
|
||||
|
||||
int register_spi_master(const struct spi_master *mst, void *data)
|
||||
@ -155,8 +157,7 @@ int register_spi_master(const struct spi_master *mst, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!mst->write_256 || !mst->read || !mst->probe_opcode ||
|
||||
(!mst->command && !mst->multicommand)) {
|
||||
if (!mst->write_256 || !mst->read || (!mst->command && !mst->multicommand)) {
|
||||
msg_perr("%s called with incomplete master definition. "
|
||||
"Please report a bug at flashrom@flashrom.org\n",
|
||||
__func__);
|
||||
|
Reference in New Issue
Block a user