From b57fef9f3e2b3cb8d8c8c5a3552c94a28ff81d15 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Tue, 17 Jun 2014 20:13:08 +1000 Subject: src/ec: Sanitize headers and comment #endif pairings Comment #endif /* FOO */ pairings. Alphabetise headers and remove any #if CONFIG_ guards around them. Background rational: Remove guarding the inclusion of headers based on CONFIG_ options. This *potentially* could hide issues such as functions being swapped from under our feet, since different runtime behaviour could be declared with the same function same name and type-signature. Hence, depending on the header we happen to get may change runtime behaviour. Change-Id: Ic61bdfb64d99f0e2998c6451ae6686915b7bb3d4 Signed-off-by: Edward O'Callaghan Reviewed-on: http://review.coreboot.org/6059 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/ec/acpi/ec.h | 3 +-- src/ec/google/chromeec/ec.c | 3 +-- src/ec/google/chromeec/ec_i2c.c | 1 + src/ec/google/chromeec/ec_lpc.c | 8 ++++---- src/ec/google/chromeec/ec_message.h | 2 +- src/ec/google/chromeec/ec_spi.c | 1 + src/ec/lenovo/h8/chip.h | 3 ++- src/ec/lenovo/h8/h8.c | 9 +++++---- src/ec/lenovo/h8/h8.h | 3 ++- src/ec/lenovo/pmh7/chip.h | 3 ++- src/ec/lenovo/pmh7/pmh7.c | 7 ++----- src/ec/lenovo/pmh7/pmh7.h | 3 ++- src/ec/quanta/ene_kb3940q/ec.c | 5 +++-- src/ec/quanta/it8518/ec.c | 13 ++++--------- src/ec/smsc/mec1308/ec.c | 3 ++- 15 files changed, 33 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/ec/acpi/ec.h b/src/ec/acpi/ec.h index 8fc88d25fa..82266bf394 100644 --- a/src/ec/acpi/ec.h +++ b/src/ec/acpi/ec.h @@ -49,5 +49,4 @@ void ec_set_bit(u8 addr, u8 bit); void ec_clr_bit(u8 addr, u8 bit); void ec_set_ports(u16 cmd_reg, u16 data_reg); -#endif - +#endif /* _EC_ACPI_H */ diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 6e7ecdfb36..ab4db545fc 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -24,12 +24,11 @@ #include #include #include -#ifndef __PRE_RAM__ #include #include #include + #include "chip.h" -#endif #include "ec.h" #include "ec_commands.h" diff --git a/src/ec/google/chromeec/ec_i2c.c b/src/ec/google/chromeec/ec_i2c.c index a13dde6a7b..da11a9612d 100644 --- a/src/ec/google/chromeec/ec_i2c.c +++ b/src/ec/google/chromeec/ec_i2c.c @@ -23,6 +23,7 @@ #include #include #include + #include "ec.h" #include "ec_commands.h" diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c index 8b1cb2ff62..4cd30f3469 100644 --- a/src/ec/google/chromeec/ec_lpc.c +++ b/src/ec/google/chromeec/ec_lpc.c @@ -17,14 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include - -#include #include +#include #include #include #include +#include +#include + #include "chip.h" #include "ec.h" #include "ec_commands.h" diff --git a/src/ec/google/chromeec/ec_message.h b/src/ec/google/chromeec/ec_message.h index a2421c7ba4..7e7e51e80d 100644 --- a/src/ec/google/chromeec/ec_message.h +++ b/src/ec/google/chromeec/ec_message.h @@ -41,4 +41,4 @@ enum { MSG_BYTES = EC_HOST_PARAM_SIZE + MSG_PROTO_BYTES, }; -#endif +#endif /* _CROS_MESSAGE_H */ diff --git a/src/ec/google/chromeec/ec_spi.c b/src/ec/google/chromeec/ec_spi.c index 5525e31b1f..cc2c9baba6 100644 --- a/src/ec/google/chromeec/ec_spi.c +++ b/src/ec/google/chromeec/ec_spi.c @@ -19,6 +19,7 @@ #include #include + #include "ec.h" #include "ec_commands.h" diff --git a/src/ec/lenovo/h8/chip.h b/src/ec/lenovo/h8/chip.h index 37998ee6f3..bac54ecac6 100644 --- a/src/ec/lenovo/h8/chip.h +++ b/src/ec/lenovo/h8/chip.h @@ -50,4 +50,5 @@ struct ec_lenovo_h8_config { u8 has_keyboard_backlight; u8 has_power_management_beeps; }; -#endif + +#endif /* EC_LENOVO_H8EC_CHIP_H */ diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index 8fffd5a754..f5b1b77ec8 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -20,14 +20,15 @@ #include #include #include -#include #include +#include +#include #include +#include +#include + #include "h8.h" #include "chip.h" -#include -#include -#include static void h8_bluetooth_enable(int on) { diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h index dda3f659ad..6b3d4dbef0 100644 --- a/src/ec/lenovo/h8/h8.h +++ b/src/ec/lenovo/h8/h8.h @@ -124,4 +124,5 @@ void h8_mainboard_init_dock (void); #define H8_EVENT_FN_F5 0x64 #define H8_EVENT_FN_F6 0x65 -#endif + +#endif /* EC_LENOVO_H8_H */ diff --git a/src/ec/lenovo/pmh7/chip.h b/src/ec/lenovo/pmh7/chip.h index 4198f6660e..40a4956131 100644 --- a/src/ec/lenovo/pmh7/chip.h +++ b/src/ec/lenovo/pmh7/chip.h @@ -24,4 +24,5 @@ struct ec_lenovo_pmh7_config { int backlight_enable:1; int dock_event_enable:1; }; -#endif + +#endif /* EC_LENOVO_PMH7_CHIP_H */ diff --git a/src/ec/lenovo/pmh7/pmh7.c b/src/ec/lenovo/pmh7/pmh7.c index a4d0ccc466..cb0e27b89b 100644 --- a/src/ec/lenovo/pmh7/pmh7.c +++ b/src/ec/lenovo/pmh7/pmh7.c @@ -19,16 +19,13 @@ #include #include -#ifndef __PRE_RAM__ -#ifndef __SMM__ #include #include -#endif -#endif #include +#include + #include "pmh7.h" #include "chip.h" -#include void pmh7_backlight_enable(int onoff) { diff --git a/src/ec/lenovo/pmh7/pmh7.h b/src/ec/lenovo/pmh7/pmh7.h index 4cd9535b7b..fb68408a7b 100644 --- a/src/ec/lenovo/pmh7/pmh7.h +++ b/src/ec/lenovo/pmh7/pmh7.h @@ -36,4 +36,5 @@ void pmh7_dock_event_enable(int onoff); void pmh7_touchpad_enable(int onoff); void pmh7_ultrabay_power_enable(int onoff); void pmh7_trackpoint_enable(int onoff); -#endif + +#endif /* EC_LENOVO_PMH7_H */ diff --git a/src/ec/quanta/ene_kb3940q/ec.c b/src/ec/quanta/ene_kb3940q/ec.c index 7d0e6ae309..f0a2308e8a 100644 --- a/src/ec/quanta/ene_kb3940q/ec.c +++ b/src/ec/quanta/ene_kb3940q/ec.c @@ -21,14 +21,15 @@ #ifndef __PRE_RAM__ -#include #include +#include #include #include -#include #include #include +#include #include + #include "ec.h" #include "chip.h" diff --git a/src/ec/quanta/it8518/ec.c b/src/ec/quanta/it8518/ec.c index 9e6d3d0847..b9cb68f088 100644 --- a/src/ec/quanta/it8518/ec.c +++ b/src/ec/quanta/it8518/ec.c @@ -19,19 +19,14 @@ * MA 02110-1301 USA */ - - +#include #include -#include - -#ifndef __PRE_RAM__ +#include #include #include -#endif - +#include #include -#include -#include + #include "ec.h" #include "chip.h" diff --git a/src/ec/smsc/mec1308/ec.c b/src/ec/smsc/mec1308/ec.c index fdae5e4e56..4d3b30a118 100644 --- a/src/ec/smsc/mec1308/ec.c +++ b/src/ec/smsc/mec1308/ec.c @@ -19,10 +19,11 @@ * MA 02110-1301 USA */ +#include #include #include -#include #include + #include "ec.h" #include "chip.h" -- cgit v1.2.3