[flashrom] [PATCH] Don't compile internal code if not selected

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Dec 24 03:30:30 CET 2009


internal.c was always compiled in because it hosted the function
internal_delay(). Move that function to udelay.c and compile internal.c
only if really needed.
physmap.c is only needed if the programmer is internal or a PCI card.
Make its compilation conditional.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-programmer_internal_refactor_delay/flash.h
===================================================================
--- flashrom-programmer_internal_refactor_delay/flash.h	(Revision 821)
+++ flashrom-programmer_internal_refactor_delay/flash.h	(Arbeitskopie)
@@ -277,6 +277,7 @@
 /* udelay.c */
 void myusec_delay(int usecs);
 void myusec_calibrate_delay(void);
+void internal_delay(int usecs);
 
 #if NEED_PCI == 1
 /* pcidev.c */
@@ -365,7 +366,6 @@
 uint8_t mmio_readb(void *addr);
 uint16_t mmio_readw(void *addr);
 uint32_t mmio_readl(void *addr);
-void internal_delay(int usecs);
 int noop_shutdown(void);
 void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
 void fallback_unmap(void *virt_addr, size_t len);
Index: flashrom-programmer_internal_refactor_delay/Makefile
===================================================================
--- flashrom-programmer_internal_refactor_delay/Makefile	(Revision 821)
+++ flashrom-programmer_internal_refactor_delay/Makefile	(Arbeitskopie)
@@ -47,7 +47,7 @@
 	sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \
 	w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \
 	sst49lfxxxc.o sst_fwhub.o flashchips.o layout.o spi.o \
-	flashrom.o print.o physmap.o internal.o udelay.o
+	flashrom.o print.o udelay.o
 
 all: pciutils features dep $(PROGRAM)
 
@@ -168,7 +168,7 @@
 
 ifeq ($(NEED_PCI), yes)
 FEATURE_CFLAGS += -D'NEED_PCI=1'
-OBJS += pcidev.o
+OBJS += pcidev.o physmap.o internal.o
 endif
 
 ifeq ($(CONFIG_PRINT_WIKI), yes)
Index: flashrom-programmer_internal_refactor_delay/internal.c
===================================================================
--- flashrom-programmer_internal_refactor_delay/internal.c	(Revision 821)
+++ flashrom-programmer_internal_refactor_delay/internal.c	(Arbeitskopie)
@@ -248,18 +248,6 @@
 	return *(volatile uint32_t *) addr;
 }
 
-void internal_delay(int usecs)
-{
-	/* If the delay is >1 s, use usleep because timing does not need to
-	 * be so precise.
-	 */
-	if (usecs > 1000000) {
-		usleep(usecs);
-	} else {
-		myusec_delay(usecs);
-	}
-}
-
 /* No-op shutdown() for programmers which don't need special handling */
 int noop_shutdown(void)
 {
Index: flashrom-programmer_internal_refactor_delay/udelay.c
===================================================================
--- flashrom-programmer_internal_refactor_delay/udelay.c	(Revision 821)
+++ flashrom-programmer_internal_refactor_delay/udelay.c	(Arbeitskopie)
@@ -63,3 +63,16 @@
 		     (unsigned long)micro, timeusec);
 	printf("OK.\n");
 }
+
+void internal_delay(int usecs)
+{
+	/* If the delay is >1 s, use usleep because timing does not need to
+	 * be so precise.
+	 */
+	if (usecs > 1000000) {
+		usleep(usecs);
+	} else {
+		myusec_delay(usecs);
+	}
+}
+


-- 
Developer quote of the year:
"We are juggling too many chainsaws and flaming arrows and tigers."





More information about the flashrom mailing list