From 3d303fd7d7c672976834b084c22cb52a99afb4d7 Mon Sep 17 00:00:00 2001 From: hailfinger Date: Wed, 12 Aug 2009 13:32:56 +0000 Subject: Use a common parameter variable for all programmers. This allows us to reduce #ifdef clauses a lot if we compile out some programmers completely. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Stefan Reinauer git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@679 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- ft2232_spi.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'ft2232_spi.c') diff --git a/ft2232_spi.c b/ft2232_spi.c index 955bc56..db4db17 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -26,8 +26,6 @@ #include "flash.h" #include "spi.h" -char *ft2232spi_param = NULL; - #if FT2232_SPI_SUPPORT == 1 #include @@ -83,16 +81,16 @@ int ft2232_spi_init(void) return EXIT_FAILURE; } - if (ft2232spi_param && !strlen(ft2232spi_param)) { - free(ft2232spi_param); - ft2232spi_param = NULL; + if (programmer_param && !strlen(programmer_param)) { + free(programmer_param); + programmer_param = NULL; } - if (ft2232spi_param) { - if (strstr(ft2232spi_param, "2232")) + if (programmer_param) { + if (strstr(programmer_param, "2232")) ft2232_type = FTDI_FT2232H; - if (strstr(ft2232spi_param, "4232")) + if (strstr(programmer_param, "4232")) ft2232_type = FTDI_FT4232H; - portpos = strstr(ft2232spi_param, "port="); + portpos = strstr(programmer_param, "port="); if (portpos) { portpos += 5; switch (toupper(*portpos)) { @@ -107,7 +105,7 @@ int ft2232_spi_init(void) "using default.\n"); } } - free(ft2232spi_param); + free(programmer_param); } printf_debug("Using device type %s ", (ft2232_type == FTDI_FT2232H) ? "2232H" : "4232H"); -- cgit v1.2.1