[flashrom] [PATCH] Shutdown serial port in pony_spi
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Sun Mar 13 17:13:40 CET 2016
Implement serial port shutdown both for regular termination and error
condition in pony_spi.
[Yes, the existing code is not exactly beautiful, but a rewrite shortly
before 0.9.9 is too risky.]
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Index: flashrom-pony_close_fd/pony_spi.c
===================================================================
--- flashrom-pony_close_fd/pony_spi.c (Revision 1946)
+++ flashrom-pony_close_fd/pony_spi.c (Arbeitskopie)
@@ -103,6 +103,20 @@
.half_period = 0,
};
+static int pony_spi_shutdown(void *data)
+{
+ int ret = 0;
+
+ /* Shut down serial port communication */
+ 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 +134,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