From e1f30bbce7a603d518ecec9d7e6885719f396719 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Tue, 20 Dec 2022 12:33:13 +1100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/70264 Tested-by: build bot (Jenkins) Reviewed-by: Thomas Heijligen Reviewed-by: Anastasia Klimchuk --- include/chipdrivers.h | 1 + include/programmer.h | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/chipdrivers.h b/include/chipdrivers.h index 71b87954..c485aafa 100644 --- a/include/chipdrivers.h +++ b/include/chipdrivers.h @@ -26,6 +26,7 @@ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int spi_chip_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len); +bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode); /* spi25.c */ int probe_spi_rdid(struct flashctx *flash); diff --git a/include/programmer.h b/include/programmer.h index f6bc8ce6..d8d8b4a2 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -312,7 +312,7 @@ struct spi_master { int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int (*shutdown)(void *data); - bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode); + bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode); /* NULL func implies true. */ void (*delay) (const struct flashctx *flash, unsigned int usecs); void (*get_region)(const struct flashctx *flash, unsigned int addr, struct flash_region *region); void *data; @@ -321,7 +321,6 @@ struct spi_master { int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int default_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); -bool default_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode); int register_spi_master(const struct spi_master *mst, void *data); /* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */ -- cgit v1.2.3