diff options
author | Edward O'Callaghan <quasisec@google.com> | 2022-09-09 23:01:05 +1000 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2022-12-21 04:44:47 +0000 |
commit | 972c1550b4d67abdfe187100905f95030e18a796 (patch) | |
tree | b1ac9658d47757a48275e6251f48008012c77873 /spi.c | |
parent | 8b0250b32b89a54df16989369c0cb8330d86cb77 (diff) | |
download | flashrom-972c1550b4d67abdfe187100905f95030e18a796.tar.gz flashrom-972c1550b4d67abdfe187100905f95030e18a796.tar.bz2 flashrom-972c1550b4d67abdfe187100905f95030e18a796.zip |
spi: Make 'default_spi_write_aai' the default unless defined
A NULL func pointer is necessary and sufficient for the
condition `NULL func pointer => default_spi_write_aai' as to not
need this explicit specification of 'default'.
Therefore Drop the explicit need to specify the 'default_spi_write_aai'
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: I7f14aaea0edcf0c08cea0e9cd27d58152707fb2a
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67479
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'spi.c')
-rw-r--r-- | spi.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -131,7 +131,9 @@ int spi_chip_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len) { - return flash->mst->spi.write_aai(flash, buf, start, len); + if (flash->mst->spi.write_aai) + return flash->mst->spi.write_aai(flash, buf, start, len); + return default_spi_write_aai(flash, buf, start, len); } bool default_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode) @@ -150,7 +152,7 @@ int register_spi_master(const struct spi_master *mst, void *data) } } - if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command || + if (!mst->write_256 || !mst->read || !mst->command || !mst->multicommand || !mst->probe_opcode || ((mst->command == default_spi_send_command) && (mst->multicommand == default_spi_send_multicommand))) { |