diff --git a/cli_classic.c b/cli_classic.c index d0712926f..81299210d 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -373,7 +373,7 @@ static int do_read(struct flashctx *const flash, const char *const filename) if (ret > 0) goto free_out; - if (write_buf_to_include_args(flash, buf)) { + if (write_buf_to_include_args(get_layout(flash), buf)) { ret = 1; goto free_out; } diff --git a/flashrom.c b/flashrom.c index 35fdc7da7..5a6f4e661 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1021,14 +1021,12 @@ out: * then this will write files using data from the corresponding region in the * supplied buffer. * - * @param flashctx Flash context to be used. + * @param layout The layout to be used. * @param buf Chip-sized buffer to read data from * @return 0 on success */ -int write_buf_to_include_args(const struct flashctx *const flash, - unsigned char *buf) +int write_buf_to_include_args(const struct flashrom_layout *const layout, unsigned char *buf) { - const struct flashrom_layout *const layout = get_layout(flash); const struct romentry *entry = NULL; while ((entry = layout_next_included(layout, entry))) { diff --git a/include/flash.h b/include/flash.h index 3fedb2b67..d5001c1d5 100644 --- a/include/flash.h +++ b/include/flash.h @@ -425,7 +425,7 @@ int selfcheck(void); int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename); int read_buf_from_include_args(const struct flashrom_layout *const layout, unsigned char *buf); int write_buf_to_file(const unsigned char *buf, unsigned long size, const char *filename); -int write_buf_to_include_args(const struct flashctx *const flash, unsigned char *buf); +int write_buf_to_include_args(const struct flashrom_layout *const layout, unsigned char *buf); int prepare_flash_access(struct flashctx *, bool read_it, bool write_it, bool erase_it, bool verify_it); void finalize_flash_access(struct flashctx *); int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status);