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 --- dummyflasher.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'dummyflasher.c') diff --git a/dummyflasher.c b/dummyflasher.c index 4cd9658..903f88b 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -24,45 +24,43 @@ #include #include "flash.h" -char *dummytype = NULL; - int dummy_init(void) { int i; printf_debug("%s\n", __func__); /* "all" is equivalent to specifying no type. */ - if (dummytype && (!strcmp(dummytype, "all"))) { - free(dummytype); - dummytype = NULL; + if (programmer_param && (!strcmp(programmer_param, "all"))) { + free(programmer_param); + programmer_param = NULL; } - if (!dummytype) - dummytype = strdup("parallel,lpc,fwh,spi"); + if (!programmer_param) + programmer_param = strdup("parallel,lpc,fwh,spi"); /* Convert the parameters to lowercase. */ - for (i = 0; dummytype[i] != '\0'; i++) - dummytype[i] = (char)tolower(dummytype[i]); + for (i = 0; programmer_param[i] != '\0'; i++) + programmer_param[i] = (char)tolower(programmer_param[i]); buses_supported = CHIP_BUSTYPE_NONE; - if (strstr(dummytype, "parallel")) { + if (strstr(programmer_param, "parallel")) { buses_supported |= CHIP_BUSTYPE_PARALLEL; printf_debug("Enabling support for %s flash.\n", "parallel"); } - if (strstr(dummytype, "lpc")) { + if (strstr(programmer_param, "lpc")) { buses_supported |= CHIP_BUSTYPE_LPC; printf_debug("Enabling support for %s flash.\n", "LPC"); } - if (strstr(dummytype, "fwh")) { + if (strstr(programmer_param, "fwh")) { buses_supported |= CHIP_BUSTYPE_FWH; printf_debug("Enabling support for %s flash.\n", "FWH"); } - if (strstr(dummytype, "spi")) { + if (strstr(programmer_param, "spi")) { buses_supported |= CHIP_BUSTYPE_SPI; spi_controller = SPI_CONTROLLER_DUMMY; printf_debug("Enabling support for %s flash.\n", "SPI"); } if (buses_supported == CHIP_BUSTYPE_NONE) printf_debug("Support for all flash bus types disabled.\n"); - free(dummytype); + free(programmer_param); return 0; } -- cgit v1.2.1