Anastasia Klimchuk has uploaded this change for review.

View Change

opaque_master: Use new API to register shutdown function

TEST ME ON DEVICE

This allows opaque masters to register shutdown function in
opaque_master struct, which means there is no need to call
register_shutdown in init function, since this call is now a part
of register_opaque_master.

BUG=b:185191942
TEST=builds and ninja test

Change-Id: Id8471a117556edcbf9694752fabe05cf4501ce70
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
---
M linux_mtd.c
M nicintel_eeprom.c
2 files changed, 5 insertions(+), 15 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/25/56825/1
diff --git a/linux_mtd.c b/linux_mtd.c
index 42d569d..04eccde 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -314,6 +314,7 @@
.read = linux_mtd_read,
.write = linux_mtd_write,
.erase = linux_mtd_erase,
+ .shutdown = linux_mtd_shutdown,
};

/* Returns 0 if setup is successful, non-zero to indicate error */
@@ -418,14 +419,7 @@
return 1;
}

- if (register_shutdown(linux_mtd_shutdown, (void *)data)) {
- free(data);
- return 1;
- }
-
- register_opaque_master(&linux_mtd_opaque_master, data);
-
- return 0;
+ return register_opaque_master(&linux_mtd_opaque_master, data);

linux_mtd_init_exit:
free(param);
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index fd90250..5887073 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -446,6 +446,7 @@
.read = nicintel_ee_read,
.write = nicintel_ee_write_82580,
.erase = nicintel_ee_erase_82580,
+ .shutdown = nicintel_ee_shutdown_82580,
};

static const struct opaque_master opaque_master_nicintel_ee_i210 = {
@@ -453,6 +454,7 @@
.read = nicintel_ee_read,
.write = nicintel_ee_write_i210,
.erase = nicintel_ee_erase_i210,
+ .shutdown = nicintel_ee_shutdown_i210,
};

static int nicintel_ee_init(void)
@@ -493,19 +495,13 @@
*eecp = eec;
}

- if (register_shutdown(nicintel_ee_shutdown_82580, eecp))
- return 1;
-
- return register_opaque_master(&opaque_master_nicintel_ee_82580, NULL);
+ return register_opaque_master(&opaque_master_nicintel_ee_82580, eecp);
} else {
nicintel_eebar = rphysmap("Intel i210 NIC w/ emulated EEPROM",
io_base_addr + 0x12000, MEMMAP_SIZE);
if (!nicintel_eebar)
return 1;

- if (register_shutdown(nicintel_ee_shutdown_i210, NULL))
- return 1;
-
return register_opaque_master(&opaque_master_nicintel_ee_i210, NULL);
}


To view, visit change 56825. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id8471a117556edcbf9694752fabe05cf4501ce70
Gerrit-Change-Number: 56825
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: newchange