diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2016-03-13 16:24:09 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2016-03-13 16:24:09 +0000 |
commit | 8b6690ccbd9cf5f81aa2dc1a2095e75af172f819 (patch) | |
tree | 11f6e63c95d08816d185fb578345525dde3ffd5c | |
parent | 0be072cbe4d05b1e69d1c02291f3a2a544beb2af (diff) | |
download | ast2050-flashrom-8b6690ccbd9cf5f81aa2dc1a2095e75af172f819.zip ast2050-flashrom-8b6690ccbd9cf5f81aa2dc1a2095e75af172f819.tar.gz |
Shutdown serial port in pony_spi
Implement serial port shutdown both for regular termination and error
conditions in pony_spi.
Corresponding to flashrom svn r1952.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r-- | pony_spi.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -103,6 +103,18 @@ static const struct bitbang_spi_master bitbang_spi_master_pony = { .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 @@ int pony_spi_init(void) free(arg); return 1; } + if (register_shutdown(pony_spi_shutdown, NULL) != 0) { + free(arg); + serialport_shutdown(NULL); + return 1; + } have_device++; } free(arg); |