Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: flashrom.c

Issue 6897014: Do not call EC programmer shutdown functions explicitly. (Closed) Base URL: svn://coreboot.org/flashrom/trunk
Patch Set: Fix code as per Stefan's comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | internal.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: flashrom.c
diff --git a/flashrom.c b/flashrom.c
index a9fbbc1cb0e0dead111d25982d43269191f6e59c..c8adab92c73bcf395c96fb0825173302133ff0aa 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -124,6 +124,7 @@ const struct programmer_entry programmer_table[] = {
{
.name = "internal",
.init = internal_init,
+ /* called implicitly using shutdown callback */
.shutdown = internal_shutdown,
.map_flash_region = physmap,
.unmap_flash_region = physunmap,
@@ -484,6 +485,8 @@ struct shutdown_func_data {
*/
static int may_register_shutdown = 0;
+static int programmer_shutdown_done = 0;
+
/* Register a function to be executed on programmer shutdown.
* The advantage over atexit() is that you can supply a void pointer which will
* be used as parameter to the registered function upon programmer shutdown.
@@ -577,6 +580,14 @@ int chip_restore()
int programmer_shutdown(void)
{
+ if (programmer_shutdown_done) {
+ msg_gdbg("%s: shutdown has already been done\n", __func__);
+ return -1;
+ }
+
+ msg_gdbg("%s: carrying out %d shutdown callbacks\n",
+ __func__, shutdown_fn_count);
+
/* Registering shutdown functions is no longer allowed. */
may_register_shutdown = 0;
while (shutdown_fn_count > 0) {
« no previous file with comments | « no previous file | internal.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698