Patchwork Clean up before Windows support merge

login
register
about
Submitter Carl-Daniel Hailfinger
Date 2009-08-09 11:12:27
Message ID <4A7EAF1B.1000008@gmx.net>
Download mbox | patch
Permalink /patch/95/
State Accepted
Commit r671
Headers show

Comments

Carl-Daniel Hailfinger - 2009-08-09 11:12:27
Stefan pointed out a few issues with the current code which have to be
worked around in the Windows support patch. Fix them.

Remove unnecessary #include files.
Serprog compilation is now controlled by a Makefile variable.
Replace munmap with physunmap where appropriate.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Stefan Reinauer - 2009-08-09 12:35:29
On 8/9/09 1:12 PM, Carl-Daniel Hailfinger wrote:
> Stefan pointed out a few issues with the current code which have to be
> worked around in the Windows support patch. Fix them.
>
> Remove unnecessary #include files.
> Serprog compilation is now controlled by a Makefile variable.
> Replace munmap with physunmap where appropriate.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
>   
Acked-by: Stefan Reinauer <stepan@coresystems.de>


> Index: flashrom-winprepare/pcidev.c
> ===================================================================
> --- flashrom-winprepare/pcidev.c	(Revision 670)
> +++ flashrom-winprepare/pcidev.c	(Arbeitskopie)
> @@ -20,10 +20,7 @@
>  
>  #include <stdlib.h>
>  #include <string.h>
> -#include <fcntl.h>
>  #include <sys/types.h>
> -#include <sys/stat.h>
> -#include <errno.h>
>  #include "flash.h"
>  
>  uint32_t io_base_addr;
> Index: flashrom-winprepare/serprog.c
> ===================================================================
> --- flashrom-winprepare/serprog.c	(Revision 670)
> +++ flashrom-winprepare/serprog.c	(Arbeitskopie)
> @@ -39,8 +39,6 @@
>  
>  char *serprog_param = NULL;
>  
> -#define SERPROG_SUPPORT 1
> -
>  #if SERPROG_SUPPORT == 1
>  
>  #define MSGHEADER "serprog:"
> Index: flashrom-winprepare/sst49lfxxxc.c
> ===================================================================
> --- flashrom-winprepare/sst49lfxxxc.c	(Revision 670)
> +++ flashrom-winprepare/sst49lfxxxc.c	(Arbeitskopie)
> @@ -19,9 +19,6 @@
>   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
>   */
>  
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <sys/mman.h>
>  #include <stdlib.h>
>  #include "flash.h"
>  
> Index: flashrom-winprepare/Makefile
> ===================================================================
> --- flashrom-winprepare/Makefile	(Revision 670)
> +++ flashrom-winprepare/Makefile	(Arbeitskopie)
> @@ -68,6 +68,8 @@
>  	$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS)
>  
>  FEATURE_CFLAGS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
> +# Always enable serprog for now. Needs to be disabled on Windows.
> +FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
>  
>  FEATURE_LIBS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-lftdi")
>  
> Index: flashrom-winprepare/dummyflasher.c
> ===================================================================
> --- flashrom-winprepare/dummyflasher.c	(Revision 670)
> +++ flashrom-winprepare/dummyflasher.c	(Arbeitskopie)
> @@ -21,10 +21,7 @@
>  #include <string.h>
>  #include <stdlib.h>
>  #include <ctype.h>
> -#include <fcntl.h>
>  #include <sys/types.h>
> -#include <sys/stat.h>
> -#include <errno.h>
>  #include "flash.h"
>  
>  char *dummytype = NULL;
> Index: flashrom-winprepare/chipset_enable.c
> ===================================================================
> --- flashrom-winprepare/chipset_enable.c	(Revision 670)
> +++ flashrom-winprepare/chipset_enable.c	(Arbeitskopie)
> @@ -29,7 +29,6 @@
>  #include <string.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
> -#include <sys/mman.h>
>  #include <fcntl.h>
>  #include "flash.h"
>  
> @@ -968,7 +967,7 @@
>  	}
>  
>  	/* 4. Clean up */
> -	munmap(mmcr, getpagesize());
> +	physunmap(mmcr, getpagesize());
>  	return 0;
>  }
>  
> Index: flashrom-winprepare/sb600spi.c
> ===================================================================
> --- flashrom-winprepare/sb600spi.c	(Revision 670)
> +++ flashrom-winprepare/sb600spi.c	(Arbeitskopie)
> @@ -21,7 +21,6 @@
>   */
>  
>  #include <string.h>
> -#include <sys/mman.h>
>  #include "flash.h"
>  #include "spi.h"
>  
> Index: flashrom-winprepare/ichspi.c
> ===================================================================
> --- flashrom-winprepare/ichspi.c	(Revision 670)
> +++ flashrom-winprepare/ichspi.c	(Arbeitskopie)
> @@ -33,7 +33,6 @@
>   */
>  
>  #include <string.h>
> -#include <sys/mman.h>
>  #include "flash.h"
>  #include "spi.h"
>  
> Index: flashrom-winprepare/cbtable.c
> ===================================================================
> --- flashrom-winprepare/cbtable.c	(Revision 670)
> +++ flashrom-winprepare/cbtable.c	(Arbeitskopie)
> @@ -22,11 +22,8 @@
>   */
>  
>  #include <stdlib.h>
> -#include <fcntl.h>
>  #include <sys/types.h>
>  #include <string.h>
> -#include <errno.h>
> -#include <sys/mman.h>
>  #include "flash.h"
>  #include "coreboot_tables.h"
>  
>
>
>
Carl-Daniel Hailfinger - 2009-08-09 12:44:55
On 09.08.2009 14:35, Stefan Reinauer wrote:
> On 8/9/09 1:12 PM, Carl-Daniel Hailfinger wrote:
>   
>> Stefan pointed out a few issues with the current code which have to be
>> worked around in the Windows support patch. Fix them.
>>
>> Remove unnecessary #include files.
>> Serprog compilation is now controlled by a Makefile variable.
>> Replace munmap with physunmap where appropriate.
>>
>> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
>>   
>>     
> Acked-by: Stefan Reinauer <stepan@coresystems.de>
>   

