From b261bec1eea70aa67966b7f3ed36d4ae61cc31e0 Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Tue, 3 Aug 2021 14:39:51 +1000 Subject: opaque_master: Move shutdown function above opaque_master struct This patch prepares opaque masters to use new API which allows to register shutdown function in opaque_master struct. See also later patch in this chain, where opaque masters are converted to new API. BUG=b:185191942 TEST=builds and ninja test Comparing flashrom binary before and after the patch, make clean && make CONFIG_EVERYTHING=yes VERSION=none binary is the same Change-Id: I5000cfceeba859a76177a17c1cb7d1c1e9fc03fe Signed-off-by: Anastasia Klimchuk Reviewed-on: https://review.coreboot.org/c/flashrom/+/56824 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- linux_mtd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'linux_mtd.c') diff --git a/linux_mtd.c b/linux_mtd.c index 7780feb4..42d569d1 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -295,6 +295,17 @@ static int linux_mtd_erase(struct flashctx *flash, return 0; } +static int linux_mtd_shutdown(void *data) +{ + struct linux_mtd_data *mtd_data = data; + if (mtd_data->dev_fp != NULL) { + fclose(mtd_data->dev_fp); + } + free(data); + + return 0; +} + static const struct opaque_master linux_mtd_opaque_master = { /* max_data_{read,write} don't have any effect for this programmer */ .max_data_read = MAX_DATA_UNSPECIFIED, @@ -356,17 +367,6 @@ linux_mtd_setup_exit: return ret; } -static int linux_mtd_shutdown(void *data) -{ - struct linux_mtd_data *mtd_data = data; - if (mtd_data->dev_fp != NULL) { - fclose(mtd_data->dev_fp); - } - free(data); - - return 0; -} - static int linux_mtd_init(void) { char *param; -- cgit v1.2.3