Author: stefanct
Date: Sun Aug 31 02:09:21 2014
New Revision: 1848
URL: http://flashrom.org/trac/flashrom/changeset/1848

Log:
Introduce generic shutdown_free() and remove redundant internal_shutdown().

The former will be useful in cases where cleanup equals a simple call to free().

Signed-off-by: Stefan Tauner <[email protected]>
Acked-by: Stefan Tauner <[email protected]>

Modified:
   trunk/flash.h
   trunk/flashrom.c
   trunk/internal.c

Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h       Sun Aug 31 01:39:51 2014        (r1847)
+++ trunk/flash.h       Sun Aug 31 02:09:21 2014        (r1848)
@@ -54,6 +54,7 @@
 #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);

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c    Sun Aug 31 01:39:51 2014        (r1847)
+++ trunk/flashrom.c    Sun Aug 31 02:09:21 2014        (r1848)
@@ -373,6 +373,12 @@
 
 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.

Modified: trunk/internal.c
==============================================================================
--- trunk/internal.c    Sun Aug 31 01:39:51 2014        (r1847)
+++ trunk/internal.c    Sun Aug 31 02:09:21 2014        (r1848)
@@ -158,11 +158,6 @@
 
 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 @@
 
        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

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to