<meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">Finally got a chance to revise this. There are a lot of small, tedious changes to all the programmer .c files and some interesting changes to flashrom.c. Otherwise it's a pretty simple patch.</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">To recap from earlier discussion, this version does the following:</div><div class="gmail_quote">- Registers a shutdown callback during initialization for each programmer. See notes below.</div>

<div class="gmail_quote">- Kills the .shutdown function pointer from programmer_entry struct</div><div class="gmail_quote">- Updates all programmer shutdown functions to return an int and take a void *data arg. Also, make them static.</div>

<div class="gmail_quote">- programmer_shutdown() checks the return code of all shutdown callbacks.</div><div class="gmail_quote"><br></div><div class="gmail_quote">A few minor questions:</div><div class="gmail_quote"><meta http-equiv="content-type" content="text/html; charset=utf-8">- If programmer_init() fails when called in cli_classic(), should we call programmer_shutdown()? As Carl-Daniel noted earlier, this could potentially be used to do stuff like release_io_perms(), or perhaps free resources allocated by an init routine that fails.</div>

<div class="gmail_quote"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">- nicintel_spi -- Looks like flash write enable/disable should be done using rpci?</div><div class="gmail_quote">

- drkaiser - shutdown function missing a physunmap?</div><div class="gmail_quote"><br></div><div class="gmail_quote">Additional notes:</div><div class="gmail_quote">- Most programmers have a simple init routines with no failure condition, so placement of register_shutdown() doesn't really matter.</div>

</div><div class="gmail_quote">- serialport_shutdown non-static since it's used by buspirate.</div><div class="gmail_quote"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div class="gmail_quote">
- There were cases where the programmer's init routine would do something less simple, like open a file or map physical memory, and the shutdown callback would undo it. In those cases, placement took a little more thought. Someone more familiar with those should double-check that this patch does the right thing for buspirate, serprog, and satamv.</div>

</div><div><br></div><div>I did a quick test using an NM10/ICH7 platform and callbacks were shown in verbose mode output as expected.</div><div>Signed-off-by: David Hendricks <<a href="mailto:dhendrix@google.com">dhendrix@google.com</a>></div>

<div><br></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>