[flashrom] [commit] r1952 - trunk

repository service svn at flashrom.org
Sun Mar 13 17:24:10 CET 2016


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 <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>

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);




More information about the flashrom mailing list