Author: hailfinger
Date: Sun Mar 13 17:24:09 2016
New Revision: 1952
URL: http://flashrom.org/trac/flashrom/changeset/1952

Log:
Implement serial port shutdown both for regular termination and error
condition in pony_spi.

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

Modified:
   trunk/pony_spi.c

Modified: trunk/pony_spi.c
==============================================================================
--- trunk/pony_spi.c    Sun Mar 13 16:16:30 2016        (r1951)
+++ trunk/pony_spi.c    Sun Mar 13 17:24:09 2016        (r1952)
@@ -103,6 +103,18 @@
        .half_period = 0,
 };
 
+static int pony_spi_shutdown(void *data)
+{
+       /* Shut down serial port communication */
+       int ret = serialport_shutdown(NULL);
+       if (ret)
+               msg_pdbg("Pony SPI shutdown failed.\n");
+       else
+               msg_pdbg("Pony SPI shutdown completed.\n");
+
+       return ret;
+}
+
 int pony_spi_init(void)
 {
        int i, data_out;
@@ -120,6 +132,11 @@
                        free(arg);
                        return 1;
                }
+               if (register_shutdown(pony_spi_shutdown, NULL) != 0) {
+                       free(arg);
+                       serialport_shutdown(NULL);
+                       return 1;
+               }
                have_device++;
        }
        free(arg);

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

Reply via email to