Thanks, r671.

Regards,
Carl-Daniel

Patch

Index: flashrom-winprepare/pcidev.c
===================================================================
--- flashrom-winprepare/pcidev.c	(Revision 670)
+++ flashrom-winprepare/pcidev.c	(Arbeitskopie)
@@ -20,10 +20,7 @@ 
 
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
 #include "flash.h"
 
 uint32_t io_base_addr;
Index: flashrom-winprepare/serprog.c
===================================================================
--- flashrom-winprepare/serprog.c	(Revision 670)
+++ flashrom-winprepare/serprog.c	(Arbeitskopie)
@@ -39,8 +39,6 @@ 
 
 char *serprog_param = NULL;
 
-#define SERPROG_SUPPORT 1
-
 #if SERPROG_SUPPORT == 1
 
 #define MSGHEADER "serprog:"
Index: flashrom-winprepare/sst49lfxxxc.c
===================================================================
--- flashrom-winprepare/sst49lfxxxc.c	(Revision 670)
+++ flashrom-winprepare/sst49lfxxxc.c	(Arbeitskopie)
@@ -19,9 +19,6 @@ 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
 #include <stdlib.h>
 #include "flash.h"
 
Index: flashrom-winprepare/Makefile
===================================================================
--- flashrom-winprepare/Makefile	(Revision 670)
+++ flashrom-winprepare/Makefile	(Arbeitskopie)
@@ -68,6 +68,8 @@ 
 	$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS)
 
 FEATURE_CFLAGS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
+# Always enable serprog for now. Needs to be disabled on Windows.
+FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
 
 FEATURE_LIBS = $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-lftdi")
 
Index: flashrom-winprepare/dummyflasher.c
===================================================================
--- flashrom-winprepare/dummyflasher.c	(Revision 670)
+++ flashrom-winprepare/dummyflasher.c	(Arbeitskopie)
@@ -21,10 +21,7 @@ 
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <fcntl.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
 #include "flash.h"
 
 char *dummytype = NULL;
Index: flashrom-winprepare/chipset_enable.c
===================================================================
--- flashrom-winprepare/chipset_enable.c	(Revision 670)
+++ flashrom-winprepare/chipset_enable.c	(Arbeitskopie)
@@ -29,7 +29,6 @@ 
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
 #include <fcntl.h>
 #include "flash.h"
 
@@ -968,7 +967,7 @@ 
 	}
 
 	/* 4. Clean up */
-	munmap(mmcr, getpagesize());
+	physunmap(mmcr, getpagesize());
 	return 0;
 }
 
Index: flashrom-winprepare/sb600spi.c
===================================================================
--- flashrom-winprepare/sb600spi.c	(Revision 670)
+++ flashrom-winprepare/sb600spi.c	(Arbeitskopie)
@@ -21,7 +21,6 @@ 
  */
 
 #include <string.h>
-#include <sys/mman.h>
 #include "flash.h"
 #include "spi.h"
 
Index: flashrom-winprepare/ichspi.c
===================================================================
--- flashrom-winprepare/ichspi.c	(Revision 670)
+++ flashrom-winprepare/ichspi.c	(Arbeitskopie)
@@ -33,7 +33,6 @@ 
  */
 
 #include <string.h>
-#include <sys/mman.h>
 #include "flash.h"
 #include "spi.h"
 
Index: flashrom-winprepare/cbtable.c
===================================================================
--- flashrom-winprepare/cbtable.c	(Revision 670)
+++ flashrom-winprepare/cbtable.c	(Arbeitskopie)
@@ -22,11 +22,8 @@ 
  */
 
 #include <stdlib.h>
-#include <fcntl.h>
 #include <sys/types.h>
 #include <string.h>
-#include <errno.h>
-#include <sys/mman.h>
 #include "flash.h"
 #include "coreboot_tables.h"