summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-11-22 15:03:23 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-29 20:50:47 +0000
commit1b359bdd91da15ea25aaffd0d940ff63b9d72bc5 (patch)
tree193b3670618546b6914c1dab42943e87ba6766a2
parent9a8d82d6dd9aadfdfb790e9af8ee3f5663bbbdeb (diff)
downloadchrome-ec-1b359bdd91da15ea25aaffd0d940ff63b9d72bc5.tar.gz
include: Sort header files
Sort all includes in include with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ic23f440ebd93519e4341423cf6cb7a298620cbfe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049883 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r--include/accelgyro.h2
-rw-r--r--include/battery_fuel_gauge.h1
-rw-r--r--include/benchmark.h7
-rw-r--r--include/bluetooth_le_ll.h2
-rw-r--r--include/body_detection.h2
-rw-r--r--include/button.h2
-rw-r--r--include/charge_state.h2
-rw-r--r--include/charge_state_v2.h4
-rw-r--r--include/common.h7
-rw-r--r--include/console.h1
-rw-r--r--include/dps.h4
-rw-r--r--include/driver/accelgyro_bmi260.h2
-rw-r--r--include/driver/accelgyro_bmi_common.h2
-rw-r--r--include/driver/retimer/bb_retimer.h2
-rw-r--r--include/ec_ec_comm_client.h3
-rw-r--r--include/ec_ec_comm_server.h3
-rw-r--r--include/flash_log.h2
-rw-r--r--include/fpsensor.h3
-rw-r--r--include/fpsensor_crypto.h4
-rw-r--r--include/fpsensor_state.h7
-rw-r--r--include/gpio.h3
-rw-r--r--include/gpio_list.h4
-rw-r--r--include/host_command.h2
-rw-r--r--include/i2c_bitbang.h4
-rw-r--r--include/keyboard_8042.h2
-rw-r--r--include/keyboard_8042_sharedlib.h4
-rw-r--r--include/keyboard_protocol.h2
-rw-r--r--include/keyboard_raw.h4
-rw-r--r--include/mag_cal.h4
-rw-r--r--include/math_util.h4
-rw-r--r--include/mock/fpsensor_state_mock.h6
-rw-r--r--include/mock/tcpc_mock.h2
-rw-r--r--include/mock/usb_pe_sm_mock.h2
-rw-r--r--include/mock/usb_tc_sm_mock.h2
-rw-r--r--include/newton_fit.h2
-rw-r--r--include/panic.h7
-rw-r--r--include/printf.h5
-rw-r--r--include/pwm.h4
-rw-r--r--include/queue_policies.h2
-rw-r--r--include/rgb_keyboard.h4
-rw-r--r--include/rma_auth.h4
-rw-r--r--include/shared_mem.h1
-rw-r--r--include/stillness_detector.h1
-rw-r--r--include/system.h4
-rw-r--r--include/task.h3
-rw-r--r--include/test_util.h3
-rw-r--r--include/tests/enum_strings.h2
-rw-r--r--include/trng.h3
-rw-r--r--include/uart.h3
-rw-r--r--include/update_fw.h4
-rw-r--r--include/usb_dp_alt_mode.h4
-rw-r--r--include/usb_mode.h4
-rw-r--r--include/usb_pd.h5
-rw-r--r--include/usb_pd_tcpc.h3
-rw-r--r--include/usb_pd_tcpm.h3
-rw-r--r--include/usb_pd_timer.h4
-rw-r--r--include/usb_prl_sm.h3
-rw-r--r--include/usb_tbt_alt_mode.h4
-rw-r--r--include/usb_tc_sm.h2
-rw-r--r--include/util.h1
-rw-r--r--include/vb21_struct.h4
-rw-r--r--include/vboot.h2
-rw-r--r--include/watchdog.h4
63 files changed, 111 insertions, 91 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h
index 74824b2611..b51a0ea148 100644
--- a/include/accelgyro.h
+++ b/include/accelgyro.h
@@ -6,8 +6,8 @@
#ifndef __CROS_EC_ACCELGYRO_H
#define __CROS_EC_ACCELGYRO_H
-#include "motion_sense.h"
#include "math_util.h"
+#include "motion_sense.h"
/* Header file for accelerometer / gyro drivers. */
diff --git a/include/battery_fuel_gauge.h b/include/battery_fuel_gauge.h
index 0a2a4064bb..efcf18530c 100644
--- a/include/battery_fuel_gauge.h
+++ b/include/battery_fuel_gauge.h
@@ -9,6 +9,7 @@
#define __CROS_EC_BATTERY_FUEL_GAUGE_H
#include "battery.h"
+
#include <stdbool.h>
/* Number of writes needed to invoke battery cutoff command */
diff --git a/include/benchmark.h b/include/benchmark.h
index d2fcc9388c..190580ebb7 100644
--- a/include/benchmark.h
+++ b/include/benchmark.h
@@ -8,17 +8,18 @@
#ifndef __CROS_EC_BENCHMARK_H
#define __CROS_EC_BENCHMARK_H
+#include <stdint.h>
+
#include <array>
-#include <optional>
#include <functional>
-#include <stdint.h>
+#include <optional>
#include <string_view>
extern "C" {
+#include "clock.h"
#include "console.h"
#include "timer.h"
#include "util.h"
-#include "clock.h"
#include "watchdog.h"
}
diff --git a/include/bluetooth_le_ll.h b/include/bluetooth_le_ll.h
index d17aec8a57..ec2bb7f7e7 100644
--- a/include/bluetooth_le_ll.h
+++ b/include/bluetooth_le_ll.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "common.h"
#include "btle_hci_int.h"
+#include "common.h"
enum ll_state_t {
UNINITIALIZED,
diff --git a/include/body_detection.h b/include/body_detection.h
index 8fea5d84e1..7ab7ab3e6d 100644
--- a/include/body_detection.h
+++ b/include/body_detection.h
@@ -6,8 +6,8 @@
#ifndef __CROS_EC_BODY_DETECTION_H
#define __CROS_EC_BODY_DETECTION_H
-#include <stdint.h>
#include <stdbool.h>
+#include <stdint.h>
enum body_detect_states { BODY_DETECTION_OFF_BODY, BODY_DETECTION_ON_BODY };
diff --git a/include/button.h b/include/button.h
index f0c71d7f3f..b38191aaf5 100644
--- a/include/button.h
+++ b/include/button.h
@@ -10,8 +10,8 @@
#include "common.h"
#include "compile_time_macros.h"
-#include "gpio_signal.h"
#include "ec_commands.h"
+#include "gpio_signal.h"
#define BUTTON_FLAG_ACTIVE_HIGH BIT(0)
#define BUTTON_FLAG_DISABLED BIT(1) /* Button disabled */
diff --git a/include/charge_state.h b/include/charge_state.h
index f8edd604ea..dcf3430954 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -6,8 +6,8 @@
#define __CROS_EC_CHARGE_STATE_H
#include "common.h"
-#include "timer.h"
#include "stdbool.h"
+#include "timer.h"
/* Stuff that's common to all charger implementations can go here. */
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index c7a5cbc995..6d0b936f4a 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -3,8 +3,6 @@
* found in the LICENSE file.
*/
-#include <stdbool.h>
-
#include "battery.h"
#include "battery_smart.h"
#include "charger.h"
@@ -13,6 +11,8 @@
#include "ocpc.h"
#include "timer.h"
+#include <stdbool.h>
+
#ifndef __CROS_EC_CHARGE_STATE_V2_H
#define __CROS_EC_CHARGE_STATE_V2_H
diff --git a/include/common.h b/include/common.h
index 6f76157b6c..02f7449d81 100644
--- a/include/common.h
+++ b/include/common.h
@@ -8,13 +8,14 @@
#ifndef __CROS_EC_COMMON_H
#define __CROS_EC_COMMON_H
-#include <stdint.h>
-#include <inttypes.h>
-
#include "compile_time_macros.h"
+#include <inttypes.h>
+#include <stdint.h>
+
#ifdef CONFIG_ZEPHYR
#include "fpu.h"
+
#include <zephyr/sys/util.h>
#include <zephyr/toolchain.h>
#ifdef CONFIG_ZTEST
diff --git a/include/console.h b/include/console.h
index ddfba89926..03abbe5732 100644
--- a/include/console.h
+++ b/include/console.h
@@ -10,6 +10,7 @@
#include "common.h"
#include "config.h"
+
#include <stdbool.h>
#ifdef CONFIG_ZEPHYR
diff --git a/include/dps.h b/include/dps.h
index 8794220ab2..c4d2c884b1 100644
--- a/include/dps.h
+++ b/include/dps.h
@@ -6,10 +6,10 @@
#ifndef __CROS_EC_DPS__H
#define __CROS_EC_DPS__H
-#include <stdbool.h>
-
#include "common.h"
+#include <stdbool.h>
+
#define DPS_FLAG_DISABLED BIT(0)
#define DPS_FLAG_NO_SRCCAP BIT(1)
#define DPS_FLAG_WAITING BIT(2)
diff --git a/include/driver/accelgyro_bmi260.h b/include/driver/accelgyro_bmi260.h
index 5d55a85acc..baf78e9e00 100644
--- a/include/driver/accelgyro_bmi260.h
+++ b/include/driver/accelgyro_bmi260.h
@@ -10,8 +10,8 @@
#include "accelgyro.h"
#include "common.h"
-#include "mag_bmm150.h"
#include "driver/accelgyro_bmi260_public.h"
+#include "mag_bmm150.h"
#define BMI260_CHIP_ID 0x00
/* BMI260 chip identifier */
diff --git a/include/driver/accelgyro_bmi_common.h b/include/driver/accelgyro_bmi_common.h
index 371d3d97ce..01a9ecffd6 100644
--- a/include/driver/accelgyro_bmi_common.h
+++ b/include/driver/accelgyro_bmi_common.h
@@ -10,8 +10,8 @@
#include "accelgyro.h"
#include "accelgyro_bmi160.h"
#include "accelgyro_bmi260.h"
-#include "mag_bmm150.h"
#include "accelgyro_bmi_common_public.h"
+#include "mag_bmm150.h"
#if !defined(CONFIG_ACCELGYRO_BMI_COMM_SPI) && \
!defined(CONFIG_ACCELGYRO_BMI_COMM_I2C)
diff --git a/include/driver/retimer/bb_retimer.h b/include/driver/retimer/bb_retimer.h
index 460156803e..b47743f882 100644
--- a/include/driver/retimer/bb_retimer.h
+++ b/include/driver/retimer/bb_retimer.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_BB_RETIMER_H
#define __CROS_EC_BB_RETIMER_H
-#include "usb_mux.h"
#include "driver/retimer/bb_retimer_public.h"
+#include "usb_mux.h"
/* Burnside Bridge I2C Configuration Space */
#define BB_RETIMER_REG_VENDOR_ID 0
diff --git a/include/ec_ec_comm_client.h b/include/ec_ec_comm_client.h
index 9b506dd402..57c599a365 100644
--- a/include/ec_ec_comm_client.h
+++ b/include/ec_ec_comm_client.h
@@ -8,9 +8,10 @@
#ifndef EC_EC_COMM_CLIENT_H_
#define EC_EC_COMM_CLIENT_H_
-#include <stdint.h>
#include "config.h"
+#include <stdint.h>
+
/**
* Sends EC_CMD_BATTERY_GET_DYNAMIC command to server, and writes the
* battery dynamic information into battery_dynamic[BATT_IDX_BASE].
diff --git a/include/ec_ec_comm_server.h b/include/ec_ec_comm_server.h
index 0eb094fea3..9728e021a8 100644
--- a/include/ec_ec_comm_server.h
+++ b/include/ec_ec_comm_server.h
@@ -8,10 +8,11 @@
#ifndef EC_EC_COMM_SERVER_H_
#define EC_EC_COMM_SERVER_H_
-#include <stdint.h>
#include "consumer.h"
#include "queue.h"
+#include <stdint.h>
+
extern struct queue const ec_ec_comm_server_input;
extern struct queue const ec_ec_comm_server_output;
diff --git a/include/flash_log.h b/include/flash_log.h
index 7141a8b67a..36e3be6738 100644
--- a/include/flash_log.h
+++ b/include/flash_log.h
@@ -6,9 +6,9 @@
#ifndef __CROS_EC_EVENT_LOG_H
#define __CROS_EC_EVENT_LOG_H
-#include "config.h"
#include "common.h"
#include "compile_time_macros.h"
+#include "config.h"
#include "stddef.h"
enum flash_event_type {
diff --git a/include/fpsensor.h b/include/fpsensor.h
index 3963df86a7..a59eea1b89 100644
--- a/include/fpsensor.h
+++ b/include/fpsensor.h
@@ -8,10 +8,11 @@
#ifndef __CROS_EC_FPSENSOR_H
#define __CROS_EC_FPSENSOR_H
-#include <stdint.h>
#include "common.h"
#include "ec_commands.h"
+#include <stdint.h>
+
#ifndef SPI_FP_DEVICE
#define SPI_FP_DEVICE (&spi_devices[0])
#endif
diff --git a/include/fpsensor_crypto.h b/include/fpsensor_crypto.h
index 7dff9238fa..f000b841e4 100644
--- a/include/fpsensor_crypto.h
+++ b/include/fpsensor_crypto.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_FPSENSOR_CRYPTO_H
#define __CROS_EC_FPSENSOR_CRYPTO_H
-#include <stddef.h>
-
#include "sha256.h"
+#include <stddef.h>
+
#define HKDF_MAX_INFO_SIZE 128
#define HKDF_SHA256_MAX_BLOCK_COUNT 255
diff --git a/include/fpsensor_state.h b/include/fpsensor_state.h
index ce454233fa..d8f112afcd 100644
--- a/include/fpsensor_state.h
+++ b/include/fpsensor_state.h
@@ -8,16 +8,15 @@
#ifndef __CROS_EC_FPSENSOR_STATE_H
#define __CROS_EC_FPSENSOR_STATE_H
-#include <stdbool.h>
-#include <stdint.h>
-
#include "atomic.h"
#include "common.h"
+#include "driver/fingerprint/fpsensor.h"
#include "ec_commands.h"
#include "link_defs.h"
#include "timer.h"
-#include "driver/fingerprint/fpsensor.h"
+#include <stdbool.h>
+#include <stdint.h>
/* if no special memory regions are defined, fallback on regular SRAM */
#ifndef FP_FRAME_SECTION
diff --git a/include/gpio.h b/include/gpio.h
index f6729c7830..086ed9131f 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -21,8 +21,9 @@
*/
#ifdef CONFIG_ZEPHYR
#include <zephyr/drivers/gpio.h>
-#include <zephyr/dt-bindings/gpio/nuvoton-npcx-gpio.h>
#include <zephyr/dt-bindings/gpio/ite-it8xxx2-gpio.h>
+#include <zephyr/dt-bindings/gpio/nuvoton-npcx-gpio.h>
+
#include <dt-bindings/native-posix-gpio.h>
/*
diff --git a/include/gpio_list.h b/include/gpio_list.h
index 17fc0d3b09..e5a90b4e89 100644
--- a/include/gpio_list.h
+++ b/include/gpio_list.h
@@ -67,9 +67,9 @@ const int gpio_ih_count = ARRAY_SIZE(gpio_irq_handlers);
#define PIN(a, b...) \
static const int _pin_##a##_##b \
__attribute__((unused, section(".unused"))) = __LINE__;
-#include "gpio.wrap"
-
#include "ioexpander.h"
+
+#include "gpio.wrap"
#define IOEX_EXPIN(ioex, port, index) (ioex), (port), BIT(index)
/*
diff --git a/include/host_command.h b/include/host_command.h
index 59389107c7..7efd54e297 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_HOST_COMMAND_H
#define __CROS_EC_HOST_COMMAND_H
-#include "compiler.h"
#include "common.h"
+#include "compiler.h"
#include "ec_commands.h"
#ifdef __cplusplus
diff --git a/include/i2c_bitbang.h b/include/i2c_bitbang.h
index 9c7c730518..c9b0587410 100644
--- a/include/i2c_bitbang.h
+++ b/include/i2c_bitbang.h
@@ -5,10 +5,10 @@
#ifndef __CROS_EC_I2C_BITBANG_H
#define __CROS_EC_I2C_BITBANG_H
-#include <stdbool.h>
-
#include "i2c.h"
+#include <stdbool.h>
+
extern const struct i2c_drv bitbang_drv;
extern const struct i2c_port_t i2c_bitbang_ports[];
diff --git a/include/keyboard_8042.h b/include/keyboard_8042.h
index 34c98c2a38..bd56106f1d 100644
--- a/include/keyboard_8042.h
+++ b/include/keyboard_8042.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_KEYBOARD_8042_H
#define __CROS_EC_KEYBOARD_8042_H
-#include "common.h"
#include "button.h"
+#include "common.h"
/**
* Called by power button handler and button interrupt handler.
diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h
index bd7a7b5ec7..2f8dfdc242 100644
--- a/include/keyboard_8042_sharedlib.h
+++ b/include/keyboard_8042_sharedlib.h
@@ -8,12 +8,12 @@
#ifndef __CROS_EC_KEYBOARD_8042_SHAREDLIB_H
#define __CROS_EC_KEYBOARD_8042_SHAREDLIB_H
-#include <stddef.h>
-
#include "button.h"
#include "keyboard_config.h"
#include "keyboard_protocol.h"
+#include <stddef.h>
+
struct button_8042_t {
uint16_t scancode;
int repeat;
diff --git a/include/keyboard_protocol.h b/include/keyboard_protocol.h
index 7b9006fcc0..8f10c7bd0e 100644
--- a/include/keyboard_protocol.h
+++ b/include/keyboard_protocol.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_KEYBOARD_PROTOCOL_H
#define __CROS_EC_KEYBOARD_PROTOCOL_H
-#include "common.h"
#include "button.h"
+#include "common.h"
/* Routines common to all protocols */
diff --git a/include/keyboard_raw.h b/include/keyboard_raw.h
index 2b2254e56c..350791998f 100644
--- a/include/keyboard_raw.h
+++ b/include/keyboard_raw.h
@@ -11,13 +11,13 @@
#ifndef __CROS_EC_KEYBOARD_RAW_H
#define __CROS_EC_KEYBOARD_RAW_H
-#include <stdbool.h>
-
#include "builtin/assert.h"
#include "common.h"
#include "gpio_signal.h"
#include "keyboard_config.h"
+#include <stdbool.h>
+
/* Column values for keyboard_raw_drive_column() */
enum keyboard_column_index {
KEYBOARD_COLUMN_ALL = -2, /* Drive all columns */
diff --git a/include/mag_cal.h b/include/mag_cal.h
index 66281bba4e..82453c5235 100644
--- a/include/mag_cal.h
+++ b/include/mag_cal.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_MAG_CAL_H
#define __CROS_EC_MAG_CAL_H
-#include "math_util.h"
+#include "kasa.h"
#include "mat44.h"
+#include "math_util.h"
#include "vec4.h"
-#include "kasa.h"
#define MAG_CAL_MAX_SAMPLES 0xffff
#define MAG_CAL_MIN_BATCH_WINDOW_US (2 * SECOND)
diff --git a/include/math_util.h b/include/math_util.h
index 51065d2bce..6b4b8cb3e5 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -8,9 +8,11 @@
#ifndef __CROS_EC_MATH_UTIL_H
#define __CROS_EC_MATH_UTIL_H
-#include <stdint.h>
+#include "config.h"
#include "limits.h"
+#include <stdint.h>
+
#ifdef CONFIG_FPU
typedef float fp_t;
typedef float fp_inter_t;
diff --git a/include/mock/fpsensor_state_mock.h b/include/mock/fpsensor_state_mock.h
index 32450e3cc0..c683ba5deb 100644
--- a/include/mock/fpsensor_state_mock.h
+++ b/include/mock/fpsensor_state_mock.h
@@ -6,12 +6,12 @@
#ifndef __MOCK_FPSENSOR_STATE_MOCK_H
#define __MOCK_FPSENSOR_STATE_MOCK_H
-#include <stdbool.h>
-#include <stdint.h>
-
#include "driver/fingerprint/fpsensor.h"
#include "ec_commands.h"
+#include <stdbool.h>
+#include <stdint.h>
+
extern const uint8_t default_fake_tpm_seed[FP_CONTEXT_TPM_BYTES];
extern const uint8_t
default_fake_fp_positive_match_salt[FP_MAX_FINGER_COUNT]
diff --git a/include/mock/tcpc_mock.h b/include/mock/tcpc_mock.h
index 2f3a78c69a..fef45b492b 100644
--- a/include/mock/tcpc_mock.h
+++ b/include/mock/tcpc_mock.h
@@ -4,8 +4,8 @@
*/
/* Mock for the TCPC interface */
-#include "usb_pd_tcpm.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
/* Controller for TCPC state */
struct mock_tcpc_ctrl {
diff --git a/include/mock/usb_pe_sm_mock.h b/include/mock/usb_pe_sm_mock.h
index 819f086c5a..778e7943c4 100644
--- a/include/mock/usb_pe_sm_mock.h
+++ b/include/mock/usb_pe_sm_mock.h
@@ -8,8 +8,8 @@
#define __MOCK_USB_PE_SM_MOCK_H
#include "common.h"
-#include "usb_pe_sm.h"
#include "usb_pd_tcpm.h"
+#include "usb_pe_sm.h"
struct mock_pe_port_t {
enum tcpci_msg_type sop;
diff --git a/include/mock/usb_tc_sm_mock.h b/include/mock/usb_tc_sm_mock.h
index 532f2bfb54..2dc09ade8b 100644
--- a/include/mock/usb_tc_sm_mock.h
+++ b/include/mock/usb_tc_sm_mock.h
@@ -8,9 +8,9 @@
#define __MOCK_USB_TC_SM_MOCK_H
#include "common.h"
-#include "usb_tc_sm.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_tc_sm.h"
struct mock_tc_port_t {
int rev;
diff --git a/include/newton_fit.h b/include/newton_fit.h
index 2fb1994083..dc0a8ffe6e 100644
--- a/include/newton_fit.h
+++ b/include/newton_fit.h
@@ -9,8 +9,8 @@
#define __CROS_EC_NEWTON_FIT_H
#include "queue.h"
-#include "vec3.h"
#include "stdbool.h"
+#include "vec3.h"
struct newton_fit_orientation {
/** An orientations. */
diff --git a/include/panic.h b/include/panic.h
index 8eda475f2a..25829017ea 100644
--- a/include/panic.h
+++ b/include/panic.h
@@ -9,12 +9,13 @@
#ifndef __CROS_EC_PANIC_H
#define __CROS_EC_PANIC_H
+#include "common.h"
+#include "software_panic.h"
+
#include <stdarg.h>
#include <stdint.h>
-#include <stdnoreturn.h>
-#include "common.h"
-#include "software_panic.h"
+#include <stdnoreturn.h>
#ifdef __cplusplus
extern "C" {
diff --git a/include/printf.h b/include/printf.h
index f797ca593e..a06d8e1c7b 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -8,12 +8,13 @@
#ifndef __CROS_EC_PRINTF_H
#define __CROS_EC_PRINTF_H
+#include "common.h"
+#include "console.h"
+
#include <stdarg.h> /* For va_list */
#include <stdbool.h>
#include <stddef.h> /* For size_t */
-#include "console.h"
#include <stdio.h>
-#include "common.h"
/**
* Buffer size in bytes large enough to hold the largest possible timestamp.
diff --git a/include/pwm.h b/include/pwm.h
index 48963d9d3c..b56f9f8c1a 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -6,10 +6,10 @@
#ifndef __CROS_EC_PWM_H
#define __CROS_EC_PWM_H
-#include <inttypes.h>
-
#include "util.h"
+#include <inttypes.h>
+
#define PWM_RAW_TO_PERCENT(v) DIV_ROUND_NEAREST((uint32_t)(v)*100, UINT16_MAX)
#define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v)*UINT16_MAX / 100)
diff --git a/include/queue_policies.h b/include/queue_policies.h
index aceb477ef6..eb80d3673b 100644
--- a/include/queue_policies.h
+++ b/include/queue_policies.h
@@ -7,9 +7,9 @@
#ifndef __CROS_EC_QUEUE_POLICIES_H
#define __CROS_EC_QUEUE_POLICIES_H
-#include "queue.h"
#include "consumer.h"
#include "producer.h"
+#include "queue.h"
/*
* The direct notification policy manages a 1-to-1 producer consumer model.
diff --git a/include/rgb_keyboard.h b/include/rgb_keyboard.h
index 56a3e09a91..8c16f6f7e8 100644
--- a/include/rgb_keyboard.h
+++ b/include/rgb_keyboard.h
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include <stdbool.h>
-
#include "common.h"
#include "ec_commands.h"
#include "stddef.h"
+#include <stdbool.h>
+
/* Use this instead of '3' for readability where applicable. */
#define SIZE_OF_RGB sizeof(struct rgb_s)
diff --git a/include/rma_auth.h b/include/rma_auth.h
index 2ad9299fed..0b02a1bdc6 100644
--- a/include/rma_auth.h
+++ b/include/rma_auth.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_RMA_AUTH_H
#define __CROS_EC_RMA_AUTH_H
-#include <stdint.h>
-
#include "common.h" /* For __packed. */
+#include <stdint.h>
+
/* Current challenge protocol version */
#define RMA_CHALLENGE_VERSION 0
diff --git a/include/shared_mem.h b/include/shared_mem.h
index 307ce9f5e5..482d3a6dec 100644
--- a/include/shared_mem.h
+++ b/include/shared_mem.h
@@ -18,6 +18,7 @@
#define __CROS_EC_SHARED_MEM_H
#include "common.h"
+
#include <stddef.h>
/**
diff --git a/include/stillness_detector.h b/include/stillness_detector.h
index 79de2de79f..67269c6db4 100644
--- a/include/stillness_detector.h
+++ b/include/stillness_detector.h
@@ -9,6 +9,7 @@
#include "common.h"
#include "math_util.h"
#include "stdbool.h"
+
#include <stdint.h>
struct still_det {
diff --git a/include/system.h b/include/system.h
index 4d98136da5..c7884199e1 100644
--- a/include/system.h
+++ b/include/system.h
@@ -8,8 +8,6 @@
#ifndef __CROS_EC_SYSTEM_H
#define __CROS_EC_SYSTEM_H
-#include <stdnoreturn.h>
-
#include "atomic.h"
#include "common.h"
#include "compile_time_macros.h"
@@ -17,6 +15,8 @@
#include "ec_commands.h"
#include "timer.h"
+#include <stdnoreturn.h>
+
#ifdef CONFIG_ZEPHYR
#ifdef CONFIG_CPU_CORTEX_M
/*
diff --git a/include/task.h b/include/task.h
index bc7314169e..a527ca695a 100644
--- a/include/task.h
+++ b/include/task.h
@@ -15,9 +15,10 @@ extern "C" {
#include "atomic_t.h"
#include "common.h"
#include "compile_time_macros.h"
-#include <stdbool.h>
#include "task_id.h"
+#include <stdbool.h>
+
/* Task event bitmasks */
/* Tasks may use the bits in TASK_EVENT_CUSTOM_BIT for their own events */
#define TASK_EVENT_CUSTOM_BIT(x) BUILD_CHECK_INLINE(BIT(x), BIT(x) & 0x0ffff)
diff --git a/include/test_util.h b/include/test_util.h
index 47b73605d4..efdee22cc6 100644
--- a/include/test_util.h
+++ b/include/test_util.h
@@ -19,8 +19,9 @@ extern "C" {
#include "stack_trace.h"
#ifdef CONFIG_ZTEST
-#include <zephyr/ztest.h>
#include "ec_tasks.h"
+
+#include <zephyr/ztest.h>
#endif /* CONFIG_ZTEST */
/* This allows tests to be easily commented out in run_test for debugging */
diff --git a/include/tests/enum_strings.h b/include/tests/enum_strings.h
index 2ad0725f8f..7654dc9377 100644
--- a/include/tests/enum_strings.h
+++ b/include/tests/enum_strings.h
@@ -5,8 +5,8 @@
/* Defines helper function that convert Enums to strings for prints in tests */
-#include "usb_pd_tcpm.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#ifndef __CROS_EC_TEST_ENUM_STINGS_H
#define __CROS_EC_TEST_ENUM_STINGS_H
diff --git a/include/trng.h b/include/trng.h
index cf8326e5bf..3b28796ed0 100644
--- a/include/trng.h
+++ b/include/trng.h
@@ -5,10 +5,11 @@
#ifndef __EC_INCLUDE_TRNG_H
#define __EC_INCLUDE_TRNG_H
-#include <common.h>
#include <stddef.h>
#include <stdint.h>
+#include <common.h>
+
/**
* Initialize the true random number generator.
*
diff --git a/include/uart.h b/include/uart.h
index 5af95df98d..086c407695 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -8,10 +8,11 @@
#ifndef __CROS_EC_UART_H
#define __CROS_EC_UART_H
-#include <stdarg.h> /* For va_list */
#include "common.h"
#include "gpio_signal.h"
+#include <stdarg.h> /* For va_list */
+
/**
* Initialize the UART module.
*/
diff --git a/include/update_fw.h b/include/update_fw.h
index dc520c2eb9..a4f56942a7 100644
--- a/include/update_fw.h
+++ b/include/update_fw.h
@@ -6,10 +6,10 @@
#ifndef __CROS_EC_UPDATE_FW_H
#define __CROS_EC_UPDATE_FW_H
-#include <stddef.h>
-
#include "compile_time_macros.h"
+#include <stddef.h>
+
/*
* This file contains structures used to facilitate EC firmware updates
* over USB (and over TPM for cr50).
diff --git a/include/usb_dp_alt_mode.h b/include/usb_dp_alt_mode.h
index 1449b96313..275580b407 100644
--- a/include/usb_dp_alt_mode.h
+++ b/include/usb_dp_alt_mode.h
@@ -12,11 +12,11 @@
#ifndef __CROS_EC_USB_DP_ALT_MODE_H
#define __CROS_EC_USB_DP_ALT_MODE_H
-#include <stdint.h>
-
#include "tcpm/tcpm.h"
#include "usb_pd_dpm_sm.h"
+#include <stdint.h>
+
/*
* Initialize DP state for the specified port.
*
diff --git a/include/usb_mode.h b/include/usb_mode.h
index 4cf7710960..5c6f71b372 100644
--- a/include/usb_mode.h
+++ b/include/usb_mode.h
@@ -12,11 +12,11 @@
#ifndef __CROS_EC_USB_MODE_H
#define __CROS_EC_USB_MODE_H
-#include <stdint.h>
-
#include "tcpm/tcpm.h"
#include "usb_pd_tcpm.h"
+#include <stdint.h>
+
/*
* Initialize USB4 state for the specified port.
*
diff --git a/include/usb_pd.h b/include/usb_pd.h
index b2cadbc0d7..e4ab8f6432 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -8,14 +8,15 @@
#ifndef __CROS_EC_USB_PD_H
#define __CROS_EC_USB_PD_H
-#include <stdbool.h>
-#include <stdint.h>
#include "common.h"
#include "ec_commands.h"
#include "usb_pd_tbt.h"
#include "usb_pd_tcpm.h"
#include "usb_pd_vdo.h"
+#include <stdbool.h>
+#include <stdint.h>
+
/* PD Host command timeout */
#define PD_HOST_COMMAND_TIMEOUT_US SECOND
diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h
index a89030cdb7..7af0a570e4 100644
--- a/include/usb_pd_tcpc.h
+++ b/include/usb_pd_tcpc.h
@@ -8,9 +8,10 @@
#ifndef __CROS_EC_USB_PD_TCPC_H
#define __CROS_EC_USB_PD_TCPC_H
-#include <stdint.h>
#include "usb_pd_tcpm.h"
+#include <stdint.h>
+
/* If we are a TCPC but not a TCPM, then we implement the peripheral TCPCI */
#if defined(CONFIG_USB_PD_TCPC) && !defined(CONFIG_USB_PD_TCPM_STUB)
#define TCPCI_I2C_PERIPHERAL
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index f3f449721e..199682122c 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -8,12 +8,13 @@
#ifndef __CROS_EC_USB_PD_TCPM_H
#define __CROS_EC_USB_PD_TCPM_H
-#include <stdbool.h>
#include "common.h"
#include "compiler.h"
#include "ec_commands.h"
#include "i2c.h"
+#include <stdbool.h>
+
/* Time to wait for TCPC to complete transmit */
#define PD_T_TCPC_TX_TIMEOUT (100 * MSEC)
diff --git a/include/usb_pd_timer.h b/include/usb_pd_timer.h
index 439b30513d..687c980243 100644
--- a/include/usb_pd_timer.h
+++ b/include/usb_pd_timer.h
@@ -8,11 +8,11 @@
#ifndef __CROS_EC_USB_PD_TIMER_H
#define __CROS_EC_USB_PD_TIMER_H
-#include <stdbool.h>
-
#include "atomic.h"
#include "atomic_bit.h"
+#include <stdbool.h>
+
/*
* List of all timers that will be managed by usb_pd_timer
*/
diff --git a/include/usb_prl_sm.h b/include/usb_prl_sm.h
index 99b69f156f..5671f8300e 100644
--- a/include/usb_prl_sm.h
+++ b/include/usb_prl_sm.h
@@ -8,11 +8,10 @@
#ifndef __CROS_EC_USB_PRL_H
#define __CROS_EC_USB_PRL_H
#include "common.h"
+#include "timer.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "usb_sm.h"
-#include "timer.h"
-#include "usb_pd_tcpm.h"
/**
* Returns TX success time stamp.
diff --git a/include/usb_tbt_alt_mode.h b/include/usb_tbt_alt_mode.h
index b7d7baa6a2..ff2ad44ed0 100644
--- a/include/usb_tbt_alt_mode.h
+++ b/include/usb_tbt_alt_mode.h
@@ -11,12 +11,12 @@
#ifndef __CROS_EC_USB_TBT_ALT_MODE_H
#define __CROS_EC_USB_TBT_ALT_MODE_H
-#include <stdint.h>
-
#include "tcpm/tcpm.h"
#include "usb_pd_dpm_sm.h"
#include "usb_pd_tcpm.h"
+#include <stdint.h>
+
/*
* Initialize Thunderbolt state for the specified port.
*
diff --git a/include/usb_tc_sm.h b/include/usb_tc_sm.h
index ec6473edfd..009e5db089 100644
--- a/include/usb_tc_sm.h
+++ b/include/usb_tc_sm.h
@@ -8,9 +8,9 @@
#ifndef __CROS_EC_USB_TC_H
#define __CROS_EC_USB_TC_H
-#include "usb_sm.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_sm.h"
enum try_src_override_t {
TRY_SRC_OVERRIDE_OFF,
diff --git a/include/util.h b/include/util.h
index dc2e038705..9db98f2b3f 100644
--- a/include/util.h
+++ b/include/util.h
@@ -16,6 +16,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+
#include <strings.h>
#ifdef CONFIG_ZEPHYR
#include <zephyr/sys/util.h>
diff --git a/include/vb21_struct.h b/include/vb21_struct.h
index c8b49ac05e..b23eb0cd30 100644
--- a/include/vb21_struct.h
+++ b/include/vb21_struct.h
@@ -14,10 +14,10 @@
#ifndef VBOOT_REFERENCE_VB21_STRUCT_H_
#define VBOOT_REFERENCE_VB21_STRUCT_H_
-#include <stdint.h>
-
#include "2id.h"
+#include <stdint.h>
+
/*
* Magic numbers used by vb21_struct_common.magic.
*
diff --git a/include/vboot.h b/include/vboot.h
index 55359e8044..9a3013ebbc 100644
--- a/include/vboot.h
+++ b/include/vboot.h
@@ -7,11 +7,11 @@
#define __CROS_EC_INCLUDE_VBOOT_H
#include "common.h"
-#include "vb21_struct.h"
#include "rsa.h"
#include "sha256.h"
#include "stdbool.h"
#include "timer.h"
+#include "vb21_struct.h"
/**
* Validate key contents.
diff --git a/include/watchdog.h b/include/watchdog.h
index d6768425ce..5e6e5626e6 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_WATCHDOG_H
#define __CROS_EC_WATCHDOG_H
-#include <stdint.h>
-
#include "config.h"
+#include <stdint.h>
+
/**
* Initialize the watchdog.
*