From dcef67e46875f9600c39716c2ac8b843bb86429c Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Mon, 21 Jun 2010 23:20:15 +0000 Subject: [PATCH] Kill unneeded #include wherever possible Tested on Linux, FreeBSD, NetBSD, OpenBSD, DOS. Thanks to Jonathan A. Kollasch and Idwer Vollering for testing. Corresponding to flashrom svn r1057. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Idwer Vollering --- chipset_enable.c | 4 +--- hwaccess.c | 11 ++++++++--- internal.c | 3 --- physmap.c | 10 +++++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/chipset_enable.c b/chipset_enable.c index 02d139e7d..d12429154 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -27,12 +27,10 @@ #define _LARGEFILE64_SOURCE -#include #include #include #include -#include -#include +#include #include "flash.h" #if defined(__i386__) || defined(__x86_64__) diff --git a/hwaccess.c b/hwaccess.c index f754166bc..85e13edca 100644 --- a/hwaccess.c +++ b/hwaccess.c @@ -21,10 +21,12 @@ #include #include #include +#include +#if !defined (__DJGPP__) #include #include -#include #include +#endif #include "flash.h" #if defined(__i386__) || defined(__x86_64__) @@ -42,12 +44,14 @@ int io_fd; void get_io_perms(void) { +#if defined(__DJGPP__) + /* We have full permissions by default. */ + return; +#else #if defined (__sun) && (defined(__i386) || defined(__amd64)) if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) { #elif defined(__FreeBSD__) || defined (__DragonFly__) if ((io_fd = open("/dev/io", O_RDWR)) < 0) { -#elif __DJGPP__ - if (0) { #else if (iopl(3) != 0) { #endif @@ -55,6 +59,7 @@ void get_io_perms(void) "You need to be root.\n", strerror(errno)); exit(1); } +#endif } void release_io_perms(void) diff --git a/internal.c b/internal.c index 961961878..823092619 100644 --- a/internal.c +++ b/internal.c @@ -21,10 +21,7 @@ #include #include #include -#include #include -#include -#include #include "flash.h" #if NEED_PCI == 1 diff --git a/physmap.c b/physmap.c index 764293884..c65df3072 100644 --- a/physmap.c +++ b/physmap.c @@ -23,13 +23,17 @@ #include #include #include -#include -#include #include #include -#include #include "flash.h" +/* Do we need any file access or ioctl for physmap or MSR? */ +#if !defined(__DJGPP__) +#include +#include +#include +#endif + #ifdef __DJGPP__ #include #include