mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
spi: Make 'default_spi_send_multicommand' the default unless defined
A NULL func pointer is necessary and sufficient for the condition `NULL func pointer => default_spi_send_multicommand' as to not need this explicit specification of 'default'. Therefore drop the explicit need to specify the 'default_spi_send_multicommand' callback function pointer in the spi_master struct. This is a reasonable default for every other driver in the tree with only a few exceptions. This simplifies the code and driver development. Change-Id: I6cc24bf982da3d5251d391eb397db43dd10280e8 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67481 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
This commit is contained in:

committed by
Thomas Heijligen

parent
263d50c7d1
commit
119d0e5236
9
spi.c
9
spi.c
@ -37,7 +37,9 @@ int spi_send_command(const struct flashctx *flash, unsigned int writecnt,
|
||||
|
||||
int spi_send_multicommand(const struct flashctx *flash, struct spi_command *cmds)
|
||||
{
|
||||
return flash->mst->spi.multicommand(flash, cmds);
|
||||
if (flash->mst->spi.multicommand)
|
||||
return flash->mst->spi.multicommand(flash, cmds);
|
||||
return default_spi_send_multicommand(flash, cmds);
|
||||
}
|
||||
|
||||
int default_spi_send_command(const struct flashctx *flash, unsigned int writecnt,
|
||||
@ -153,10 +155,9 @@ int register_spi_master(const struct spi_master *mst, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!mst->write_256 || !mst->read ||
|
||||
!mst->multicommand || !mst->probe_opcode ||
|
||||
if (!mst->write_256 || !mst->read || !mst->probe_opcode ||
|
||||
((mst->command == default_spi_send_command || !mst->command) &&
|
||||
(mst->multicommand == default_spi_send_multicommand))) {
|
||||
(mst->multicommand == default_spi_send_multicommand || !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