summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-08-31 00:09:21 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-08-31 00:09:21 +0000
commita905fb28d5c5d7af4d1e18190edad9171c0a34ed (patch)
tree1ce5908e88a7d94970f7f9fdd6a935db044599c5
parent32c9b394d25a9254c06f8924684c53e119e2b809 (diff)
downloadflashrom-a905fb28d5c5d7af4d1e18190edad9171c0a34ed.zip
flashrom-a905fb28d5c5d7af4d1e18190edad9171c0a34ed.tar.gz
Introduce generic shutdown_free() and remove redundant internal_shutdown()
The former will be useful in cases where cleanup equals a simple call to free(). Corresponding to flashrom svn r1848. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r--flash.h1
-rw-r--r--flashrom.c6
-rw-r--r--internal.c7
3 files changed, 7 insertions, 7 deletions
diff --git a/flash.h b/flash.h
index a5d3a55..03b26e7 100644
--- a/flash.h
+++ b/flash.h
@@ -54,6 +54,7 @@ typedef uint32_t chipsize_t; /* Able to store the number of bytes of any support
#define PRIuCHIPSIZE PRIu32
int register_shutdown(int (*function) (void *data), void *data);
+int shutdown_free(void *data);
void *programmer_map_flash_region(const char *descr, uintptr_t phys_addr, size_t len);
void programmer_unmap_flash_region(void *virt_addr, size_t len);
void programmer_delay(unsigned int usecs);
diff --git a/flashrom.c b/flashrom.c
index 01c1d03..9b82d4c 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -373,6 +373,12 @@ static bool all_skipped = true;
static int check_block_eraser(const struct flashctx *flash, int k, int log);
+int shutdown_free(void *data)
+{
+ free(data);
+ return 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.
diff --git a/internal.c b/internal.c
index 54b2aa3..e646ca8 100644
--- a/internal.c
+++ b/internal.c
@@ -158,11 +158,6 @@ static const struct par_master par_master_internal = {
enum chipbustype internal_buses_supported = BUS_NONE;
-static int internal_shutdown(void *data)
-{
- return 0;
-}
-
int internal_init(void)
{
#if __FLASHROM_LITTLE_ENDIAN__
@@ -237,8 +232,6 @@ int internal_init(void)
if (rget_io_perms())
return 1;
- if (register_shutdown(internal_shutdown, NULL))
- return 1;
/* Default to Parallel/LPC/FWH flash devices. If a known host controller
* is found, the host controller init routine sets the
OpenPOWER on IntegriCloud