diff options
author | Tom Hughes <tomhughes@chromium.org> | 2023-03-14 11:02:39 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-16 01:01:01 +0000 |
commit | 7a9f47487c41d15b3f8aeb4372afc36fc0dfceae (patch) | |
tree | 11379a82a539f3308fe664a10b47b92d51d649b1 | |
parent | d826a966469853fc37d9b844b00c7ad680deaad9 (diff) | |
download | chrome-ec-7a9f47487c41d15b3f8aeb4372afc36fc0dfceae.tar.gz |
tree: Run clang-format on C++ files
BRANCH=none
BUG=none
TEST=CQ passes
Change-Id: I4e359ebbfacfa10239e991ee89da82db5161ef20
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338476
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r-- | test/aes.cc | 2 | ||||
-rw-r--r-- | test/rng_benchmark.cc | 2 | ||||
-rw-r--r-- | util/comm-dev.cc | 15 | ||||
-rw-r--r-- | util/comm-host.cc | 10 | ||||
-rw-r--r-- | util/comm-i2c.cc | 13 | ||||
-rw-r--r-- | util/comm-lpc.cc | 5 | ||||
-rw-r--r-- | util/comm-servo-spi.cc | 8 | ||||
-rw-r--r-- | util/comm-usb.cc | 15 | ||||
-rw-r--r-- | util/ec_flash.cc | 8 | ||||
-rw-r--r-- | util/ec_parse_panicinfo.cc | 3 | ||||
-rw-r--r-- | util/ec_sb_firmware_update.cc | 17 | ||||
-rw-r--r-- | util/ectool.cc | 46 | ||||
-rw-r--r-- | util/ectool_i2c.cc | 7 | ||||
-rw-r--r-- | util/ectool_keyscan.cc | 15 | ||||
-rw-r--r-- | util/lbcc.cc | 11 | ||||
-rw-r--r-- | util/lbplay.cc | 3 | ||||
-rw-r--r-- | util/lock/android.cc | 4 | ||||
-rw-r--r-- | util/lock/file_lock.cc | 15 | ||||
-rw-r--r-- | util/misc_util.cc | 7 | ||||
-rw-r--r-- | util/powerd_lock.cc | 5 | ||||
-rw-r--r-- | util/stm32mon.cc | 21 | ||||
-rw-r--r-- | util/uut/cmd.cc | 8 | ||||
-rw-r--r-- | util/uut/l_com_port.cc | 11 | ||||
-rw-r--r-- | util/uut/main.cc | 15 | ||||
-rw-r--r-- | util/uut/opr.cc | 13 | ||||
-rw-r--r-- | zephyr/test/uart_printf/src/fakes.cc | 6 | ||||
-rw-r--r-- | zephyr/test/uart_printf/src/main.cc | 10 |
27 files changed, 156 insertions, 139 deletions
diff --git a/test/aes.cc b/test/aes.cc index 6986abd148..d08679d489 100644 --- a/test/aes.cc +++ b/test/aes.cc @@ -19,8 +19,8 @@ #include "test_util.h" extern "C" { -#include "aes.h" #include "aes-gcm.h" +#include "aes.h" #include "builtin/assert.h" #include "console.h" #include "timer.h" diff --git a/test/rng_benchmark.cc b/test/rng_benchmark.cc index 2e47b8ea27..c086ff2cb0 100644 --- a/test/rng_benchmark.cc +++ b/test/rng_benchmark.cc @@ -7,8 +7,8 @@ */ #include "benchmark.h" - #include "console.h" + #include <array> #include <cstdint> #include <cstdlib> diff --git a/util/comm-dev.cc b/util/comm-dev.cc index bbb79a448c..1c546abe19 100644 --- a/util/comm-dev.cc +++ b/util/comm-dev.cc @@ -3,24 +3,25 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "cros_ec_dev.h" +#include "ec_commands.h" +#include "misc_util.h" + #include <assert.h> #include <errno.h> -#include <fcntl.h> -#include <poll.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + +#include <fcntl.h> +#include <poll.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#include "cros_ec_dev.h" -#include "comm-host.h" -#include "ec_commands.h" -#include "misc_util.h" - static int fd = -1; #ifndef ARRAY_SIZE diff --git a/util/comm-host.cc b/util/comm-host.cc index 914e6d27e8..ef8b9f1125 100644 --- a/util/comm-host.cc +++ b/util/comm-host.cc @@ -3,6 +3,11 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "cros_ec_dev.h" +#include "ec_commands.h" +#include "misc_util.h" + #include <errno.h> #include <stdbool.h> #include <stdint.h> @@ -10,11 +15,6 @@ #include <stdlib.h> #include <string.h> -#include "comm-host.h" -#include "cros_ec_dev.h" -#include "ec_commands.h" -#include "misc_util.h" - int (*ec_command_proto)(int command, int version, const void *outdata, int outsize, void *indata, int insize); diff --git a/util/comm-i2c.cc b/util/comm-i2c.cc index 1548beaaa2..9b5d6e958c 100644 --- a/util/comm-i2c.cc +++ b/util/comm-i2c.cc @@ -7,22 +7,23 @@ #define _GNU_SOURCE /* for asprintf */ #endif +#include "comm-host.h" +#include "i2c.h" + #include <errno.h> -#include <fcntl.h> -#include <linux/i2c.h> -#include <linux/i2c-dev.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + +#include <fcntl.h> +#include <linux/i2c-dev.h> +#include <linux/i2c.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#include "comm-host.h" -#include "i2c.h" - #define EC_I2C_ADDR 0x1e #define I2C_ADAPTER_NODE "/sys/class/i2c-adapter/i2c-%d/%d-%04x/name" diff --git a/util/comm-lpc.cc b/util/comm-lpc.cc index 8e2042f0cc..a7d22d9a21 100644 --- a/util/comm-lpc.cc +++ b/util/comm-lpc.cc @@ -6,14 +6,15 @@ /* The I/O asm funcs exist only on x86. */ #if defined(__i386__) || defined(__x86_64__) +#include "comm-host.h" + #include <stdint.h> #include <stdio.h> + #include <sys/io.h> #include <sys/param.h> #include <unistd.h> -#include "comm-host.h" - #define INITIAL_UDELAY 5 /* 5 us */ #define MAXIMUM_UDELAY 10000 /* 10 ms */ diff --git a/util/comm-servo-spi.cc b/util/comm-servo-spi.cc index 170b1e4e40..a476f7d570 100644 --- a/util/comm-servo-spi.cc +++ b/util/comm-servo-spi.cc @@ -15,18 +15,18 @@ * sudo ectool_servo --name=905537-00474 version */ +#include "comm-host.h" +#include "cros_ec_dev.h" + #include <errno.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> -#include <unistd.h> #include <libftdi1/ftdi.h> - -#include "comm-host.h" -#include "cros_ec_dev.h" +#include <unistd.h> /* Servo V2 SPI1 interface identifiers */ #define SERVO_V2_USB_VID 0x18d1 diff --git a/util/comm-usb.cc b/util/comm-usb.cc index 3d481b5532..64a2507b2e 100644 --- a/util/comm-usb.cc +++ b/util/comm-usb.cc @@ -3,19 +3,20 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "comm-usb.h" +#include "ec_commands.h" +#include "misc_util.h" +#include "usb_descriptor.h" + #include <assert.h> -#include <endian.h> #include <errno.h> -#include <libusb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "comm-host.h" -#include "comm-usb.h" -#include "ec_commands.h" -#include "misc_util.h" -#include "usb_descriptor.h" +#include <endian.h> +#include <libusb.h> #define USB_ERROR(m, r) print_libusb_error(__FILE__, __LINE__, m, r) diff --git a/util/ec_flash.cc b/util/ec_flash.cc index 6579975127..9bab0a431b 100644 --- a/util/ec_flash.cc +++ b/util/ec_flash.cc @@ -3,6 +3,10 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "misc_util.h" +#include "timer.h" + #include <errno.h> #include <stdint.h> #include <stdio.h> @@ -12,10 +16,6 @@ #include <chrono> #include <thread> -#include "comm-host.h" -#include "misc_util.h" -#include "timer.h" - static const auto ERASE_ASYNC_TIMEOUT = std::chrono::seconds(10); static const auto ERASE_ASYNC_WAIT_MS = std::chrono::milliseconds(500); static const int FLASH_ERASE_BUSY_RV = -EECRESULT - EC_RES_BUSY; diff --git a/util/ec_parse_panicinfo.cc b/util/ec_parse_panicinfo.cc index 1937d9a7a4..eb8ab2a24c 100644 --- a/util/ec_parse_panicinfo.cc +++ b/util/ec_parse_panicinfo.cc @@ -5,9 +5,10 @@ * Standalone utility to parse EC panicinfo. */ +#include "compile_time_macros.h" + #include <stdint.h> #include <stdio.h> -#include "compile_time_macros.h" #include <libec/ec_panicinfo.h> diff --git a/util/ec_sb_firmware_update.cc b/util/ec_sb_firmware_update.cc index a2fb70d2a3..8cf7db54a5 100644 --- a/util/ec_sb_firmware_update.cc +++ b/util/ec_sb_firmware_update.cc @@ -3,21 +3,22 @@ * found in the LICENSE file. */ -#include <errno.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - #include "comm-host.h" #include "compile_time_macros.h" -#include "ec_sb_firmware_update.h" #include "ec_commands.h" +#include "ec_sb_firmware_update.h" #include "lock/gec_lock.h" #include "misc_util.h" #include "powerd_lock.h" +#include <errno.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <unistd.h> + /* Subcommands: [check|update] */ enum { OP_UNKNOWN = 0, diff --git a/util/ectool.cc b/util/ectool.cc index 240760a9cf..5ecaef91ec 100644 --- a/util/ectool.cc +++ b/util/ectool.cc @@ -3,29 +3,15 @@ * found in the LICENSE file. */ -#include <assert.h> -#include <ctype.h> -#include <errno.h> -#include <getopt.h> -#include <inttypes.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <vector> -#include <signal.h> -#include <stdbool.h> - #include "battery.h" +#include "chipset.h" #include "comm-host.h" #include "comm-usb.h" -#include "chipset.h" #include "compile_time_macros.h" #include "crc.h" #include "cros_ec_dev.h" #include "ec_flash.h" +#include "ec_panicinfo.h" #include "ec_version.h" #include "ectool.h" #include "i2c.h" @@ -36,10 +22,25 @@ #include "tablet_mode.h" #include "usb_pd.h" +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <inttypes.h> +#include <signal.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include <getopt.h> #include <libec/add_entropy_command.h> #include <libec/ec_panicinfo.h> #include <libec/fingerprint/fp_encryption_status_command.h> #include <libec/rand_num_command.h> +#include <unistd.h> +#include <vector> /* Maximum flash size (16 MB, conservative) */ #define MAX_FLASH_SIZE 0x1000000 @@ -3248,7 +3249,7 @@ static int cmd_temperature_print(int id, int mtemp) printf("%-20s %d K (= %d C)", temp_r.sensor_name, temp, K_TO_C(temp)); - if(rc >= 0) + if (rc >= 0) /* * Check for fan_off == fan_max when their * values are either zero or non-zero @@ -7639,22 +7640,21 @@ int cmd_charge_current_limit(int argc, char *argv[]) struct ec_params_current_limit p0; p0.limit = limit; - return ec_command(EC_CMD_CHARGE_CURRENT_LIMIT, 0, - &p0, sizeof(p0), NULL, 0); + return ec_command(EC_CMD_CHARGE_CURRENT_LIMIT, 0, &p0, + sizeof(p0), NULL, 0); } /* argc==3 for battery_soc */ battery_soc = strtol(argv[2], &e, 0); if (e && *e) { - fprintf(stderr, "ERROR: Bad battery SoC value: %s\n", - argv[2]); + fprintf(stderr, "ERROR: Bad battery SoC value: %s\n", argv[2]); return -1; } p1.limit = limit; p1.battery_soc = battery_soc; - return ec_command(EC_CMD_CHARGE_CURRENT_LIMIT, 1, - &p1, sizeof(p1), NULL, 0); + return ec_command(EC_CMD_CHARGE_CURRENT_LIMIT, 1, &p1, sizeof(p1), NULL, + 0); } static void cmd_charge_control_help(const char *cmd, const char *msg) diff --git a/util/ectool_i2c.cc b/util/ectool_i2c.cc index efe2b723a2..1ed4576127 100644 --- a/util/ectool_i2c.cc +++ b/util/ectool_i2c.cc @@ -3,15 +3,16 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "ectool.h" + #include <ctype.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <endian.h> -#include "comm-host.h" -#include "ectool.h" +#include <endian.h> int cmd_i2c_protect(int argc, char *argv[]) { diff --git a/util/ectool_keyscan.cc b/util/ectool_keyscan.cc index 796e197a9a..8166703a07 100644 --- a/util/ectool_keyscan.cc +++ b/util/ectool_keyscan.cc @@ -3,18 +3,19 @@ * found in the LICENSE file. */ -#include <fcntl.h> +#include "comm-host.h" +#include "ectool.h" +#include "keyboard_config.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> + +#include <endian.h> +#include <fcntl.h> +#include <sys/stat.h> #include <termios.h> #include <unistd.h> -#include <sys/stat.h> -#include <endian.h> - -#include "comm-host.h" -#include "keyboard_config.h" -#include "ectool.h" enum { /* Alloc this many more scans when needed */ diff --git a/util/lbcc.cc b/util/lbcc.cc index 2429400cad..5fa0a2e232 100644 --- a/util/lbcc.cc +++ b/util/lbcc.cc @@ -4,18 +4,19 @@ * found in the LICENSE file. */ +#include "compile_time_macros.h" +#include "ec_commands.h" +#include "lb_common.h" +#include "lightbar.h" + #include <errno.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include "compile_time_macros.h" -#include "ec_commands.h" -#include "lb_common.h" -#include "lightbar.h" +#include <unistd.h> static const char usage[] = "\n" diff --git a/util/lbplay.cc b/util/lbplay.cc index 8c02903175..f8a510d664 100644 --- a/util/lbplay.cc +++ b/util/lbplay.cc @@ -4,10 +4,11 @@ */ #include <errno.h> -#include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <string.h> + +#include <fcntl.h> #include <strings.h> #include <sys/file.h> #include <sys/stat.h> diff --git a/util/lock/android.cc b/util/lock/android.cc index 6636f2db62..2ba47a04d2 100644 --- a/util/lock/android.cc +++ b/util/lock/android.cc @@ -3,10 +3,10 @@ * found in the LICENSE file. */ -#include <stdlib.h> - #include "android.h" +#include <stdlib.h> + int in_android(void) { if (getenv("ANDROID_ROOT")) diff --git a/util/lock/file_lock.cc b/util/lock/file_lock.cc index f984cea287..7c7de880a6 100644 --- a/util/lock/file_lock.cc +++ b/util/lock/file_lock.cc @@ -15,22 +15,23 @@ * The current process's PID will be written to the file for debug purposes. */ +#include "android.h" +#include "ipc_lock.h" +#include "locks.h" + #include <errno.h> -#include <fcntl.h> #include <inttypes.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> -#include <unistd.h> + +#include <fcntl.h> #include <sys/file.h> -#include <sys/types.h> #include <sys/stat.h> - -#include "android.h" -#include "ipc_lock.h" -#include "locks.h" +#include <sys/types.h> +#include <unistd.h> #define SLEEP_INTERVAL_MS 50 diff --git a/util/misc_util.cc b/util/misc_util.cc index 40ab033411..4d1e1c5876 100644 --- a/util/misc_util.cc +++ b/util/misc_util.cc @@ -3,15 +3,16 @@ * found in the LICENSE file. */ +#include "comm-host.h" +#include "misc_util.h" + #include <ctype.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/utsname.h> -#include "comm-host.h" -#include "misc_util.h" +#include <sys/utsname.h> int write_file(const char *filename, const char *buf, int size) { diff --git a/util/powerd_lock.cc b/util/powerd_lock.cc index 4fdc799203..0515d66e52 100644 --- a/util/powerd_lock.cc +++ b/util/powerd_lock.cc @@ -21,15 +21,16 @@ * powerd_lock.c: power management routines */ +#include "powerd_lock.h" + #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include <sys/types.h> #include <unistd.h> -#include "powerd_lock.h" - /* * Path to a file containing flashrom's PID. While present, powerd avoids * suspending or shutting down the system. diff --git a/util/stm32mon.cc b/util/stm32mon.cc index 39837bd3dd..561201f213 100644 --- a/util/stm32mon.cc +++ b/util/stm32mon.cc @@ -19,26 +19,27 @@ #define _DEFAULT_SOURCE /* Newer glibc */ #define _BSD_SOURCE /* Older glibc */ -#include <arpa/inet.h> -#include <compile_time_macros.h> +#include "ec_version.h" + #include <errno.h> -#include <fcntl.h> -#include <getopt.h> #include <inttypes.h> -#include <stdio.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/ioctl.h> -#include <sys/stat.h> +#include <time.h> + +#include <arpa/inet.h> +#include <compile_time_macros.h> +#include <fcntl.h> +#include <getopt.h> #include <linux/i2c-dev.h> #include <linux/spi/spidev.h> +#include <sys/ioctl.h> +#include <sys/stat.h> #include <termios.h> -#include <time.h> #include <unistd.h> -#include "ec_version.h" - #define KBYTES_TO_BYTES 1024 /* diff --git a/util/uut/cmd.cc b/util/uut/cmd.cc index 02810b686a..6a57cb7c75 100644 --- a/util/uut/cmd.cc +++ b/util/uut/cmd.cc @@ -6,14 +6,14 @@ /* This file creates the UART Program Protocol API commands. */ -#include <stdint.h> -#include <stdio.h> -#include <string.h> - #include "cmd.h" #include "lib_crc.h" #include "main.h" +#include <stdint.h> +#include <stdio.h> +#include <string.h> + /* Extracting Byte - 8 bit: MSB, LSB */ #define MSB(u16) ((uint8_t)((uint16_t)(u16) >> 8)) #define LSB(u16) ((uint8_t)(u16)) diff --git a/util/uut/l_com_port.cc b/util/uut/l_com_port.cc index e774743160..2e280ff7e1 100644 --- a/util/uut/l_com_port.cc +++ b/util/uut/l_com_port.cc @@ -4,19 +4,20 @@ * found in the LICENSE file. */ +#include "com_port.h" +#include "main.h" + #include <errno.h> -#include <fcntl.h> -#include <poll.h> #include <stdint.h> #include <stdio.h> #include <string.h> + +#include <fcntl.h> +#include <poll.h> #include <sys/ioctl.h> #include <termios.h> #include <unistd.h> -#include "com_port.h" -#include "main.h" - /*--------------------------------------------------------------------------- * Constant definitions *--------------------------------------------------------------------------- diff --git a/util/uut/main.cc b/util/uut/main.cc index 915bff34d6..7f7923b2bf 100644 --- a/util/uut/main.cc +++ b/util/uut/main.cc @@ -4,20 +4,21 @@ * found in the LICENSE file. */ +#include "com_port.h" +#include "compile_time_macros.h" +#include "main.h" +#include "misc_util.h" +#include "opr.h" + #include <errno.h> -#include <getopt.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/stat.h> -#include "com_port.h" -#include "compile_time_macros.h" -#include "main.h" -#include "misc_util.h" -#include "opr.h" +#include <getopt.h> +#include <sys/stat.h> /*---------------------------------------------------------------------------- * Constant definitions diff --git a/util/uut/opr.cc b/util/uut/opr.cc index 8ad60bd3d4..b52eb880bb 100644 --- a/util/uut/opr.cc +++ b/util/uut/opr.cc @@ -10,18 +10,19 @@ #define _GNU_SOURCE /* for asprintf */ #endif +#include "cmd.h" +#include "com_port.h" +#include "main.h" +#include "misc_util.h" +#include "opr.h" + #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> -#include <unistd.h> -#include "com_port.h" -#include "cmd.h" -#include "main.h" -#include "misc_util.h" -#include "opr.h" +#include <unistd.h> /*---------------------------------------------------------------------------- * Global Variables diff --git a/zephyr/test/uart_printf/src/fakes.cc b/zephyr/test/uart_printf/src/fakes.cc index 0bb5fea1eb..6cfdacaaa0 100644 --- a/zephyr/test/uart_printf/src/fakes.cc +++ b/zephyr/test/uart_printf/src/fakes.cc @@ -3,12 +3,12 @@ * found in the LICENSE file. */ -#include <zephyr/fff.h> -#include <zephyr/ztest.h> - #include "printf.h" #include "uart.h" +#include <zephyr/fff.h> +#include <zephyr/ztest.h> + DEFINE_FFF_GLOBALS; /* printf.h */ diff --git a/zephyr/test/uart_printf/src/main.cc b/zephyr/test/uart_printf/src/main.cc index 9feb6a7ae9..1633e6edc5 100644 --- a/zephyr/test/uart_printf/src/main.cc +++ b/zephyr/test/uart_printf/src/main.cc @@ -3,15 +3,15 @@ * found in the LICENSE file. */ -#include <cstring> -#include <string> - -#include <zephyr/ztest.h> - #include "common.h" #include "printf.h" #include "uart.h" +#include <zephyr/ztest.h> + +#include <cstring> +#include <string> + ZTEST_SUITE(uart_printf, nullptr, nullptr, nullptr, nullptr, nullptr); ZTEST(uart_printf, test_uart_putc) |