summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-11-22 16:07:09 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-29 22:17:20 +0000
commit599c438e80c634a580c33bfb431472cf36c1cad5 (patch)
treec8758ac487b656e949d82d4ebacd5df1ef8d1714
parente6da633c3840a90479a01224fcde04135408c787 (diff)
downloadchrome-ec-599c438e80c634a580c33bfb431472cf36c1cad5.tar.gz
common: Sort header files
Sort all includes in common 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: I70c2ed7bb2ce50c968f3e2dbdc274de3a455129a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049889 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--common/accel_cal.c2
-rw-r--r--common/acpi.c2
-rw-r--r--common/base32.c2
-rw-r--r--common/base_state.c2
-rw-r--r--common/bluetooth_le.c4
-rw-r--r--common/btle_hci_controller.c4
-rw-r--r--common/btle_ll.c4
-rw-r--r--common/button.c2
-rw-r--r--common/charge_state_v2.c2
-rw-r--r--common/chargen.c4
-rw-r--r--common/charger.c2
-rw-r--r--common/chargesplash.c6
-rw-r--r--common/dps.c12
-rw-r--r--common/ec_ec_comm_server.c4
-rw-r--r--common/espi.c2
-rw-r--r--common/fmap.c4
-rw-r--r--common/fpsensor/fpsensor_crypto.c6
-rw-r--r--common/gesture.c2
-rw-r--r--common/gyro_cal.c1
-rw-r--r--common/i2c_controller.c9
-rw-r--r--common/i2c_controller_cros_ec.c9
-rw-r--r--common/i2c_hid_touchpad.c3
-rw-r--r--common/i2c_trace.c2
-rw-r--r--common/init_rom.c2
-rw-r--r--common/kasa.c1
-rw-r--r--common/keyboard_8042.c4
-rw-r--r--common/keyboard_8042_sharedlib.c4
-rw-r--r--common/keyboard_vivaldi.c7
-rw-r--r--common/led_policy_std.c6
-rw-r--r--common/lightbar.c2
-rw-r--r--common/mag_cal.c1
-rw-r--r--common/mkbp_event.c2
-rw-r--r--common/mock/charge_manager_mock.c4
-rw-r--r--common/mock/dp_alt_mode_mock.c2
-rw-r--r--common/mock/fp_sensor_mock.c4
-rw-r--r--common/mock/fpsensor_crypto_mock.c9
-rw-r--r--common/mock/fpsensor_state_mock.c6
-rw-r--r--common/mock/mkbp_events_mock.c4
-rw-r--r--common/mock/rollback_latest_mock.c6
-rw-r--r--common/mock/rollback_mock.c8
-rw-r--r--common/mock/usb_mux_mock.c4
-rw-r--r--common/mock/usb_pd_dpm_mock.c4
-rw-r--r--common/mock/usb_pe_sm_mock.c6
-rw-r--r--common/mock/usb_prl_mock.c9
-rw-r--r--common/mock/usb_tc_sm_mock.c4
-rw-r--r--common/motion_lid.c4
-rw-r--r--common/motion_sense.c8
-rw-r--r--common/motion_sense_fifo.c6
-rw-r--r--common/newton_fit.c3
-rw-r--r--common/online_calibration.c14
-rw-r--r--common/rgb_keyboard.c4
-rw-r--r--common/shmalloc.c4
-rw-r--r--common/spi/flash_reg/src/spi_flash_reg_test.c4
-rw-r--r--common/spi_flash.c4
-rw-r--r--common/spi_nor.c8
-rw-r--r--common/stillness_detector.c1
-rw-r--r--common/system.c2
-rw-r--r--common/test_util.c3
-rw-r--r--common/timer.c2
-rw-r--r--common/uart_buffering.c4
-rw-r--r--common/uart_hostcmd.c2
-rw-r--r--common/uart_printf.c4
-rw-r--r--common/uptime.c6
-rw-r--r--common/usb_common.c2
-rw-r--r--common/usb_host_command.c4
-rw-r--r--common/usb_i2c.c12
-rw-r--r--common/usb_pd_alt_mode_dfp.c2
-rw-r--r--common/usb_pd_console_cmd.c2
-rw-r--r--common/usb_pd_host_cmd.c6
-rw-r--r--common/usb_pd_pdo.c2
-rw-r--r--common/usb_pd_policy.c2
-rw-r--r--common/usb_pd_protocol.c4
-rw-r--r--common/usb_pd_tcpc.c2
-rw-r--r--common/usb_update.c2
-rw-r--r--common/usbc/dp_alt_mode.c5
-rw-r--r--common/usbc/tbt_alt_mode.c5
-rw-r--r--common/usbc/usb_mode.c5
-rw-r--r--common/usbc/usb_pd_console.c2
-rw-r--r--common/usbc/usb_pd_dpm.c4
-rw-r--r--common/usbc/usb_pd_host.c4
-rw-r--r--common/usbc/usb_pe_ctvpd_sm.c7
-rw-r--r--common/usbc/usb_pe_drp_sm.c10
-rw-r--r--common/usbc/usb_prl_sm.c6
-rw-r--r--common/usbc/usb_retimer_fw_update.c6
-rw-r--r--common/usbc/usb_tc_vpd_sm.c2
-rw-r--r--common/usbc/usbc_task.c7
-rw-r--r--common/usbc_intr_task.c4
-rw-r--r--common/vboot/efs2.c2
-rw-r--r--common/vboot/vboot.c4
-rw-r--r--common/vec3.c2
-rw-r--r--common/version.c3
-rw-r--r--include/mock/usb_prl_mock.h2
92 files changed, 200 insertions, 192 deletions
diff --git a/common/accel_cal.c b/common/accel_cal.c
index 0fe9fe7656..878f3b06fa 100644
--- a/common/accel_cal.c
+++ b/common/accel_cal.c
@@ -3,9 +3,9 @@
* found in the LICENSE file.
*/
+#include "accel_cal.h"
#include "common.h"
#include "console.h"
-#include "accel_cal.h"
#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ##args)
diff --git a/common/acpi.c b/common/acpi.c
index 6145cbc96a..5dd71d244e 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -18,8 +18,8 @@
#include "lpc.h"
#include "printf.h"
#include "pwm.h"
-#include "timer.h"
#include "tablet_mode.h"
+#include "timer.h"
#include "usb_charge.h"
#include "usb_common.h"
#include "util.h"
diff --git a/common/base32.c b/common/base32.c
index fc3fe3c8ae..e5c30c4d6f 100644
--- a/common/base32.c
+++ b/common/base32.c
@@ -5,8 +5,8 @@
/* Base-32 encoding/decoding */
-#include "common.h"
#include "base32.h"
+#include "common.h"
#include "util.h"
static const unsigned char crc5_table1[] = { 0x00, 0x0E, 0x1C, 0x12, 0x11, 0x1F,
diff --git a/common/base_state.c b/common/base_state.c
index f90a5e7ce5..7bbd14eb00 100644
--- a/common/base_state.c
+++ b/common/base_state.c
@@ -5,8 +5,8 @@
#include "base_state.h"
#include "console.h"
-#include "host_command.h"
#include "hooks.h"
+#include "host_command.h"
#define CPRINTS(format, args...) cprints(CC_MOTION_LID, format, ##args)
diff --git a/common/bluetooth_le.c b/common/bluetooth_le.c
index 3108553a8b..d102740293 100644
--- a/common/bluetooth_le.c
+++ b/common/bluetooth_le.c
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "builtin/assert.h"
#include "bluetooth_le.h"
-#include "util.h"
+#include "builtin/assert.h"
#include "console.h"
+#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_BLUETOOTH_LE, format, ##args)
diff --git a/common/btle_hci_controller.c b/common/btle_hci_controller.c
index a4dcadaccf..605b67945b 100644
--- a/common/btle_hci_controller.c
+++ b/common/btle_hci_controller.c
@@ -3,9 +3,9 @@
* found in the LICENSE file.
*/
-#include "btle_hci_int.h"
-#include "btle_hci2.h"
#include "bluetooth_le_ll.h"
+#include "btle_hci2.h"
+#include "btle_hci_int.h"
#include "console.h"
#ifdef CONFIG_BLUETOOTH_HCI_DEBUG
diff --git a/common/btle_ll.c b/common/btle_ll.c
index 71ca108565..eea9534fe3 100644
--- a/common/btle_ll.c
+++ b/common/btle_ll.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "bluetooth_le_ll.h"
#include "bluetooth_le.h"
+#include "bluetooth_le_ll.h"
#include "btle_hci_int.h"
-#include "util.h"
#include "console.h"
#include "radio.h"
#include "radio_test.h"
#include "task.h"
#include "timer.h"
+#include "util.h"
#ifdef CONFIG_BLUETOOTH_LL_DEBUG
diff --git a/common/button.c b/common/button.c
index aa7bcf6b4c..284d026285 100644
--- a/common/button.c
+++ b/common/button.c
@@ -12,8 +12,8 @@
#include "compile_time_macros.h"
#include "console.h"
#include "gpio.h"
-#include "host_command.h"
#include "hooks.h"
+#include "host_command.h"
#include "keyboard_protocol.h"
#include "led_common.h"
#include "mkbp_input_devices.h"
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 05c06cd77e..742c94bdb6 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -9,9 +9,9 @@
#include "battery_smart.h"
#include "builtin/assert.h"
#include "charge_manager.h"
-#include "charger_profile_override.h"
#include "charge_state.h"
#include "charger.h"
+#include "charger_profile_override.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
diff --git a/common/chargen.c b/common/chargen.c
index 9b2c23ed79..626e13e71f 100644
--- a/common/chargen.c
+++ b/common/chargen.c
@@ -6,13 +6,13 @@
#include "common.h"
#include "config.h"
#include "console.h"
+#include "hooks.h"
+#include "task.h"
#include "timer.h"
#include "uart.h"
#include "usb_console.h"
#include "util.h"
#include "watchdog.h"
-#include "hooks.h"
-#include "task.h"
#ifndef SECTION_IS_RO
diff --git a/common/charger.c b/common/charger.c
index caabd547c0..af9b246adb 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -12,10 +12,10 @@
#include "common.h"
#include "console.h"
#include "dptf.h"
+#include "hooks.h"
#include "host_command.h"
#include "printf.h"
#include "util.h"
-#include "hooks.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
diff --git a/common/chargesplash.c b/common/chargesplash.c
index 17da9a5c8c..c3d93cc47b 100644
--- a/common/chargesplash.c
+++ b/common/chargesplash.c
@@ -3,9 +3,6 @@
* found in the LICENSE file.
*/
-#include <stdbool.h>
-#include <string.h>
-
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -18,6 +15,9 @@
#include "timer.h"
#include "util.h"
+#include <stdbool.h>
+#include <string.h>
+
#define CPRINTS(format, args...) \
cprints(CC_USBCHARGE, "chargesplash: " format, ##args)
diff --git a/common/dps.c b/common/dps.c
index 1950b5a9bd..b0751acc39 100644
--- a/common/dps.c
+++ b/common/dps.c
@@ -5,16 +5,14 @@
* Dynamic PDO Selection.
*/
-#include <stdint.h>
-
-#include "dps.h"
#include "atomic.h"
#include "battery.h"
-#include "common.h"
-#include "console.h"
-#include "charger.h"
#include "charge_manager.h"
#include "charge_state.h"
+#include "charger.h"
+#include "common.h"
+#include "console.h"
+#include "dps.h"
#include "ec_commands.h"
#include "hooks.h"
#include "math_util.h"
@@ -24,6 +22,8 @@
#include "usb_pd.h"
#include "util.h"
+#include <stdint.h>
+
#define K_MORE_PWR 96
#define K_LESS_PWR 93
#define K_SAMPLE 1
diff --git a/common/ec_ec_comm_server.c b/common/ec_ec_comm_server.c
index 976c3d6996..174ac54757 100644
--- a/common/ec_ec_comm_server.c
+++ b/common/ec_ec_comm_server.c
@@ -5,16 +5,16 @@
* EC-EC communication, task and functions for server.
*/
-#include "common.h"
#include "battery.h"
#include "charge_state_v2.h"
+#include "common.h"
#include "console.h"
#include "crc8.h"
#include "ec_commands.h"
#include "ec_ec_comm_server.h"
#include "extpower.h"
-#include "hwtimer.h"
#include "hooks.h"
+#include "hwtimer.h"
#include "queue.h"
#include "queue_policies.h"
#include "system.h"
diff --git a/common/espi.c b/common/espi.c
index dfb1f90749..f57e13cf76 100644
--- a/common/espi.c
+++ b/common/espi.c
@@ -6,9 +6,9 @@
/* eSPI common functionality for Chrome EC */
#include "common.h"
+#include "espi.h"
#include "gpio.h"
#include "registers.h"
-#include "espi.h"
#include "timer.h"
#include "util.h"
diff --git a/common/fmap.c b/common/fmap.c
index 469fac0ceb..0fa77c47cd 100644
--- a/common/fmap.c
+++ b/common/fmap.c
@@ -4,13 +4,13 @@
* found in the LICENSE file.
*/
-#include <stddef.h>
-
#include "common.h"
#include "cros_version.h"
#include "rwsig.h"
#include "util.h"
+#include <stddef.h>
+
/*
* FMAP structs.
* See
diff --git a/common/fpsensor/fpsensor_crypto.c b/common/fpsensor/fpsensor_crypto.c
index 257042197e..aac50bb297 100644
--- a/common/fpsensor/fpsensor_crypto.c
+++ b/common/fpsensor/fpsensor_crypto.c
@@ -2,16 +2,16 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <stdbool.h>
-
-#include "aes.h"
#include "aes-gcm.h"
+#include "aes.h"
#include "cryptoc/util.h"
#include "fpsensor_crypto.h"
#include "fpsensor_private.h"
#include "fpsensor_state.h"
#include "rollback.h"
+#include <stdbool.h>
+
#if !defined(CONFIG_AES) || !defined(CONFIG_AES_GCM) || \
!defined(CONFIG_ROLLBACK_SECRET_SIZE)
#error "fpsensor requires AES, AES_GCM and ROLLBACK_SECRET_SIZE"
diff --git a/common/gesture.c b/common/gesture.c
index 99d054783d..48e6af3571 100644
--- a/common/gesture.c
+++ b/common/gesture.c
@@ -8,8 +8,8 @@
#include "accelgyro.h"
#include "common.h"
#include "console.h"
-#include "hooks.h"
#include "gesture.h"
+#include "hooks.h"
#include "lid_switch.h"
#include "lightbar.h"
#include "motion_sense.h"
diff --git a/common/gyro_cal.c b/common/gyro_cal.c
index 8996b85757..e2cb8d55db 100644
--- a/common/gyro_cal.c
+++ b/common/gyro_cal.c
@@ -5,6 +5,7 @@
#include "gyro_cal.h"
#include "string.h"
+
#include <stdbool.h>
/*
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index e938dc0f8f..96809ee84c 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -7,12 +7,12 @@
#include "battery.h"
#include "builtin/assert.h"
-#include "clock.h"
#include "charge_state.h"
+#include "clock.h"
#include "console.h"
#include "crc8.h"
-#include "host_command.h"
#include "gpio.h"
+#include "host_command.h"
#include "i2c.h"
#include "i2c_bitbang.h"
#include "i2c_private.h"
@@ -22,12 +22,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "util.h"
-#include "watchdog.h"
#include "virtual_battery.h"
+#include "watchdog.h"
#ifdef CONFIG_ZEPHYR
-#include <zephyr/drivers/i2c.h>
#include "i2c/i2c.h"
+
+#include <zephyr/drivers/i2c.h>
#endif /* CONFIG_ZEPHYR */
#define CPUTS(outstr) cputs(CC_I2C, outstr)
diff --git a/common/i2c_controller_cros_ec.c b/common/i2c_controller_cros_ec.c
index aafeb504ce..d68f67c60e 100644
--- a/common/i2c_controller_cros_ec.c
+++ b/common/i2c_controller_cros_ec.c
@@ -4,16 +4,15 @@
*/
#include "builtin/assert.h"
-#include "system.h"
+#include "console.h"
#include "gpio.h"
-
+#include "i2c.h"
#include "i2c_bitbang.h"
#include "i2c_private.h"
-#include "i2c.h"
-#include "console.h"
-#include "watchdog.h"
#include "printf.h"
+#include "system.h"
#include "util.h"
+#include "watchdog.h"
/* This source file contains I2C controller code that is used only in legacy
* (CrOS EC) builds.
diff --git a/common/i2c_hid_touchpad.c b/common/i2c_hid_touchpad.c
index 02261d8fa4..2664dabe3e 100644
--- a/common/i2c_hid_touchpad.c
+++ b/common/i2c_hid_touchpad.c
@@ -3,10 +3,9 @@
* found in the LICENSE file.
*/
-#include "i2c_hid_touchpad.h"
-
#include "console.h"
#include "hwtimer.h"
+#include "i2c_hid_touchpad.h"
#include "util.h"
/* 2 bytes for length + 1 byte for report ID */
diff --git a/common/i2c_trace.c b/common/i2c_trace.c
index e7dde79bc4..8532766ea8 100644
--- a/common/i2c_trace.c
+++ b/common/i2c_trace.c
@@ -6,8 +6,8 @@
#include "common.h"
#include "console.h"
#include "i2c.h"
-#include "stddef.h"
#include "stdbool.h"
+#include "stddef.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_I2C, outstr)
diff --git a/common/init_rom.c b/common/init_rom.c
index 102c3a00ae..ad9e80f423 100644
--- a/common/init_rom.c
+++ b/common/init_rom.c
@@ -7,8 +7,8 @@
#include "builtin/assert.h"
#include "common.h"
-#include "init_rom.h"
#include "flash.h"
+#include "init_rom.h"
#include "stdbool.h"
#include "stddef.h"
diff --git a/common/kasa.c b/common/kasa.c
index 6b974dc574..0ab716c729 100644
--- a/common/kasa.c
+++ b/common/kasa.c
@@ -6,6 +6,7 @@
#include "common.h"
#include "kasa.h"
#include "mat44.h"
+
#include <string.h>
void kasa_reset(struct kasa_fit *kasa)
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index ce27828e1d..6e2b14719f 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -5,8 +5,9 @@
* 8042 keyboard protocol
*/
-#include "button.h"
+#include "atkbd_protocol.h"
#include "builtin/assert.h"
+#include "button.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -14,7 +15,6 @@
#include "hooks.h"
#include "host_command.h"
#include "i8042_protocol.h"
-#include "atkbd_protocol.h"
#include "keyboard_8042_sharedlib.h"
#include "keyboard_config.h"
#include "keyboard_protocol.h"
diff --git a/common/keyboard_8042_sharedlib.c b/common/keyboard_8042_sharedlib.c
index 3e98c977b7..810f9873b3 100644
--- a/common/keyboard_8042_sharedlib.c
+++ b/common/keyboard_8042_sharedlib.c
@@ -5,8 +5,6 @@
* Objects which can be shared between RO and RW for 8042 keyboard protocol.
*/
-#include <stddef.h>
-
#include "builtin/assert.h"
#include "button.h"
#include "keyboard_8042_sharedlib.h"
@@ -15,6 +13,8 @@
#include "libsharedobjs.h"
#include "util.h"
+#include <stddef.h>
+
#ifndef CONFIG_KEYBOARD_CUSTOMIZATION
/* The standard Chrome OS keyboard matrix table in scan code set 2. */
static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
diff --git a/common/keyboard_vivaldi.c b/common/keyboard_vivaldi.c
index 11f5b708e6..44bbff2c11 100644
--- a/common/keyboard_vivaldi.c
+++ b/common/keyboard_vivaldi.c
@@ -6,13 +6,14 @@
/* Vivali Keyboard code for Chrome EC */
#include "builtin/assert.h"
-#include "keyboard_8042_sharedlib.h"
-#include "keyboard_scan.h"
#include "ec_commands.h"
#include "gpio.h"
+#include "keyboard_8042_sharedlib.h"
+#include "keyboard_scan.h"
+
+#include <hooks.h>
#include <host_command.h>
#include <util.h>
-#include <hooks.h>
/* Console output macros */
#define CPUTS(outstr) cputs(CC_KEYBOARD, outstr)
diff --git a/common/led_policy_std.c b/common/led_policy_std.c
index fe8570df87..b9d95af639 100644
--- a/common/led_policy_std.c
+++ b/common/led_policy_std.c
@@ -6,14 +6,14 @@
* This assumes a red/green battery led and a single power led.
*/
-#include "gpio.h"
-#include "hooks.h"
#include "battery.h"
#include "charge_state.h"
#include "chipset.h"
+#include "gpio.h"
+#include "hooks.h"
#include "led_common.h"
-#include "util.h"
#include "lid_switch.h"
+#include "util.h"
#ifdef CONFIG_LED_BAT_ACTIVE_LOW
#define BAT_LED_ON 0
diff --git a/common/lightbar.c b/common/lightbar.c
index 8a6a874b34..a705a2cbed 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -17,8 +17,8 @@
#include "hooks.h"
#include "host_command.h"
#include "lb_common.h"
-#include "lightbar.h"
#include "lid_switch.h"
+#include "lightbar.h"
#include "motion_sense.h"
#include "pwm.h"
#include "system.h"
diff --git a/common/mag_cal.c b/common/mag_cal.c
index a9ce95798c..2ad89c48df 100644
--- a/common/mag_cal.c
+++ b/common/mag_cal.c
@@ -8,7 +8,6 @@
#include "mag_cal.h"
#include "mat33.h"
#include "mat44.h"
-
#include "math.h"
#include "math_util.h"
#include "util.h"
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index 4282da95b9..eb57a11656 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -11,10 +11,10 @@
#include "host_command.h"
#include "host_command_heci.h"
#include "hwtimer.h"
-#include "timer.h"
#include "link_defs.h"
#include "mkbp_event.h"
#include "power.h"
+#include "timer.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_COMMAND, outstr)
diff --git a/common/mock/charge_manager_mock.c b/common/mock/charge_manager_mock.c
index c800b9b9b1..745b37efa7 100644
--- a/common/mock/charge_manager_mock.c
+++ b/common/mock/charge_manager_mock.c
@@ -8,12 +8,12 @@
* @brief Mock charge_manager
*/
-#include <stdlib.h>
-
#include "charge_manager.h"
#include "common.h"
#include "mock/charge_manager_mock.h"
+#include <stdlib.h>
+
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
#endif
diff --git a/common/mock/dp_alt_mode_mock.c b/common/mock/dp_alt_mode_mock.c
index e261415aaa..ed769ed4b5 100644
--- a/common/mock/dp_alt_mode_mock.c
+++ b/common/mock/dp_alt_mode_mock.c
@@ -10,8 +10,8 @@
*/
#include "console.h"
-#include "usb_dp_alt_mode.h"
#include "mock/dp_alt_mode_mock.h"
+#include "usb_dp_alt_mode.h"
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
diff --git a/common/mock/fp_sensor_mock.c b/common/mock/fp_sensor_mock.c
index 4db25a821c..57a4f42ae9 100644
--- a/common/mock/fp_sensor_mock.c
+++ b/common/mock/fp_sensor_mock.c
@@ -8,12 +8,12 @@
* @brief Mock fpsensor private driver
*/
-#include <stdlib.h>
-
#include "common.h"
#include "fpsensor.h"
#include "mock/fp_sensor_mock.h"
+#include <stdlib.h>
+
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
#endif
diff --git a/common/mock/fpsensor_crypto_mock.c b/common/mock/fpsensor_crypto_mock.c
index f2cc425c8f..334f98300a 100644
--- a/common/mock/fpsensor_crypto_mock.c
+++ b/common/mock/fpsensor_crypto_mock.c
@@ -7,16 +7,17 @@
* @file fpsensor_crypto_mock.c
* @brief Mock fpsensor_crypto library
*/
-#include "sha256.h"
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
#include "assert.h"
#include "compile_time_macros.h"
#include "console.h"
#include "ec_commands.h"
#include "fpsensor_private.h"
#include "mock/fpsensor_crypto_mock.h"
+#include "sha256.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
diff --git a/common/mock/fpsensor_state_mock.c b/common/mock/fpsensor_state_mock.c
index cbeb29ae3c..d71285c1de 100644
--- a/common/mock/fpsensor_state_mock.c
+++ b/common/mock/fpsensor_state_mock.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include <stddef.h>
-#include <string.h>
-
#include "common.h"
#include "driver/fingerprint/fpsensor.h"
#include "ec_commands.h"
#include "test_util.h"
+#include <stddef.h>
+#include <string.h>
+
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
#endif
diff --git a/common/mock/mkbp_events_mock.c b/common/mock/mkbp_events_mock.c
index 3f4d76b659..559cb1494d 100644
--- a/common/mock/mkbp_events_mock.c
+++ b/common/mock/mkbp_events_mock.c
@@ -8,11 +8,11 @@
* @brief Mock event handling for MKBP keyboard protocol
*/
-#include <stdint.h>
-
#include "common.h"
#include "mock/mkbp_events_mock.h"
+#include <stdint.h>
+
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
#endif
diff --git a/common/mock/rollback_latest_mock.c b/common/mock/rollback_latest_mock.c
index ab62645a1c..b3433246d7 100644
--- a/common/mock/rollback_latest_mock.c
+++ b/common/mock/rollback_latest_mock.c
@@ -8,13 +8,13 @@
* @brief Mock rollback block library
*/
-#include <string.h>
-
#include "common.h"
#include "compile_time_macros.h"
-#include "util.h"
#include "mock/rollback_latest_mock.h"
#include "rollback_private.h"
+#include "util.h"
+
+#include <string.h>
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
diff --git a/common/mock/rollback_mock.c b/common/mock/rollback_mock.c
index e68616df53..9395248a61 100644
--- a/common/mock/rollback_mock.c
+++ b/common/mock/rollback_mock.c
@@ -8,13 +8,13 @@
* @brief Mock rollback block library
*/
-#include <stdint.h>
-#include <string.h>
-
#include "common.h"
#include "compile_time_macros.h"
-#include "util.h"
#include "mock/rollback_mock.h"
+#include "util.h"
+
+#include <stdint.h>
+#include <string.h>
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
diff --git a/common/mock/usb_mux_mock.c b/common/mock/usb_mux_mock.c
index 815cdf777c..b612f47d4f 100644
--- a/common/mock/usb_mux_mock.c
+++ b/common/mock/usb_mux_mock.c
@@ -6,9 +6,9 @@
#include "common.h"
#include "console.h"
-#include "usb_mux.h"
-#include "mock/usb_mux_mock.h"
#include "memory.h"
+#include "mock/usb_mux_mock.h"
+#include "usb_mux.h"
#ifndef CONFIG_COMMON_RUNTIME
#define cprints(format, args...)
diff --git a/common/mock/usb_pd_dpm_mock.c b/common/mock/usb_pd_dpm_mock.c
index 03c18f37a1..66b7ccfc2b 100644
--- a/common/mock/usb_pd_dpm_mock.c
+++ b/common/mock/usb_pd_dpm_mock.c
@@ -8,9 +8,9 @@
* Refer to USB PD 3.0 spec, version 2.0, sections 8.2 and 8.3
*/
-#include "usb_pd.h"
-#include "mock/usb_pd_dpm_mock.h"
#include "memory.h"
+#include "mock/usb_pd_dpm_mock.h"
+#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#ifndef TEST_BUILD
diff --git a/common/mock/usb_pe_sm_mock.c b/common/mock/usb_pe_sm_mock.c
index 24861a73f9..38df938c46 100644
--- a/common/mock/usb_pe_sm_mock.c
+++ b/common/mock/usb_pe_sm_mock.c
@@ -7,11 +7,11 @@
#include "common.h"
#include "console.h"
-#include "usb_pd.h"
-#include "usb_pe_sm.h"
-#include "mock/usb_pe_sm_mock.h"
#include "memory.h"
+#include "mock/usb_pe_sm_mock.h"
+#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_pe_sm.h"
#ifndef CONFIG_COMMON_RUNTIME
#define cprints(format, args...)
diff --git a/common/mock/usb_prl_mock.c b/common/mock/usb_prl_mock.c
index df61cfaf95..769cd6073c 100644
--- a/common/mock/usb_prl_mock.c
+++ b/common/mock/usb_prl_mock.c
@@ -4,16 +4,17 @@
*
* Mock Protocol Layer module.
*/
-#include <string.h>
#include "common.h"
-#include "usb_emsg.h"
-#include "usb_pe_sm.h"
-#include "usb_prl_sm.h"
#include "mock/usb_prl_mock.h"
#include "task.h"
#include "test_util.h"
#include "timer.h"
+#include "usb_emsg.h"
#include "usb_pd_tcpm.h"
+#include "usb_pe_sm.h"
+#include "usb_prl_sm.h"
+
+#include <string.h>
#ifndef TEST_BUILD
#error "Mocks should only be in the test build."
diff --git a/common/mock/usb_tc_sm_mock.c b/common/mock/usb_tc_sm_mock.c
index 5badc6eba6..6adf6b3246 100644
--- a/common/mock/usb_tc_sm_mock.c
+++ b/common/mock/usb_tc_sm_mock.c
@@ -8,9 +8,9 @@
#include "common.h"
#include "console.h"
#include "ec_commands.h"
-#include "usb_tc_sm.h"
-#include "mock/usb_tc_sm_mock.h"
#include "memory.h"
+#include "mock/usb_tc_sm_mock.h"
+#include "usb_tc_sm.h"
#ifndef CONFIG_COMMON_RUNTIME
#define cprints(format, args...)
diff --git a/common/motion_lid.c b/common/motion_lid.c
index d8445bb3d4..878d471ed4 100644
--- a/common/motion_lid.c
+++ b/common/motion_lid.c
@@ -5,8 +5,8 @@
/* Motion sense module to read from various motion sensors. */
-#include "acpi.h"
#include "accelgyro.h"
+#include "acpi.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -20,8 +20,8 @@
#include "motion_sense.h"
#include "power.h"
#include "tablet_mode.h"
-#include "timer.h"
#include "task.h"
+#include "timer.h"
#include "util.h"
/* Console output macros */
diff --git a/common/motion_sense.c b/common/motion_sense.c
index a309d29f8c..0b72a69780 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -20,17 +20,17 @@
#include "lightbar.h"
#include "math_util.h"
#include "mkbp_event.h"
-#include "motion_sense.h"
-#include "motion_sense_fifo.h"
#include "motion_lid.h"
#include "motion_orientation.h"
+#include "motion_sense.h"
+#include "motion_sense_fifo.h"
#include "online_calibration.h"
-#include "printf.h"
#include "power.h"
+#include "printf.h"
#include "queue.h"
#include "tablet_mode.h"
-#include "timer.h"
#include "task.h"
+#include "timer.h"
#include "util.h"
/* Console output macros */
diff --git a/common/motion_sense_fifo.c b/common/motion_sense_fifo.c
index d3887fa08f..fd1bfda88c 100644
--- a/common/motion_sense_fifo.c
+++ b/common/motion_sense_fifo.c
@@ -6,14 +6,14 @@
#include "accelgyro.h"
#include "console.h"
#include "hwtimer.h"
+#include "math_util.h"
#include "mkbp_event.h"
#include "motion_sense_fifo.h"
+#include "online_calibration.h"
+#include "stdbool.h"
#include "tablet_mode.h"
#include "task.h"
#include "util.h"
-#include "math_util.h"
-#include "online_calibration.h"
-#include "stdbool.h"
#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ##args)
diff --git a/common/newton_fit.c b/common/newton_fit.c
index 5d217bc63d..3ba01dbd90 100644
--- a/common/newton_fit.c
+++ b/common/newton_fit.c
@@ -5,9 +5,10 @@
#include "common.h"
#include "console.h"
-#include "newton_fit.h"
#include "math.h"
#include "math_util.h"
+#include "newton_fit.h"
+
#include <string.h>
#define CPRINTS(fmt, args...) cprints(CC_MOTION_SENSE, fmt, ##args)
diff --git a/common/online_calibration.c b/common/online_calibration.c
index 2d79c6ae1d..a56aa0dce7 100644
--- a/common/online_calibration.c
+++ b/common/online_calibration.c
@@ -3,19 +3,19 @@
* found in the LICENSE file.
*/
+#include "accel_cal.h"
#include "accelgyro.h"
#include "atomic.h"
-#include "hwtimer.h"
-#include "online_calibration.h"
#include "common.h"
+#include "ec_commands.h"
+#include "gyro_cal.h"
+#include "hwtimer.h"
#include "mag_cal.h"
+#include "mkbp_event.h"
+#include "online_calibration.h"
+#include "task.h"
#include "util.h"
#include "vec3.h"
-#include "task.h"
-#include "ec_commands.h"
-#include "accel_cal.h"
-#include "mkbp_event.h"
-#include "gyro_cal.h"
#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ##args)
diff --git a/common/rgb_keyboard.c b/common/rgb_keyboard.c
index c0d4dd7f3c..0036cdcd16 100644
--- a/common/rgb_keyboard.c
+++ b/common/rgb_keyboard.c
@@ -2,8 +2,6 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <stdbool.h>
-
#include "atomic.h"
#include "common.h"
#include "console.h"
@@ -18,6 +16,8 @@
#include "timer.h"
#include "util.h"
+#include <stdbool.h>
+
/* Console output macros */
#define CPUTS(outstr) cputs(CC_RGBKBD, outstr)
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "RGBKBD: " fmt, ##args)
diff --git a/common/shmalloc.c b/common/shmalloc.c
index 6cbf213227..37b7b2c736 100644
--- a/common/shmalloc.c
+++ b/common/shmalloc.c
@@ -5,8 +5,6 @@
*/
/* Malloc/free memory module for Chrome EC */
-#include <stdint.h>
-
#include "common.h"
#include "hooks.h"
#include "link_defs.h"
@@ -15,6 +13,8 @@
#include "task.h"
#include "util.h"
+#include <stdint.h>
+
static struct mutex shmem_lock;
#ifndef TEST_SHMALLOC
diff --git a/common/spi/flash_reg/src/spi_flash_reg_test.c b/common/spi/flash_reg/src/spi_flash_reg_test.c
index 4a6a7a5edf..b9a45476b1 100644
--- a/common/spi/flash_reg/src/spi_flash_reg_test.c
+++ b/common/spi/flash_reg/src/spi_flash_reg_test.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
-#include <zephyr/ztest.h>
-
#include "common.h"
#include "spi_flash_reg.h"
+#include <zephyr/ztest.h>
+
ZTEST_SUITE(flash_reg_to_protect, NULL, NULL, NULL, NULL, NULL);
ZTEST(flash_reg_to_protect, test_invalid_args)
diff --git a/common/spi_flash.c b/common/spi_flash.c
index 8eaf3e8406..1540c7bb33 100644
--- a/common/spi_flash.c
+++ b/common/spi_flash.c
@@ -9,6 +9,8 @@
#include "builtin/assert.h"
#include "common.h"
#include "console.h"
+#include "ec_commands.h"
+#include "flash.h"
#include "host_command.h"
#include "shared_mem.h"
#include "spi.h"
@@ -17,8 +19,6 @@
#include "timer.h"
#include "util.h"
#include "watchdog.h"
-#include "ec_commands.h"
-#include "flash.h"
/*
* Time to sleep when chip is busy
diff --git a/common/spi_nor.c b/common/spi_nor.c
index 015cb7077c..1eca5d806f 100644
--- a/common/spi_nor.c
+++ b/common/spi_nor.c
@@ -7,13 +7,13 @@
#include "common.h"
#include "console.h"
-#include "spi_nor.h"
+#include "sfdp.h"
#include "shared_mem.h"
-#include "util.h"
-#include "task.h"
#include "spi.h"
-#include "sfdp.h"
+#include "spi_nor.h"
+#include "task.h"
#include "timer.h"
+#include "util.h"
#include "watchdog.h"
#ifdef CONFIG_SPI_NOR_DEBUG
diff --git a/common/stillness_detector.c b/common/stillness_detector.c
index c43e19873e..f81c51ef3a 100644
--- a/common/stillness_detector.c
+++ b/common/stillness_detector.c
@@ -6,6 +6,7 @@
#include "common.h"
#include "stillness_detector.h"
#include "timer.h"
+
#include <string.h>
static void still_det_reset(struct still_det *still_det)
diff --git a/common/system.c b/common/system.c
index af5d670216..e10712259c 100644
--- a/common/system.c
+++ b/common/system.c
@@ -27,6 +27,7 @@
#ifdef CONFIG_MPU
#include "mpu.h"
#endif
+#include "cros_version.h"
#include "panic.h"
#include "sysjump.h"
#include "system.h"
@@ -36,7 +37,6 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "util.h"
-#include "cros_version.h"
#include "watchdog.h"
/* Console output macros */
diff --git a/common/test_util.c b/common/test_util.c
index 659476fc17..fd8caba10a 100644
--- a/common/test_util.c
+++ b/common/test_util.c
@@ -11,7 +11,6 @@
#include <stdlib.h>
#endif
-#include <assert.h>
#include "console.h"
#include "hooks.h"
#include "host_command.h"
@@ -20,6 +19,8 @@
#include "test_util.h"
#include "util.h"
+#include <assert.h>
+
struct test_util_tag {
uint8_t error_count;
};
diff --git a/common/timer.c b/common/timer.c
index d0fd1eca6e..bf2a731a1d 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -12,9 +12,9 @@
#include "hooks.h"
#include "hwtimer.h"
#include "system.h"
-#include "util.h"
#include "task.h"
#include "timer.h"
+#include "util.h"
#include "watchdog.h"
#ifdef CONFIG_ZEPHYR
diff --git a/common/uart_buffering.c b/common/uart_buffering.c
index 1aa6e9ef35..f3d150dfda 100644
--- a/common/uart_buffering.c
+++ b/common/uart_buffering.c
@@ -5,8 +5,6 @@
/* Common code to do UART buffering and printing */
-#include <stdarg.h>
-
#include "common.h"
#include "console.h"
#include "hooks.h"
@@ -19,6 +17,8 @@
#include "uart.h"
#include "util.h"
+#include <stdarg.h>
+
/* Macros to advance in the circular buffers */
#define TX_BUF_NEXT(i) (((i) + 1) & (CONFIG_UART_TX_BUF_SIZE - 1))
#define RX_BUF_NEXT(i) (((i) + 1) & (CONFIG_UART_RX_BUF_SIZE - 1))
diff --git a/common/uart_hostcmd.c b/common/uart_hostcmd.c
index 7b4ff5b461..506a49221d 100644
--- a/common/uart_hostcmd.c
+++ b/common/uart_hostcmd.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "config.h"
#include "common.h"
+#include "config.h"
#include "ec_commands.h"
#include "host_command.h"
#include "uart.h"
diff --git a/common/uart_printf.c b/common/uart_printf.c
index a4fecf5c73..55b8a40cde 100644
--- a/common/uart_printf.c
+++ b/common/uart_printf.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include <stddef.h>
-
#include "common.h"
#include "printf.h"
#include "uart.h"
+#include <stddef.h>
+
static int __tx_char(void *context, int c)
{
/*
diff --git a/common/uptime.c b/common/uptime.c
index 3b2c68fd34..1ce7e2a329 100644
--- a/common/uptime.c
+++ b/common/uptime.c
@@ -2,13 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <stddef.h>
-
#include "chipset.h"
-#include "system.h"
#include "host_command.h"
+#include "system.h"
#include "util.h"
+#include <stddef.h>
+
static enum ec_status
host_command_get_uptime_info(struct host_cmd_handler_args *args)
{
diff --git a/common/usb_common.c b/common/usb_common.c
index 9d7159f81d..a92b1e380f 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -17,9 +17,9 @@
#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
+#include "host_command.h"
#include "mkbp_event.h"
#include "stdbool.h"
-#include "host_command.h"
#include "system.h"
#include "task.h"
#include "typec_control.h"
diff --git a/common/usb_host_command.c b/common/usb_host_command.c
index 83a6e24a7d..0aeff40d39 100644
--- a/common/usb_host_command.c
+++ b/common/usb_host_command.c
@@ -7,13 +7,13 @@
#include "console.h"
#include "consumer.h"
#include "ec_commands.h"
-#include "queue_policies.h"
#include "host_command.h"
#include "printf.h"
+#include "queue_policies.h"
#include "system.h"
+#include "usb-stream.h"
#include "usb_api.h"
#include "usb_hw.h"
-#include "usb-stream.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_USB, outstr)
diff --git a/common/usb_i2c.c b/common/usb_i2c.c
index 8482ec0967..b1cd45c76a 100644
--- a/common/usb_i2c.c
+++ b/common/usb_i2c.c
@@ -4,21 +4,19 @@
*/
#include "common.h"
-#include "link_defs.h"
-#include "registers.h"
-#include "i2c.h"
-#include "usb_descriptor.h"
-#include "util.h"
-
-#include "common.h"
#include "console.h"
#include "consumer.h"
+#include "i2c.h"
+#include "link_defs.h"
#include "producer.h"
#include "queue.h"
#include "queue_policies.h"
+#include "registers.h"
#include "task.h"
#include "usb-stream.h"
+#include "usb_descriptor.h"
#include "usb_i2c.h"
+#include "util.h"
#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index dc8543c920..6df0215274 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -13,8 +13,8 @@
#include "task_id.h"
#include "timer.h"
#include "typec_control.h"
-#include "usb_common.h"
#include "usb_charge.h"
+#include "usb_common.h"
#include "usb_dp_alt_mode.h"
#include "usb_mux.h"
#include "usb_pd.h"
diff --git a/common/usb_pd_console_cmd.c b/common/usb_pd_console_cmd.c
index 23f2a27b1e..5a1afe88a5 100644
--- a/common/usb_pd_console_cmd.c
+++ b/common/usb_pd_console_cmd.c
@@ -7,8 +7,8 @@
#include "console.h"
#include "usb_pd.h"
-#include "util.h"
#include "usb_pd_tcpm.h"
+#include "util.h"
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
#ifdef CONFIG_CMD_USB_PD_PE
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index e3008d26fb..ea05de3457 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -5,8 +5,6 @@
* Host commands for USB-PD module.
*/
-#include <string.h>
-
#include "atomic.h"
#include "battery.h"
#include "charge_manager.h"
@@ -17,8 +15,10 @@
#include "tcpm/tcpm.h"
#include "usb_common.h"
#include "usb_mux.h"
-#include "usb_pd_tcpm.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
+
+#include <string.h>
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/usb_pd_pdo.c b/common/usb_pd_pdo.c
index 3141af34a9..66f5f3feac 100644
--- a/common/usb_pd_pdo.c
+++ b/common/usb_pd_pdo.c
@@ -4,8 +4,8 @@
*/
#include "usb_pd.h"
-#include "util.h"
#include "usb_pd_pdo.h"
+#include "util.h"
#ifndef CONFIG_USB_PD_CUSTOM_PDO
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index c63cde6301..036e253766 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -22,13 +22,13 @@
#include "task.h"
#include "tcpm/tcpm.h"
#include "timer.h"
-#include "util.h"
#include "usb_api.h"
#include "usb_common.h"
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
+#include "util.h"
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 6ad8f7a9f8..c946f417f8 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -26,16 +26,16 @@
#include "tcpm/tcpm.h"
#include "timer.h"
#include "typec_control.h"
-#include "util.h"
#include "usb_charge.h"
#include "usb_common.h"
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_flags.h"
-#include "usb_pd_tcpm.h"
#include "usb_pd_tcpc.h"
+#include "usb_pd_tcpm.h"
#include "usbc_ocp.h"
#include "usbc_ppc.h"
+#include "util.h"
#include "vboot.h"
/* Flags to clear on a disconnect */
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index c8010a5005..a9a4d1d5a5 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -18,10 +18,10 @@
#include "tcpm/tcpci.h"
#include "tcpm/tcpm.h"
#include "timer.h"
-#include "util.h"
#include "usb_pd.h"
#include "usb_pd_config.h"
#include "usb_pd_tcpm.h"
+#include "util.h"
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
diff --git a/common/usb_update.c b/common/usb_update.c
index 444a4d6949..2e9a681fed 100644
--- a/common/usb_update.c
+++ b/common/usb_update.c
@@ -9,8 +9,8 @@
#include "consumer.h"
#include "curve25519.h"
#include "flash.h"
-#include "queue_policies.h"
#include "host_command.h"
+#include "queue_policies.h"
#include "rollback.h"
#include "rwsig.h"
#include "sha256.h"
diff --git a/common/usbc/dp_alt_mode.c b/common/usbc/dp_alt_mode.c
index 1fb99fd797..22975aff5b 100644
--- a/common/usbc/dp_alt_mode.c
+++ b/common/usbc/dp_alt_mode.c
@@ -9,8 +9,6 @@
* section 5.2
*/
-#include <stdbool.h>
-#include <stdint.h>
#include "atomic.h"
#include "builtin/assert.h"
#include "console.h"
@@ -19,6 +17,9 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include <stdbool.h>
+#include <stdint.h>
+
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c
index c0e4e172cc..fec1ee9de3 100644
--- a/common/usbc/tbt_alt_mode.c
+++ b/common/usbc/tbt_alt_mode.c
@@ -9,8 +9,6 @@
*/
#include "atomic.h"
-#include <stdbool.h>
-#include <stdint.h>
#include "compile_time_macros.h"
#include "console.h"
#include "tcpm/tcpm.h"
@@ -23,6 +21,9 @@
#include "usb_pe_sm.h"
#include "usb_tbt_alt_mode.h"
+#include <stdbool.h>
+#include <stdint.h>
+
/*
* Enter/Exit TBT mode with active cable
*
diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c
index f9b50c8fae..017f89fc74 100644
--- a/common/usbc/usb_mode.c
+++ b/common/usbc/usb_mode.c
@@ -9,8 +9,6 @@
* USB Power Delivery Specification Revision 3.0, Version 2.0 Section 6.4.8
*/
-#include <stdbool.h>
-#include <stdint.h>
#include "compile_time_macros.h"
#include "console.h"
#include "tcpm/tcpm.h"
@@ -25,6 +23,9 @@
#include "usb_tbt_alt_mode.h"
#include "usbc_ppc.h"
+#include <stdbool.h>
+#include <stdint.h>
+
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/usbc/usb_pd_console.c b/common/usbc/usb_pd_console.c
index 50f8fa8eb9..ed3d687ef4 100644
--- a/common/usbc/usb_pd_console.c
+++ b/common/usbc/usb_pd_console.c
@@ -6,12 +6,12 @@
#include "common.h"
#include "console.h"
#include "usb_common.h"
+#include "usb_pd.h"
#include "usb_pd_dpm_sm.h"
#include "usb_pd_timer.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
#include "usb_tc_sm.h"
-#include "usb_pd.h"
#include "util.h"
#ifndef TEST_USB_PD_CONSOLE
diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c
index 9455610ea0..775ea0da46 100644
--- a/common/usbc/usb_pd_dpm.c
+++ b/common/usbc/usb_pd_dpm.c
@@ -25,13 +25,13 @@
#include "usb_mode.h"
#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_pd_dpm_sm.h"
#include "usb_pd_pdo.h"
#include "usb_pd_tcpm.h"
#include "usb_pd_timer.h"
#include "usb_pe_sm.h"
-#include "usb_pd_dpm_sm.h"
-#include "usb_tc_sm.h"
#include "usb_tbt_alt_mode.h"
+#include "usb_tc_sm.h"
#ifdef CONFIG_ZEPHYR
#include "temp_sensor/temp_sensor.h"
diff --git a/common/usbc/usb_pd_host.c b/common/usbc/usb_pd_host.c
index 93a8e573a0..0b3958cd47 100644
--- a/common/usbc/usb_pd_host.c
+++ b/common/usbc/usb_pd_host.c
@@ -5,8 +5,6 @@
* Host commands for TCPMv2 USB PD module
*/
-#include <string.h>
-
#include "console.h"
#include "ec_commands.h"
#include "host_command.h"
@@ -16,6 +14,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
+#include <string.h>
+
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/usbc/usb_pe_ctvpd_sm.c b/common/usbc/usb_pe_ctvpd_sm.c
index dbd32a6b7d..223c40c71d 100644
--- a/common/usbc/usb_pe_ctvpd_sm.c
+++ b/common/usbc/usb_pe_ctvpd_sm.c
@@ -6,15 +6,14 @@
#include "common.h"
#include "console.h"
#include "task.h"
-#include "util.h"
+#include "usb_emsg.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
-#include "usb_pd_tcpm.h"
-#include "usb_tc_sm.h"
-#include "usb_emsg.h"
#include "usb_sm.h"
+#include "usb_tc_sm.h"
+#include "util.h"
/* USB Policy Engine Charge-Through VCONN Powered Device module */
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 5219b9b418..0de098788a 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -21,25 +21,25 @@
#include "system.h"
#include "task.h"
#include "tcpm/tcpm.h"
-#include "util.h"
#include "usb_charge.h"
#include "usb_common.h"
#include "usb_dp_alt_mode.h"
+#include "usb_emsg.h"
#include "usb_mode.h"
#include "usb_mux.h"
+#include "usb_pd.h"
#include "usb_pd_dpm_sm.h"
#include "usb_pd_policy.h"
-#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "usb_pd_timer.h"
#include "usb_pe_private.h"
#include "usb_pe_sm.h"
-#include "usb_tbt_alt_mode.h"
#include "usb_prl_sm.h"
-#include "usb_tc_sm.h"
-#include "usb_emsg.h"
#include "usb_sm.h"
+#include "usb_tbt_alt_mode.h"
+#include "usb_tc_sm.h"
#include "usbc_ppc.h"
+#include "util.h"
/*
* USB Policy Engine Sink / Source module
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index db9f460e61..5c17459834 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -20,16 +20,16 @@
#include "system.h"
#include "task.h"
#include "tcpm/tcpm.h"
-#include "util.h"
#include "usb_charge.h"
+#include "usb_emsg.h"
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_timer.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
-#include "usb_tc_sm.h"
-#include "usb_emsg.h"
#include "usb_sm.h"
+#include "usb_tc_sm.h"
+#include "util.h"
#include "vpd_api.h"
#ifdef CONFIG_COMMON_RUNTIME
diff --git a/common/usbc/usb_retimer_fw_update.c b/common/usbc/usb_retimer_fw_update.c
index 9b581ea872..a8cabf00a2 100644
--- a/common/usbc/usb_retimer_fw_update.c
+++ b/common/usbc/usb_retimer_fw_update.c
@@ -3,9 +3,6 @@
* found in the LICENSE file.
*/
-#include <stdbool.h>
-#include <stdint.h>
-
#include "builtin/assert.h"
#include "compile_time_macros.h"
#include "console.h"
@@ -15,6 +12,9 @@
#include "usb_mux.h"
#include "usb_tc_sm.h"
+#include <stdbool.h>
+#include <stdint.h>
+
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
diff --git a/common/usbc/usb_tc_vpd_sm.c b/common/usbc/usb_tc_vpd_sm.c
index 40b855db9b..1a820c4003 100644
--- a/common/usbc/usb_tc_vpd_sm.c
+++ b/common/usbc/usb_tc_vpd_sm.c
@@ -11,8 +11,8 @@
#include "tcpm/tcpm.h"
#include "typec_control.h"
#include "usb_pd.h"
-#include "usb_tc_sm.h"
#include "usb_sm.h"
+#include "usb_tc_sm.h"
#include "vpd_api.h"
/* USB Type-C VCONN Powered Device module */
diff --git a/common/usbc/usbc_task.c b/common/usbc/usbc_task.c
index ae5b401283..5d68221b3e 100644
--- a/common/usbc/usbc_task.c
+++ b/common/usbc/usbc_task.c
@@ -19,20 +19,19 @@
#include "registers.h"
#include "system.h"
#include "task.h"
+#include "tcpm/tcpm.h"
#include "timer.h"
-#include "util.h"
#include "usb_charge.h"
#include "usb_mux.h"
#include "usb_pd.h"
-#include "usb_pd_timer.h"
-#include "usb_prl_sm.h"
-#include "tcpm/tcpm.h"
#include "usb_pd_dpm_sm.h"
+#include "usb_pd_timer.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
#include "usb_sm.h"
#include "usb_tc_sm.h"
#include "usbc_ppc.h"
+#include "util.h"
#define USBC_EVENT_TIMEOUT (5 * MSEC)
#define USBC_MIN_EVENT_TIMEOUT (1 * MSEC)
diff --git a/common/usbc_intr_task.c b/common/usbc_intr_task.c
index 6c724c1279..d1d25c6b68 100644
--- a/common/usbc_intr_task.c
+++ b/common/usbc_intr_task.c
@@ -5,8 +5,6 @@
/* High-priority interrupt tasks implementations */
-#include <stdint.h>
-
#include "builtin/assert.h"
#include "common.h"
#include "compile_time_macros.h"
@@ -18,6 +16,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include <stdint.h>
+
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c
index b45109029d..3346a2c76b 100644
--- a/common/vboot/efs2.c
+++ b/common/vboot/efs2.c
@@ -21,8 +21,8 @@
#include "sha256.h"
#include "system.h"
#include "task.h"
-#include "usb_pd.h"
#include "uart.h"
+#include "usb_pd.h"
#include "vboot.h"
#include "vboot_hash.h"
diff --git a/common/vboot/vboot.c b/common/vboot/vboot.c
index cf449da1b8..162b396ba5 100644
--- a/common/vboot/vboot.c
+++ b/common/vboot/vboot.c
@@ -17,13 +17,13 @@
#include "host_command.h"
#include "rsa.h"
#include "rwsig.h"
-#include "stdbool.h"
#include "sha256.h"
#include "shared_mem.h"
+#include "stdbool.h"
#include "system.h"
#include "usb_pd.h"
-#include "vboot.h"
#include "vb21_struct.h"
+#include "vboot.h"
#define CPRINTS(format, args...) cprints(CC_VBOOT, "VB " format, ##args)
#define CPRINTF(format, args...) cprintf(CC_VBOOT, "VB " format, ##args)
diff --git a/common/vec3.c b/common/vec3.c
index 67a6049dea..4cf26ebf4c 100644
--- a/common/vec3.c
+++ b/common/vec3.c
@@ -6,8 +6,8 @@
#include "common.h"
#include "math.h"
#include "math_util.h"
-#include "vec3.h"
#include "util.h"
+#include "vec3.h"
static fpv3_t zero_initialized_vector = { FLOAT_TO_FP(0.0f), FLOAT_TO_FP(0.0f),
FLOAT_TO_FP(0.0f) };
diff --git a/common/version.c b/common/version.c
index 8b1ac5e53d..fe082abbe0 100644
--- a/common/version.c
+++ b/common/version.c
@@ -5,7 +5,6 @@
/* Embed firmware version number in the binary */
-#include <stdint.h>
#include "common.h"
#include "compile_time_macros.h"
#include "cros_version.h"
@@ -14,6 +13,8 @@
#include "stddef.h"
#include "system.h"
+#include <stdint.h>
+
BUILD_ASSERT(CONFIG_ROLLBACK_VERSION >= 0);
BUILD_ASSERT(CONFIG_ROLLBACK_VERSION <= INT32_MAX);
diff --git a/include/mock/usb_prl_mock.h b/include/mock/usb_prl_mock.h
index eef1d8de63..7758700d3a 100644
--- a/include/mock/usb_prl_mock.h
+++ b/include/mock/usb_prl_mock.h
@@ -9,7 +9,9 @@
#include "common.h"
#include "usb_emsg.h"
+#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_pe_sm.h"
void mock_prl_reset(void);