summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-08-03 14:39:51 +1000
committerNico Huber <nico.h@gmx.de>2021-08-17 16:31:10 +0000
commitb261bec1eea70aa67966b7f3ed36d4ae61cc31e0 (patch)
tree7b349727aa297e56b07998794ec285bfa2ade5c0
parentc845e64b4f20b024e17827fe79853e799f76d858 (diff)
downloadflashrom-b261bec1eea70aa67966b7f3ed36d4ae61cc31e0.tar.gz
flashrom-b261bec1eea70aa67966b7f3ed36d4ae61cc31e0.tar.bz2
flashrom-b261bec1eea70aa67966b7f3ed36d4ae61cc31e0.zip
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 <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56824 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r--linux_mtd.c22
-rw-r--r--nicintel_eeprom.c28
2 files changed, 25 insertions, 25 deletions
diff --git a/linux_mtd.c b/linux_mtd.c
index 7780feb49..42d569d16 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;
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index ec0f04ef6..fd9025058 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -395,20 +395,6 @@ static int nicintel_ee_erase_82580(struct flashctx *flash, unsigned int addr, un
return nicintel_ee_write_82580(flash, NULL, addr, len);
}
-static const struct opaque_master opaque_master_nicintel_ee_82580 = {
- .probe = nicintel_ee_probe_82580,
- .read = nicintel_ee_read,
- .write = nicintel_ee_write_82580,
- .erase = nicintel_ee_erase_82580,
-};
-
-static const struct opaque_master opaque_master_nicintel_ee_i210 = {
- .probe = nicintel_ee_probe_i210,
- .read = nicintel_ee_read,
- .write = nicintel_ee_write_i210,
- .erase = nicintel_ee_erase_i210,
-};
-
static int nicintel_ee_shutdown_i210(void *arg)
{
if (!done_i20_write)
@@ -455,6 +441,20 @@ out:
return ret;
}
+static const struct opaque_master opaque_master_nicintel_ee_82580 = {
+ .probe = nicintel_ee_probe_82580,
+ .read = nicintel_ee_read,
+ .write = nicintel_ee_write_82580,
+ .erase = nicintel_ee_erase_82580,
+};
+
+static const struct opaque_master opaque_master_nicintel_ee_i210 = {
+ .probe = nicintel_ee_probe_i210,
+ .read = nicintel_ee_read,
+ .write = nicintel_ee_write_i210,
+ .erase = nicintel_ee_erase_i210,
+};
+
static int nicintel_ee_init(void)
{
if (rget_io_perms())