[flashrom] [PATCH] Compile out FT2232 SPI if not selected
Stefan Reinauer
stepan at coresystems.de
Wed Aug 19 13:52:15 CEST 2009
On 8/17/09 5:57 PM, Carl-Daniel Hailfinger wrote:
> If FT2232H SPI is not enabled, it should be compiled out completely. We
> can't remove ft2232_spi.o from unconditional OBJS yet due to our
> makefile structure (make features), but this patch adds #ifdefs around
> all FT2232H code, so the net effect is the same.
>
> This is 0.9.1 material.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
Please address the one issue below.
Acked-by: Stefan Reinauer <stepan at coresystems.de>
> Index: flashrom-ft2232_compileout/ft2232_spi.c
> ===================================================================
> --- flashrom-ft2232_compileout/ft2232_spi.c (Revision 684)
> +++ flashrom-ft2232_compileout/ft2232_spi.c (Arbeitskopie)
> @@ -18,6 +18,8 @@
> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> */
>
> +#if FT2232_SPI_SUPPORT == 1
> +
> #include <stdio.h>
> #include <stdint.h>
> #include <string.h>
> @@ -25,9 +27,6 @@
> #include <ctype.h>
> #include "flash.h"
> #include "spi.h"
> -
> -#if FT2232_SPI_SUPPORT == 1
> -
> #include <ftdi.h>
>
> /* the 'H' chips can run internally at either 12Mhz or 60Mhz.
> @@ -297,29 +296,4 @@
> return 0;
> }
>
> -#else
> -int ft2232_spi_init(void)
> -{
> - fprintf(stderr, "FT2232 SPI support was not compiled in\n");
> - exit(1);
> -}
> -
> -int ft2232_spi_send_command(unsigned int writecnt, unsigned int readcnt,
> - const unsigned char *writearr, unsigned char *readarr)
> -{
> - fprintf(stderr, "FT2232 SPI support was not compiled in\n");
> - exit(1);
> -}
> -
> -int ft2232_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len)
> -{
> - fprintf(stderr, "FT2232 SPI support was not compiled in\n");
> - exit(1);
> -}
> -
> -int ft2232_spi_write_256(struct flashchip *flash, uint8_t *buf)
> -{
> - fprintf(stderr, "FT2232 SPI support was not compiled in\n");
> - exit(1);
> -}
> #endif
>
For serprog.c the mechanism is moved to the Makefile
ifeq ($(CONFIG_SERPROG), yes)
FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
OBJS += serprog.o
endif
Maybe the two cases should be unified?
Stefan
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
More information about the flashrom
mailing list