summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-12-17 13:43:17 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-19 00:12:28 +0000
commit6ab8e91658f1efc894b648cc0748af8d804915e4 (patch)
treec33da7914793452ecb37084e505230171d4eff9e
parente5935f17d1798a1f19c6003e57f140446774484f (diff)
downloadchrome-ec-6ab8e91658f1efc894b648cc0748af8d804915e4.tar.gz
cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols to keep checkpatch from complaining. The goal is to reduce the temptation to use 'repo upload --no-verify'. This is a big furball of find/replace, but no functional changes. BUG=chromium:322144 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/180495
-rw-r--r--board/bds/board.c2
-rw-r--r--board/bds/board.h10
-rw-r--r--board/falco/board.h8
-rw-r--r--board/falco/panel.c2
-rw-r--r--board/host/charger.c6
-rw-r--r--board/link/board.h12
-rw-r--r--board/mec1322_evb/board.c2
-rw-r--r--board/mec1322_evb/board.h2
-rw-r--r--board/peppy/board.h8
-rw-r--r--board/pit/board.c2
-rw-r--r--board/rambi/board.h10
-rw-r--r--board/samus/board.c10
-rw-r--r--board/samus/board.h10
-rw-r--r--board/samus/power_sequence.c8
-rw-r--r--chip/lm4/adc_chip.h3
-rw-r--r--chip/lm4/eeprom.c4
-rw-r--r--chip/lm4/flash.c6
-rw-r--r--chip/lm4/lpc.c8
-rw-r--r--chip/lm4/peci.c2
-rw-r--r--chip/lm4/spi.c12
-rw-r--r--chip/mec1322/lpc.c2
-rw-r--r--chip/stm32/flash-stm32f.c13
-rw-r--r--chip/stm32/flash-stm32l.c9
-rw-r--r--chip/stm32/i2c-stm32f.c7
-rw-r--r--chip/stm32/spi.c4
-rw-r--r--common/battery.c4
-rw-r--r--common/charge_state.c2
-rw-r--r--common/fmap.c12
-rw-r--r--common/i2c.c12
-rw-r--r--common/lightbar.c10
-rw-r--r--common/pmu_tps65090_charger.c5
-rw-r--r--common/printf.c2
-rw-r--r--common/sha256.c2
-rw-r--r--common/timer.c2
-rw-r--r--common/uart_buffering.c6
-rw-r--r--common/util.c9
-rw-r--r--core/cortex-m/atomic.h30
-rw-r--r--core/cortex-m/mpu.c3
-rw-r--r--core/cortex-m/task.c7
-rw-r--r--driver/temp_sensor/tmp006.c56
-rw-r--r--driver/temp_sensor/tmp006.h2
-rw-r--r--include/i2c.h4
-rw-r--r--include/temp_sensor.h2
-rw-r--r--power/baytrail.c7
-rw-r--r--power/gaia.c36
-rw-r--r--power/haswell.c14
-rw-r--r--power/ivybridge.c20
-rw-r--r--power/tegra.c3
-rw-r--r--test/pingpong.c4
-rw-r--r--test/pingpong.tasklist8
-rw-r--r--test/powerdemo.c2
-rw-r--r--test/stress.c2
-rw-r--r--test/timer_dos.c2
-rw-r--r--test/timer_dos.tasklist8
-rw-r--r--util/ectool.c5
-rw-r--r--util/lock/csem.c32
-rw-r--r--util/lock/ipc_lock.c15
-rw-r--r--util/stm32mon.c9
58 files changed, 248 insertions, 251 deletions
diff --git a/board/bds/board.c b/board/bds/board.c
index 90ac5eb946..7dc4985f9a 100644
--- a/board/bds/board.c
+++ b/board/bds/board.c
@@ -41,7 +41,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[] = {
- {"RECOVERYn", GPIO_D, (1<<1), GPIO_PULL_UP, NULL},
+ {"RECOVERY_L", GPIO_D, (1<<1), GPIO_PULL_UP, NULL},
{"DEBUG_LED", GPIO_A, (1<<7), GPIO_OUT_LOW, NULL},
/* Unimplemented signals which we need to emulate for now */
GPIO_SIGNAL_NOT_IMPLEMENTED("WP"),
diff --git a/board/bds/board.h b/board/bds/board.h
index 97f48e38e4..45ed2f9b72 100644
--- a/board/bds/board.h
+++ b/board/bds/board.h
@@ -38,17 +38,19 @@ enum pwm_channel {
};
/* I2C ports */
-#define I2C_PORT_LIGHTBAR 5 // port 5 / PA6:7 on link, but PG6:7 on badger
+#define I2C_PORT_LIGHTBAR 5 /* Port 5 / PA6:7 on link, but PG6:7 on badger */
/* Second UART port */
#define CONFIG_UART_HOST 1
/* GPIO signal list */
enum gpio_signal {
- GPIO_RECOVERYn = 0, /* Recovery signal from DOWN button */
+ GPIO_RECOVERY_L = 0, /* Recovery signal from DOWN button */
GPIO_DEBUG_LED, /* Debug LED */
- /* Signals which aren't implemented on BDS but we'll emulate anyway, to
- * make it more convenient to debug other code. */
+ /*
+ * Signals which aren't implemented on BDS but we'll emulate anyway, to
+ * make it more convenient to debug other code.
+ */
GPIO_WP, /* Write protect input */
GPIO_ENTERING_RW, /* EC entering RW code */
diff --git a/board/falco/board.h b/board/falco/board.h
index dd47dca788..bf25f8263b 100644
--- a/board/falco/board.h
+++ b/board/falco/board.h
@@ -139,10 +139,10 @@ enum x86_signal {
X86_PGOOD_PP1350,
X86_PGOOD_PP1050,
X86_PGOOD_VCORE,
- X86_PCH_SLP_S0n_DEASSERTED,
- X86_PCH_SLP_S3n_DEASSERTED,
- X86_PCH_SLP_S5n_DEASSERTED,
- X86_PCH_SLP_SUSn_DEASSERTED,
+ X86_SLP_S0_DEASSERTED,
+ X86_SLP_S3_DEASSERTED,
+ X86_SLP_S5_DEASSERTED,
+ X86_SLP_SUS_DEASSERTED,
/* Number of X86 signals */
X86_SIGNAL_COUNT
diff --git a/board/falco/panel.c b/board/falco/panel.c
index 863ad24e1f..33154620f2 100644
--- a/board/falco/panel.c
+++ b/board/falco/panel.c
@@ -104,7 +104,7 @@ void lcdvcc_interrupt(enum gpio_signal signal)
if (pch_value && !lcdvcc_en_deferred_value) {
lcdvcc_en_deferred_value = 1;
hook_call_deferred(&set_lcdvcc_en_value,
- LCDVCC_ENABLE_DELAY_US);
+ LCDVCC_ENABLE_DELAY_US);
}
}
diff --git a/board/host/charger.c b/board/host/charger.c
index d5396c7418..8a5a2e3c53 100644
--- a/board/host/charger.c
+++ b/board/host/charger.c
@@ -26,9 +26,9 @@ static const struct charger_info mock_charger_info = {
#define OPTION_CHARGE_INHIBIT (1 << 0)
-static uint32_t mock_option = 0;
-static uint32_t mock_current = 0;
-static uint32_t mock_voltage = 0;
+static uint32_t mock_option;
+static uint32_t mock_current;
+static uint32_t mock_voltage;
const struct charger_info *charger_get_info(void)
{
diff --git a/board/link/board.h b/board/link/board.h
index 7331c223c6..64aee14198 100644
--- a/board/link/board.h
+++ b/board/link/board.h
@@ -166,12 +166,12 @@ enum x86_signal {
X86_PGOOD_VCCSA,
X86_PGOOD_CPU_CORE,
X86_PGOOD_VGFX_CORE,
- X86_PCH_SLP_S3n_DEASSERTED,
- X86_PCH_SLP_S4n_DEASSERTED,
- X86_PCH_SLP_S5n_DEASSERTED,
- X86_PCH_SLP_An_DEASSERTED,
- X86_PCH_SLP_SUSn_DEASSERTED,
- X86_PCH_SLP_MEn_DEASSERTED,
+ X86_SLP_S3_DEASSERTED,
+ X86_SLP_S4_DEASSERTED,
+ X86_SLP_S5_DEASSERTED,
+ X86_SLP_A_DEASSERTED,
+ X86_SLP_SUS_DEASSERTED,
+ X86_SLP_ME_DEASSERTED,
/* Number of X86 signals */
X86_SIGNAL_COUNT
diff --git a/board/mec1322_evb/board.c b/board/mec1322_evb/board.c
index 417bc41d62..6a26913ca8 100644
--- a/board/mec1322_evb/board.c
+++ b/board/mec1322_evb/board.c
@@ -22,7 +22,7 @@ const struct gpio_info gpio_list[] = {
{"PCH_SCI_L", GPIO_PORT(2), (1 << 6), GPIO_ODR_HIGH, NULL},
{"PCH_WAKE_L", GPIO_PORT(20), (1 << 0), GPIO_ODR_HIGH, NULL},
/* Unimplemented signals which we need to emulate for now */
- GPIO_SIGNAL_NOT_IMPLEMENTED("RECOVERYn"),
+ GPIO_SIGNAL_NOT_IMPLEMENTED("RECOVERY_L"),
GPIO_SIGNAL_NOT_IMPLEMENTED("WP"),
GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
};
diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h
index d20e51a2aa..fa4f53609c 100644
--- a/board/mec1322_evb/board.h
+++ b/board/mec1322_evb/board.h
@@ -35,7 +35,7 @@ enum gpio_signal {
* Signals which aren't implemented on MEC1322 eval board but we'll
* emulate anyway, to make it more convenient to debug other code.
*/
- GPIO_RECOVERYn, /* Recovery signal from DOWN button */
+ GPIO_RECOVERY_L, /* Recovery signal from DOWN button */
GPIO_WP, /* Write protect input */
GPIO_ENTERING_RW, /* EC entering RW code */
diff --git a/board/peppy/board.h b/board/peppy/board.h
index b10330dfe1..c01d218313 100644
--- a/board/peppy/board.h
+++ b/board/peppy/board.h
@@ -141,10 +141,10 @@ enum x86_signal {
X86_PGOOD_PP1350,
X86_PGOOD_PP1050,
X86_PGOOD_VCORE,
- X86_PCH_SLP_S0n_DEASSERTED,
- X86_PCH_SLP_S3n_DEASSERTED,
- X86_PCH_SLP_S5n_DEASSERTED,
- X86_PCH_SLP_SUSn_DEASSERTED,
+ X86_SLP_S0_DEASSERTED,
+ X86_SLP_S3_DEASSERTED,
+ X86_SLP_S5_DEASSERTED,
+ X86_SLP_SUS_DEASSERTED,
/* Number of X86 signals */
X86_SIGNAL_COUNT
diff --git a/board/pit/board.c b/board/pit/board.c
index de0730967f..414986a94b 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -70,7 +70,7 @@ const struct gpio_info gpio_list[] = {
{"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL},
{"PMIC_PWRON", GPIO_A, (1<<12), GPIO_OUT_LOW, NULL},
{"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
+ {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
{"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL},
{"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL},
{"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL},
diff --git a/board/rambi/board.h b/board/rambi/board.h
index 065c4329b7..e0bdc0b65a 100644
--- a/board/rambi/board.h
+++ b/board/rambi/board.h
@@ -141,11 +141,11 @@ enum x86_signal {
X86_PGOOD_S5,
X86_PGOOD_VCORE,
X86_PGOOD_PP1000_S0IX,
- X86_PCH_SLP_S3n_DEASSERTED,
- X86_PCH_SLP_S4n_DEASSERTED,
- X86_PCH_SLP_SXn_DEASSERTED,
- X86_PCH_SUS_STATn,
- X86_PCH_SUSPWRDNACK,
+ X86_SLP_S3_DEASSERTED,
+ X86_SLP_S4_DEASSERTED,
+ X86_SLP_SX_DEASSERTED,
+ X86_SUS_STAT_ASSERTED,
+ X86_SUSPWRDNACK_ASSERTED,
/* Number of X86 signals */
X86_SIGNAL_COUNT
diff --git a/board/samus/board.c b/board/samus/board.c
index 74cc3bda07..f943250f18 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -156,11 +156,11 @@ const struct x86_signal_info x86_signal_list[] = {
{GPIO_PP1200_PGOOD, 1, "PGOOD_PP1200"},
{GPIO_PP1800_PGOOD, 1, "PGOOD_PP1800"},
{GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"},
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_L_DEASSERTED"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_L_DEASSERTED"},
- {GPIO_PCH_SLP_S5_L, 1, "SLP_S5_L_DEASSERTED"},
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_L_DEASSERTED"},
- {GPIO_PCH_SUSWARN_L, 1, "SUSWARN_L_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S5_L, 1, "SLP_S5_DEASSERTED"},
+ {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
+ {GPIO_PCH_SUSWARN_L, 1, "SUSWARN_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(x86_signal_list) == X86_SIGNAL_COUNT);
diff --git a/board/samus/board.h b/board/samus/board.h
index 7496b97958..e295282d7c 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -161,11 +161,11 @@ enum x86_signal {
X86_PGOOD_PP1800,
X86_PGOOD_VCORE,
- X86_PCH_SLP_S0_L_DEASSERTED,
- X86_PCH_SLP_S3_L_DEASSERTED,
- X86_PCH_SLP_S5_L_DEASSERTED,
- X86_PCH_SLP_SUS_L_DEASSERTED,
- X86_PCH_SUSWARN_L_DEASSERTED,
+ X86_SLP_S0_DEASSERTED,
+ X86_SLP_S3_DEASSERTED,
+ X86_SLP_S5_DEASSERTED,
+ X86_SLP_SUS_DEASSERTED,
+ X86_SUSWARN_DEASSERTED,
/* Number of X86 signals */
X86_SIGNAL_COUNT
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index f0ec10a5d0..f9ccd6de01 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -30,10 +30,10 @@
#define IN_PGOOD_PP1800 X86_SIGNAL_MASK(X86_PGOOD_PP1800)
#define IN_PGOOD_VCORE X86_SIGNAL_MASK(X86_PGOOD_VCORE)
-#define IN_PCH_SLP_S0_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S0_L_DEASSERTED)
-#define IN_PCH_SLP_S3_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S3_L_DEASSERTED)
-#define IN_PCH_SLP_S5_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S5_L_DEASSERTED)
-#define IN_PCH_SLP_SUS_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_SUS_L_DEASSERTED)
+#define IN_PCH_SLP_S0_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S0_DEASSERTED)
+#define IN_PCH_SLP_S3_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S3_DEASSERTED)
+#define IN_PCH_SLP_S5_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S5_DEASSERTED)
+#define IN_PCH_SLP_SUS_DEASSERTED X86_SIGNAL_MASK(X86_SLP_SUS_DEASSERTED)
/* All non-core power rails */
diff --git a/chip/lm4/adc_chip.h b/chip/lm4/adc_chip.h
index 736e6f113e..0e15d6dbd0 100644
--- a/chip/lm4/adc_chip.h
+++ b/chip/lm4/adc_chip.h
@@ -8,8 +8,7 @@
#ifndef __CROS_EC_ADC_CHIP_H
#define __CROS_EC_ADC_CHIP_H
-enum lm4_adc_sequencer
-{
+enum lm4_adc_sequencer {
LM4_ADC_SEQ0 = 0,
LM4_ADC_SEQ1,
LM4_ADC_SEQ2,
diff --git a/chip/lm4/eeprom.c b/chip/lm4/eeprom.c
index 6ebf82a980..b8c45c23e2 100644
--- a/chip/lm4/eeprom.c
+++ b/chip/lm4/eeprom.c
@@ -75,7 +75,7 @@ int eeprom_read(int block, int offset, int size, char *data)
LM4_EEPROM_EEOFFSET = offset >> 2;
- for ( ; size; size -= sizeof(uint32_t))
+ for (; size; size -= sizeof(uint32_t))
*(d++) = LM4_EEPROM_EERDWRINC;
return EC_SUCCESS;
@@ -103,7 +103,7 @@ int eeprom_write(int block, int offset, int size, const char *data)
LM4_EEPROM_EEOFFSET = offset >> 2;
/* Write 32 bits at a time; wait for each write to complete */
- for ( ; size; size -= sizeof(uint32_t)) {
+ for (; size; size -= sizeof(uint32_t)) {
LM4_EEPROM_EERDWRINC = *(d++);
rv = wait_for_done();
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c
index 62e04ec8c9..c6b676d87b 100644
--- a/chip/lm4/flash.c
+++ b/chip/lm4/flash.c
@@ -105,7 +105,7 @@ int flash_physical_write(int offset, int size, const char *data)
i = (offset >> 2) & (FLASH_FWB_WORDS - 1);
/* Copy words into buffer */
- for ( ; size > 0; size -= 4) {
+ for (; size > 0; size -= 4) {
LM4_FLASH_FWB[i++] = *data32++;
if (i == FLASH_FWB_WORDS) {
rv = write_buffer();
@@ -132,8 +132,8 @@ int flash_physical_erase(int offset, int size)
LM4_FLASH_FCMISC = LM4_FLASH_FCRIS; /* Clear previous error status */
- for ( ; size > 0; size -= CONFIG_FLASH_ERASE_SIZE,
- offset += CONFIG_FLASH_ERASE_SIZE) {
+ for (; size > 0; size -= CONFIG_FLASH_ERASE_SIZE,
+ offset += CONFIG_FLASH_ERASE_SIZE) {
int t;
/* Do nothing if already erased */
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 57844bd2e9..63c6e9fece 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -63,7 +63,7 @@ static struct host_cmd_handler_args host_cmd_args;
static uint8_t host_cmd_flags; /* Flags from host command */
/* Params must be 32-bit aligned */
-static uint8_t params_copy[EC_LPC_HOST_PACKET_SIZE] __attribute__((aligned(4)));
+static uint8_t params_copy[EC_LPC_HOST_PACKET_SIZE] __aligned(4);
static int init_done;
static uint8_t * const cmd_params = (uint8_t *)LPC_POOL_CMD_DATA +
@@ -276,9 +276,8 @@ int lpc_keyboard_input_pending(void)
void lpc_keyboard_put_char(uint8_t chr, int send_irq)
{
LPC_POOL_KEYBOARD[1] = chr;
- if (send_irq) {
+ if (send_irq)
keyboard_irq_assert();
- }
}
void lpc_keyboard_clear_buffer(void)
@@ -330,7 +329,8 @@ void lpc_comx_put_char(int c)
* - SMI pulse via EC_SMI_L GPIO
* - SCI pulse via LPC0SCI
*/
-static void update_host_event_status(void) {
+static void update_host_event_status(void)
+{
int need_sci = 0;
int need_smi = 0;
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c
index 052e2ddc06..44c1699d26 100644
--- a/chip/lm4/peci.c
+++ b/chip/lm4/peci.c
@@ -38,7 +38,7 @@
#define TEMP_AVG_LENGTH 4 /* Should be power of 2 */
static int temp_vals[TEMP_AVG_LENGTH];
-static int temp_idx = 0;
+static int temp_idx;
int peci_get_cpu_temp(void)
{
diff --git a/chip/lm4/spi.c b/chip/lm4/spi.c
index 914e5f1c66..aa8785ed0e 100644
--- a/chip/lm4/spi.c
+++ b/chip/lm4/spi.c
@@ -25,8 +25,8 @@ int spi_enable(int enable)
gpio_config_module(MODULE_SPI, 1);
/* Don't use the SSI0 frame output. CS# is a GPIO so we can
* keep it low during an entire transaction. */
- gpio_set_flags(GPIO_SPI_CSn, GPIO_OUTPUT);
- gpio_set_level(GPIO_SPI_CSn, 1);
+ gpio_set_flags(GPIO_SPI_CS_L, GPIO_OUTPUT);
+ gpio_set_level(GPIO_SPI_CS_L, 1);
/* Enable SSI port */
LM4_SSI_CR1(0) |= 0x02;
@@ -35,8 +35,8 @@ int spi_enable(int enable)
LM4_SSI_CR1(0) &= ~0x02;
/* Make sure CS# is deselected */
- gpio_set_level(GPIO_SPI_CSn, 1);
- gpio_set_flags(GPIO_SPI_CSn, GPIO_ODR_HIGH);
+ gpio_set_level(GPIO_SPI_CS_L, 1);
+ gpio_set_flags(GPIO_SPI_CS_L, GPIO_ODR_HIGH);
gpio_config_module(MODULE_SPI, 0);
}
@@ -59,7 +59,7 @@ int spi_transaction(const uint8_t *txdata, int txlen,
/* Start transaction. Need to do this explicitly because the LM4
* SSI controller pulses its frame select every byte, and the EEPROM
* wants the chip select held low during the entire transaction. */
- gpio_set_level(GPIO_SPI_CSn, 0);
+ gpio_set_level(GPIO_SPI_CS_L, 0);
while (rxcount < totallen) {
/* Handle received bytes if any. We just checked rxcount <
@@ -89,7 +89,7 @@ int spi_transaction(const uint8_t *txdata, int txlen,
}
/* End transaction */
- gpio_set_level(GPIO_SPI_CSn, 1);
+ gpio_set_level(GPIO_SPI_CS_L, 1);
return EC_SUCCESS;
}
diff --git a/chip/mec1322/lpc.c b/chip/mec1322/lpc.c
index 4505aaab52..fb3ace7438 100644
--- a/chip/mec1322/lpc.c
+++ b/chip/mec1322/lpc.c
@@ -25,7 +25,7 @@ static struct host_packet lpc_packet;
static struct host_cmd_handler_args host_cmd_args;
static uint8_t host_cmd_flags; /* Flags from host command */
-static uint8_t params_copy[EC_LPC_HOST_PACKET_SIZE] __attribute__((aligned(4)));
+static uint8_t params_copy[EC_LPC_HOST_PACKET_SIZE] __aligned(4);
static int init_done;
static struct ec_lpc_host_args * const lpc_host_args =
diff --git a/chip/stm32/flash-stm32f.c b/chip/stm32/flash-stm32f.c
index c14e37044c..a49701740c 100644
--- a/chip/stm32/flash-stm32f.c
+++ b/chip/stm32/flash-stm32f.c
@@ -153,7 +153,7 @@ static int preserve_optb(int byte)
/* The byte has been reset, no need to run preserve. */
if (*(uint16_t *)(STM32_OPTB_BASE + byte) == 0xffff)
- return EC_SUCCESS;;
+ return EC_SUCCESS;
for (i = 0; i < ARRAY_SIZE(optb); ++i)
optb[i] = read_optb(i * 2);
@@ -201,7 +201,7 @@ static int write_optb(int byte, uint8_t value)
/* set OPTPG bit */
STM32_FLASH_CR |= OPTPG;
- *hword = value ;
+ *hword = value;
/* reset OPTPG bit */
STM32_FLASH_CR &= ~OPTPG;
@@ -234,7 +234,7 @@ int flash_physical_write(int offset, int size, const char *data)
/* set PG bit */
STM32_FLASH_CR |= PG;
- for ( ; size > 0; size -= sizeof(uint16_t)) {
+ for (; size > 0; size -= sizeof(uint16_t)) {
/*
* Reload the watchdog timer to avoid watchdog reset when doing
* long writing with interrupt disabled.
@@ -242,7 +242,7 @@ int flash_physical_write(int offset, int size, const char *data)
watchdog_reload();
/* wait to be ready */
- for (i = 0; (STM32_FLASH_SR & 1) && (i < FLASH_TIMEOUT_LOOP) ;
+ for (i = 0; (STM32_FLASH_SR & 1) && (i < FLASH_TIMEOUT_LOOP);
i++)
;
@@ -251,7 +251,7 @@ int flash_physical_write(int offset, int size, const char *data)
data += 2;
/* Wait for writes to complete */
- for (i = 0; (STM32_FLASH_SR & 1) && (i < FLASH_TIMEOUT_LOOP) ;
+ for (i = 0; (STM32_FLASH_SR & 1) && (i < FLASH_TIMEOUT_LOOP);
i++)
;
@@ -487,8 +487,7 @@ int flash_pre_init(void)
prot_flags & EC_FLASH_PROTECT_RO_AT_BOOT);
need_reset = 1;
}
- }
- else {
+ } else {
if (prot_flags & EC_FLASH_PROTECT_RO_NOW) {
/*
* Write protect pin unasserted but some section is
diff --git a/chip/stm32/flash-stm32l.c b/chip/stm32/flash-stm32l.c
index 11c22dff0c..62d20ca56e 100644
--- a/chip/stm32/flash-stm32l.c
+++ b/chip/stm32/flash-stm32l.c
@@ -139,8 +139,7 @@ void __attribute__((section(".iram.text")))
int i;
/* Wait for ready */
- for (i = 0; (STM32_FLASH_SR & 1) && (i < flash_timeout_loop) ;
- i++)
+ for (i = 0; (STM32_FLASH_SR & 1) && (i < flash_timeout_loop); i++)
;
/* Set PROG and FPRG bits */
@@ -151,7 +150,7 @@ void __attribute__((section(".iram.text")))
*addr++ = *data++;
/* Wait for writes to complete */
- for (i = 0; ((STM32_FLASH_SR & 9) != 8) && (i < flash_timeout_loop) ;
+ for (i = 0; ((STM32_FLASH_SR & 9) != 8) && (i < flash_timeout_loop);
i++)
;
@@ -205,7 +204,7 @@ int flash_physical_write(int offset, int size, const char *data)
/* Wait for writes to complete */
for (i = 0; ((STM32_FLASH_SR & 9) != 8) &&
- (i < flash_timeout_loop) ; i++)
+ (i < flash_timeout_loop); i++)
;
size -= sizeof(uint32_t);
@@ -256,7 +255,7 @@ int flash_physical_erase(int offset, int size)
/* Set PROG and ERASE bits */
STM32_FLASH_PECR |= STM32_FLASH_PECR_PROG | STM32_FLASH_PECR_ERASE;
- for (address = (uint32_t *)(CONFIG_FLASH_BASE + offset) ;
+ for (address = (uint32_t *)(CONFIG_FLASH_BASE + offset);
size > 0; size -= CONFIG_FLASH_ERASE_SIZE,
address += CONFIG_FLASH_ERASE_SIZE / sizeof(uint32_t)) {
timestamp_t deadline;
diff --git a/chip/stm32/i2c-stm32f.c b/chip/stm32/i2c-stm32f.c
index 9fba464456..2e049757e4 100644
--- a/chip/stm32/i2c-stm32f.c
+++ b/chip/stm32/i2c-stm32f.c
@@ -574,11 +574,12 @@ static int wait_status(int port, uint32_t mask, enum wait_t wait)
r = STM32_I2C_SR1(port);
while (mask ? ((r & mask) != mask) : r) {
t2 = get_time();
- if (t2.val - t1.val > I2C_TX_TIMEOUT_MASTER) {
+
+ if (t2.val - t1.val > I2C_TX_TIMEOUT_MASTER)
return EC_ERROR_TIMEOUT | (wait << 8);
- } else if (t2.val - t1.val > 150) {
+ else if (t2.val - t1.val > 150)
usleep(100);
- }
+
r = STM32_I2C_SR1(port);
}
diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c
index 1314e0e0d9..8e2fc6fa90 100644
--- a/chip/stm32/spi.c
+++ b/chip/stm32/spi.c
@@ -82,8 +82,8 @@ static const uint8_t out_preamble[4] = {
* message, including protocol overhead, and must be 32-bit aligned.
*/
static uint8_t out_msg[SPI_MAX_RESPONSE_SIZE + sizeof(out_preamble)]
- __attribute__((aligned(4)));
-static uint8_t in_msg[SPI_MAX_REQUEST_SIZE] __attribute__((aligned(4)));
+ __aligned(4);
+static uint8_t in_msg[SPI_MAX_REQUEST_SIZE] __aligned(4);
static uint8_t enabled;
static struct host_cmd_handler_args args;
static struct host_packet spi_packet;
diff --git a/common/battery.c b/common/battery.c
index a8ece1d796..8794027562 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -34,8 +34,8 @@ static int check_print_error(int rv)
static void print_battery_status(void)
{
static const char * const st[] = {"EMPTY", "FULL", "DCHG", "INIT",};
- static const char * const al[] =
- {"RT", "RC", "--", "TD", "OT", "--", "TC", "OC"};
+ static const char * const al[] = {"RT", "RC", "--", "TD",
+ "OT", "--", "TC", "OC"};
int value, i;
diff --git a/common/charge_state.c b/common/charge_state.c
index 0984cfbf0b..d355017191 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -37,7 +37,7 @@
static const char * const state_name[] = POWER_STATE_NAME_TABLE;
-static int state_machine_force_idle = 0;
+static int state_machine_force_idle;
static unsigned user_current_limit = -1U;
diff --git a/common/fmap.c b/common/fmap.c
index cac3b61ca2..946299bfb7 100644
--- a/common/fmap.c
+++ b/common/fmap.c
@@ -22,7 +22,7 @@
*/
#define RELATIVE(addr) ((addr) - CONFIG_FLASH_BASE)
-typedef struct _FmapHeader {
+struct fmap_header {
char fmap_signature[FMAP_SIGNATURE_SIZE];
uint8_t fmap_ver_major;
uint8_t fmap_ver_minor;
@@ -30,24 +30,24 @@ typedef struct _FmapHeader {
uint32_t fmap_size;
char fmap_name[FMAP_NAMELEN];
uint16_t fmap_nareas;
-} __packed FmapHeader;
+} __packed;
#define FMAP_AREA_STATIC (1 << 0) /* can be checksummed */
#define FMAP_AREA_COMPRESSED (1 << 1) /* may be compressed */
#define FMAP_AREA_RO (1 << 2) /* writes may fail */
-typedef struct _FmapAreaHeader {
+struct fmap_area_header {
uint32_t area_offset;
uint32_t area_size;
char area_name[FMAP_NAMELEN];
uint16_t area_flags;
-} __packed FmapAreaHeader;
+} __packed;
#define NUM_EC_FMAP_AREAS 7
const struct _ec_fmap {
- FmapHeader header;
- FmapAreaHeader area[NUM_EC_FMAP_AREAS];
+ struct fmap_header header;
+ struct fmap_area_header area[NUM_EC_FMAP_AREAS];
} ec_fmap __attribute__((section(".google"))) = {
/* Header */
{
diff --git a/common/i2c.c b/common/i2c.c
index 5e38ddd200..564a4e39a7 100644
--- a/common/i2c.c
+++ b/common/i2c.c
@@ -187,13 +187,15 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
int msgnum;
if (args->params_size < sizeof(*params)) {
- PTHRUPRINTF("[%T i2c passthru no params, params_size=%d, need at least %d]\n",
+ PTHRUPRINTF("[%T i2c passthru no params, params_size=%d, "
+ "need at least %d]\n",
args->params_size, sizeof(*params));
return EC_RES_INVALID_PARAM;
}
size = sizeof(*params) + params->num_msgs * sizeof(*msg);
if (args->params_size < size) {
- PTHRUPRINTF("[%T i2c passthru params_size=%d, need at least %d]\n",
+ PTHRUPRINTF("[%T i2c passthru params_size=%d, "
+ "need at least %d]\n",
args->params_size, size);
return EC_RES_INVALID_PARAM;
}
@@ -216,7 +218,8 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
return EC_RES_INVALID_PARAM;
}
- PTHRUPRINTF("[%T i2c passthru port=%d, %s, addr=0x%02x, len=0x%02x]\n",
+ PTHRUPRINTF("[%T i2c passthru port=%d, %s, addr=0x%02x, "
+ "len=0x%02x]\n",
params->port,
addr_flags & EC_I2C_FLAG_READ ? "read" : "write",
addr_flags & EC_I2C_ADDR_MASK,
@@ -288,7 +291,8 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
xferflags |= I2C_XFER_STOP;
/* Transfer next message */
- PTHRUPRINTF("[%T i2c passthru xfer port=%x, addr=%x, out=%p, write_len=%x, data=%p, read_len=%x, xferflags=%x]\n",
+ PTHRUPRINTF("[%T i2c passthru xfer port=%x, addr=%x, out=%p, "
+ "write_len=%x, data=%p, read_len=%x, flags=%x]\n",
params->port, addr, out, write_len,
&resp->data[in_len], read_len, xferflags);
rv = i2c_xfer(params->port, addr, out, write_len,
diff --git a/common/lightbar.c b/common/lightbar.c
index 847da1b003..4f0f799957 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -464,14 +464,14 @@ static inline float cycle_010(uint8_t i)
/* This function provides a smooth oscillation between -0.5 and +0.5.
* Zero starts at 0x00. */
-static inline float cycle_0P0N0(uint16_t i)
+static inline float cycle_0p0n0(uint16_t i)
{
uint8_t i8 = i & 0x00FF;
return cycle_010(i8+64) - 0.5f;
}
/* This function provides a pulsing oscillation between -0.5 and +0.5. */
-static inline float cycle_NPN(uint16_t i)
+static inline float cycle_npn(uint16_t i)
{
if ((i / 256) % 4)
return -0.5f;
@@ -562,7 +562,7 @@ static uint32_t sequence_S3S0(void)
}
/* Initial conditions */
- st.w0 = -256; /* start cycle_NPN() quietly */
+ st.w0 = -256; /* start cycle_npn() quietly */
st.ramp = 0;
/* Ready for S0 */
@@ -612,10 +612,10 @@ static uint32_t sequence_S0(void)
for (i = 0; i < NUM_LEDS; i++) {
if (st.p.new_s0) {
w = st.w0 - i * w_ofs * f_ramp;
- f = base_s0 + osc_s0 * cycle_NPN(w);
+ f = base_s0 + osc_s0 * cycle_npn(w);
} else {
w = st.w0 - i * w_ofs * f_ramp;
- f = base_s0 + osc_s0 * cycle_0P0N0(w) * f_ramp;
+ f = base_s0 + osc_s0 * cycle_0p0n0(w) * f_ramp;
}
r = st.p.color[ci].r * f;
g = st.p.color[ci].g * f;
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index 2a51d32d0c..d7d70c14c6 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -345,11 +345,10 @@ static int calc_next_state(int state)
* Shutdown AP when state of charge < 1.5%.
* Moving average is rounded to integer.
*/
- if (rsoc_moving_average(batt.state_of_charge) < 2) {
+ if (rsoc_moving_average(batt.state_of_charge) < 2)
return system_off();
- } else if (batt.state_of_charge < 4) {
+ else if (batt.state_of_charge < 4)
notify_battery_low();
- }
}
return ST_DISCHARGING;
diff --git a/common/printf.c b/common/printf.c
index f52100e2c6..786d46711d 100644
--- a/common/printf.c
+++ b/common/printf.c
@@ -144,7 +144,7 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context,
continue;
}
- for ( ; precision; precision--, vstr++) {
+ for (; precision; precision--, vstr++) {
if (addchar(context, hexdigit(*vstr >> 4)) ||
addchar(context, hexdigit(*vstr)))
return EC_ERROR_OVERFLOW;
diff --git a/common/sha256.c b/common/sha256.c
index b5e276fcf6..e8f9f185b3 100644
--- a/common/sha256.c
+++ b/common/sha256.c
@@ -215,7 +215,7 @@ uint8_t *SHA256_final(struct sha256_ctx *ctx)
SHA256_transform(ctx, ctx->block, block_nb);
- for (i = 0 ; i < 8; i++)
+ for (i = 0; i < 8; i++)
UNPACK32(ctx->h[i], &ctx->buf[i << 2]);
return ctx->buf;
diff --git a/common/timer.c b/common/timer.c
index 810a28c7d2..550b9d20ea 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -21,7 +21,7 @@
static volatile uint32_t clksrc_high;
/* Bitmap of currently running timers */
-static uint32_t timer_running = 0;
+static uint32_t timer_running;
/* Deadlines of all timers */
static timestamp_t timer_deadline[TASK_ID_COUNT];
diff --git a/common/uart_buffering.c b/common/uart_buffering.c
index d49425229e..7d0b51ccf4 100644
--- a/common/uart_buffering.c
+++ b/common/uart_buffering.c
@@ -95,7 +95,7 @@ void uart_process_output(void)
return;
/* If DMA is still busy, nothing to do. */
- if(!uart_tx_dma_ready())
+ if (!uart_tx_dma_ready())
return;
/* If a previous DMA transfer completed, free up the buffer it used */
@@ -106,7 +106,7 @@ void uart_process_output(void)
}
/* Disable DMA-done interrupt if nothing to send */
- if(head == tx_buf_tail) {
+ if (head == tx_buf_tail) {
uart_tx_stop();
return;
}
@@ -301,7 +301,7 @@ void uart_flush_output(void)
int uart_getc(void)
{
/* Look for a non-flow-control character */
- while(rx_buf_tail != rx_buf_head) {
+ while (rx_buf_tail != rx_buf_head) {
int c = rx_buf[rx_buf_tail];
rx_buf_tail = RX_BUF_NEXT(rx_buf_tail);
diff --git a/common/util.c b/common/util.c
index 46e11372ed..32439edaaa 100644
--- a/common/util.c
+++ b/common/util.c
@@ -80,7 +80,8 @@ int atoi(const char *nptr)
int neg = 0;
char c = '\0';
- while ((c = *nptr++) && isspace(c)) {}
+ while ((c = *nptr++) && isspace(c))
+ ;
if (c == '-') {
neg = 1;
@@ -106,7 +107,8 @@ int strtoi(const char *nptr, char **endptr, int base)
if (endptr)
*endptr = (char *)nptr;
- while((c = *nptr++) && isspace(c)) {}
+ while ((c = *nptr++) && isspace(c))
+ ;
if (c == '0' && *nptr == 'x') {
base = 16;
@@ -336,8 +338,7 @@ int cond_went(cond_t *c, int val)
if (val) {
ret = *c & COND_RISE_MASK;
*c &= ~COND_RISE_MASK;
- }
- else {
+ } else {
ret = *c & COND_FALL_MASK;
*c &= ~COND_FALL_MASK;
}
diff --git a/core/cortex-m/atomic.h b/core/cortex-m/atomic.h
index 9e214a41a2..489db51357 100644
--- a/core/cortex-m/atomic.h
+++ b/core/cortex-m/atomic.h
@@ -18,17 +18,17 @@
* you must either clear explicitly the exclusive monitor (using clrex)
* or do it in exception context (which clears the monitor).
*/
-#define ATOMIC_OP(asm_op,a,v) do { \
+#define ATOMIC_OP(asm_op, a, v) do { \
uint32_t reg0, reg1; \
- \
+ \
__asm__ __volatile__("1: ldrex %0, [%2]\n" \
- #asm_op" %0, %0, %3\n" \
- " strex %1, %0, [%2]\n" \
- " teq %1, #0\n" \
- " bne 1b" \
- : "=&r" (reg0), "=&r" (reg1) \
- : "r" (a), "r" (v) : "cc"); \
-} while (0);
+ #asm_op" %0, %0, %3\n" \
+ " strex %1, %0, [%2]\n" \
+ " teq %1, #0\n" \
+ " bne 1b" \
+ : "=&r" (reg0), "=&r" (reg1) \
+ : "r" (a), "r" (v) : "cc"); \
+} while (0)
static inline void atomic_clear(uint32_t *addr, uint32_t bits)
{
@@ -55,12 +55,12 @@ static inline uint32_t atomic_read_clear(uint32_t *addr)
uint32_t ret, tmp;
__asm__ __volatile__(" mov %3, #0\n"
- "1: ldrex %0, [%2]\n"
- " strex %1, %3, [%2]\n"
- " teq %1, #0\n"
- " bne 1b"
- : "=&r" (ret), "=&r" (tmp)
- : "r" (addr), "r" (0) : "cc");
+ "1: ldrex %0, [%2]\n"
+ " strex %1, %3, [%2]\n"
+ " teq %1, #0\n"
+ " bne 1b"
+ : "=&r" (ret), "=&r" (tmp)
+ : "r" (addr), "r" (0) : "cc");
return ret;
}
diff --git a/core/cortex-m/mpu.c b/core/cortex-m/mpu.c
index b8f2ca8def..7b4deaa0a9 100644
--- a/core/cortex-m/mpu.c
+++ b/core/cortex-m/mpu.c
@@ -158,9 +158,8 @@ int mpu_pre_init(void)
return EC_ERROR_UNIMPLEMENTED;
mpu_disable();
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < 8; ++i)
mpu_config_region(i, CONFIG_RAM_BASE, CONFIG_RAM_SIZE, 0, 0);
- }
return EC_SUCCESS;
}
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 5ef72e64b0..c0cbc84d59 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -113,7 +113,7 @@ uint8_t task_stacks[0
TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE)
CONFIG_TASK_LIST
CONFIG_TEST_TASK_LIST
-] __attribute__((aligned(8)));
+] __aligned(8);
#undef TASK
@@ -137,7 +137,7 @@ static task_ *current_task = (task_ *)scratchpad;
* task unblocking. After checking for a task switch, svc_handler() will clear
* the flag (unless profiling is also enabled; then the flag remains set).
*/
-static int need_resched_or_profiling = 0;
+static int need_resched_or_profiling;
/*
* Bitmap of all tasks ready to be run.
@@ -340,8 +340,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events)))
- {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched);
resched = TASK_ID_IDLE;
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index 19d66d87aa..7400beecf4 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -79,52 +79,52 @@ static int tmp006_read_die_temp(const struct tmp006_data_t *tdata,
/**
* Calculate the remote object temperature.
*
- * @param Tdie_i Die temperature in 1/100 K.
- * @param Vobj_i Voltage read from register 0. In nV.
+ * @param tdie_i Die temperature in 1/100 K.
+ * @param vobj_i Voltage read from register 0. In nV.
* @param tdata TMP006 data for this sensor.
*
* @return Object temperature in 1/100 K.
*/
-static int tmp006_calculate_object_temp(int Tdie_i, int Vobj_i,
+static int tmp006_calculate_object_temp(int tdie_i, int vobj_i,
const struct tmp006_data_t *tdata)
{
- float Tdie, Vobj;
- float Tx, S, Vos, Vx, fv, Tobj, T4;
- int Tobj_i;
+ float tdie, vobj;
+ float tx, s, vos, vx, fv, tobj, t4;
+ int tobj_i;
- Tdie = (float)Tdie_i * 1e-2f;
- Vobj = (float)Vobj_i * 1e-9f;
+ tdie = (float)tdie_i * 1e-2f;
+ vobj = (float)vobj_i * 1e-9f;
/* Calculate according to TMP006 users guide. */
- Tx = Tdie - 298.15f;
- /* S is the sensitivity */
- S = tdata->s0 * (1.0f + A1 * Tx + A2 * Tx * Tx);
- /* Vos is the offset voltage */
- Vos = tdata->b0 + tdata->b1 * Tx + tdata->b2 * Tx * Tx;
- Vx = Vobj - Vos;
- /* fv is Seebeck coefficient f(Vobj) */
- fv = Vx + C2 * Vx * Vx;
-
- T4 = Tdie * Tdie * Tdie * Tdie + fv / S;
- Tobj = sqrtf(sqrtf(T4));
- Tobj_i = (int32_t)(Tobj * 100.0f);
-
- return Tobj_i;
+ tx = tdie - 298.15f;
+ /* s is the sensitivity */
+ s = tdata->s0 * (1.0f + A1 * tx + A2 * tx * tx);
+ /* vos is the offset voltage */
+ vos = tdata->b0 + tdata->b1 * tx + tdata->b2 * tx * tx;
+ vx = vobj - vos;
+ /* fv is Seebeck coefficient f(vobj) */
+ fv = vx + C2 * vx * vx;
+
+ t4 = tdie * tdie * tdie * tdie + fv / s;
+ tobj = sqrtf(sqrtf(t4));
+ tobj_i = (int32_t)(tobj * 100.0f);
+
+ return tobj_i;
}
/**
* Apply TMP006 temporal correction.
*
- * @param T1-T4 Four die temperature readings separated by 1s in 1/100K.
- * @param Vobj Voltage read from register 0, in nV.
+ * @param t1-t4 Four die temperature readings separated by 1s in 1/100K.
+ * @param vobj Voltage read from register 0, in nV.
*
* @return Corrected object voltage in 1/100K.
*/
-static int tmp006_correct_object_voltage(int T1, int T2, int T3, int T4,
- int Vobj)
+static int tmp006_correct_object_voltage(int t1, int t2, int t3, int t4,
+ int vobj)
{
- int Tslope = 3 * T1 + T2 - T3 - 3 * T4;
- return Vobj + 296 * Tslope;
+ int tslope = 3 * t1 + t2 - t3 - 3 * t4;
+ return vobj + 296 * tslope;
}
static int tmp006_read_object_temp(const struct tmp006_data_t *tdata,
diff --git a/driver/temp_sensor/tmp006.h b/driver/temp_sensor/tmp006.h
index 78f8e0044a..a8c4f19001 100644
--- a/driver/temp_sensor/tmp006.h
+++ b/driver/temp_sensor/tmp006.h
@@ -13,7 +13,7 @@
#define TMP006_REG(ADDR) (ADDR & 0xffff)
struct tmp006_t {
- const char* name;
+ const char *name;
int addr; /* I2C address formed by TMP006_ADDR macro. */
};
diff --git a/include/i2c.h b/include/i2c.h
index 6367c87079..7d93eed7ef 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -66,7 +66,7 @@ void i2c_lock(int port, int lock);
/* Read a 16-bit register from the slave at 8-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space. */
-int i2c_read16(int port, int slave_addr, int offset, int* data);
+int i2c_read16(int port, int slave_addr, int offset, int *data);
/* Write a 16-bit register to the slave at 8-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space. */
@@ -74,7 +74,7 @@ int i2c_write16(int port, int slave_addr, int offset, int data);
/* Read an 8-bit register from the slave at 8-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space. */
-int i2c_read8(int port, int slave_addr, int offset, int* data);
+int i2c_read8(int port, int slave_addr, int offset, int *data);
/* Write an 8-bit register to the slave at 8-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space. */
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index a63beb218b..cd1b80d892 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -28,7 +28,7 @@ enum temp_sensor_type {
};
struct temp_sensor_t {
- const char* name;
+ const char *name;
/* Temperature sensor type. */
enum temp_sensor_type type;
/* Read sensor value in K into temp_ptr; return non-zero if error. */
diff --git a/power/baytrail.c b/power/baytrail.c
index b353d658a7..203c63707b 100644
--- a/power/baytrail.c
+++ b/power/baytrail.c
@@ -28,8 +28,8 @@
#define IN_PGOOD_PP1050 X86_SIGNAL_MASK(X86_PGOOD_PP1050)
#define IN_PGOOD_S5 X86_SIGNAL_MASK(X86_PGOOD_S5)
#define IN_PGOOD_VCORE X86_SIGNAL_MASK(X86_PGOOD_VCORE)
-#define IN_PCH_SLP_S3n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S3n_DEASSERTED)
-#define IN_PCH_SLP_S4n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S4n_DEASSERTED)
+#define IN_SLP_S3_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S3_DEASSERTED)
+#define IN_SLP_S4_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S4_DEASSERTED)
/* All always-on supplies */
#define IN_PGOOD_ALWAYS_ON (IN_PGOOD_S5)
@@ -43,8 +43,7 @@
#define IN_PGOOD_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE)
/* All PM_SLP signals from PCH deasserted */
-#define IN_ALL_PM_SLP_DEASSERTED (IN_PCH_SLP_S3n_DEASSERTED | \
- IN_PCH_SLP_S4n_DEASSERTED)
+#define IN_ALL_PM_SLP_DEASSERTED (IN_SLP_S3_DEASSERTED | IN_SLP_S4_DEASSERTED)
/* All inputs in the right state for S0 */
#define IN_ALL_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE | \
IN_PGOOD_ALL_CORE | IN_ALL_PM_SLP_DEASSERTED)
diff --git a/power/gaia.c b/power/gaia.c
index b928a00719..0726198a2b 100644
--- a/power/gaia.c
+++ b/power/gaia.c
@@ -322,17 +322,17 @@ static int gaia_power_init(void)
#ifdef BOARD_PIT
/*
- * Force the AP into reset unless we're doing a sysjump. Otherwise a
- * suspended AP may still be in a strange state from the last reboot,
- * and will hold XPSHOLD for a long time if it's in a low power state.
- * See crosbug.com/p/22233.
- */
- if (!(system_get_reset_flags() & RESET_FLAG_SYSJUMP)) {
- CPRINTF("[%T not sysjump; forcing AP reset]\n");
- gpio_set_level(GPIO_AP_RESET_L, 0);
- udelay(1000);
- gpio_set_level(GPIO_AP_RESET_L, 1);
- }
+ * Force the AP into reset unless we're doing a sysjump. Otherwise a
+ * suspended AP may still be in a strange state from the last reboot,
+ * and will hold XPSHOLD for a long time if it's in a low power state.
+ * See crosbug.com/p/22233.
+ */
+ if (!(system_get_reset_flags() & RESET_FLAG_SYSJUMP)) {
+ CPRINTF("[%T not sysjump; forcing AP reset]\n");
+ gpio_set_level(GPIO_AP_RESET_L, 0);
+ udelay(1000);
+ gpio_set_level(GPIO_AP_RESET_L, 1);
+ }
#endif
return EC_SUCCESS;
@@ -409,13 +409,13 @@ void chipset_force_shutdown(void)
#endif
#ifdef BOARD_PIT
- /*
- * Force the AP into reset. Otherwise it will hold XPSHOLD for a long
- * time if it's in a low power state. See crosbug.com/p/22233.
- */
- gpio_set_level(GPIO_AP_RESET_L, 0);
- udelay(1000);
- gpio_set_level(GPIO_AP_RESET_L, 1);
+ /*
+ * Force the AP into reset. Otherwise it will hold XPSHOLD for a long
+ * time if it's in a low power state. See crosbug.com/p/22233.
+ */
+ gpio_set_level(GPIO_AP_RESET_L, 0);
+ udelay(1000);
+ gpio_set_level(GPIO_AP_RESET_L, 1);
#endif
}
diff --git a/power/haswell.c b/power/haswell.c
index 4bc83c5ff6..cd00300f25 100644
--- a/power/haswell.c
+++ b/power/haswell.c
@@ -28,10 +28,10 @@
#define IN_PGOOD_PP1350 X86_SIGNAL_MASK(X86_PGOOD_PP1350)
#define IN_PGOOD_PP1050 X86_SIGNAL_MASK(X86_PGOOD_PP1050)
#define IN_PGOOD_VCORE X86_SIGNAL_MASK(X86_PGOOD_VCORE)
-#define IN_PCH_SLP_S0n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S0n_DEASSERTED)
-#define IN_PCH_SLP_S3n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S3n_DEASSERTED)
-#define IN_PCH_SLP_S5n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S5n_DEASSERTED)
-#define IN_PCH_SLP_SUSn_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_SUSn_DEASSERTED)
+#define IN_SLP_S0_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S0_DEASSERTED)
+#define IN_SLP_S3_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S3_DEASSERTED)
+#define IN_SLP_S5_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S5_DEASSERTED)
+#define IN_SLP_SUS_DEASSERTED X86_SIGNAL_MASK(X86_SLP_SUS_DEASSERTED)
/* All always-on supplies */
#define IN_PGOOD_ALWAYS_ON (IN_PGOOD_PP5000)
@@ -45,8 +45,8 @@
#define IN_PGOOD_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE)
/* All PM_SLP signals from PCH deasserted */
-#define IN_ALL_PM_SLP_DEASSERTED (IN_PCH_SLP_S3n_DEASSERTED | \
- IN_PCH_SLP_S5n_DEASSERTED)
+#define IN_ALL_PM_SLP_DEASSERTED (IN_SLP_S3_DEASSERTED | \
+ IN_SLP_S5_DEASSERTED)
/* All inputs in the right state for S0 */
#define IN_ALL_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE | \
IN_PGOOD_ALL_CORE | IN_ALL_PM_SLP_DEASSERTED)
@@ -206,7 +206,7 @@ enum x86_state x86_handle_state(enum x86_state state)
/* Assert DPWROK */
gpio_set_level(GPIO_PCH_DPWROK, 1);
- if (x86_wait_signals(IN_PCH_SLP_SUSn_DEASSERTED)) {
+ if (x86_wait_signals(IN_SLP_SUS_DEASSERTED)) {
chipset_force_shutdown();
return X86_G3;
}
diff --git a/power/ivybridge.c b/power/ivybridge.c
index 7a8dfd12aa..3a3c344223 100644
--- a/power/ivybridge.c
+++ b/power/ivybridge.c
@@ -30,12 +30,12 @@
#define IN_PGOOD_VCCSA X86_SIGNAL_MASK(X86_PGOOD_VCCSA)
#define IN_PGOOD_CPU_CORE X86_SIGNAL_MASK(X86_PGOOD_CPU_CORE)
#define IN_PGOOD_VGFX_CORE X86_SIGNAL_MASK(X86_PGOOD_VGFX_CORE)
-#define IN_PCH_SLP_S3n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S3n_DEASSERTED)
-#define IN_PCH_SLP_S4n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S4n_DEASSERTED)
-#define IN_PCH_SLP_S5n_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_S5n_DEASSERTED)
-#define IN_PCH_SLP_An_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_An_DEASSERTED)
-#define IN_PCH_SLP_SUSn_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_SUSn_DEASSERTED)
-#define IN_PCH_SLP_MEn_DEASSERTED X86_SIGNAL_MASK(X86_PCH_SLP_MEn_DEASSERTED)
+#define IN_SLP_S3_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S3_DEASSERTED)
+#define IN_SLP_S4_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S4_DEASSERTED)
+#define IN_SLP_S5_DEASSERTED X86_SIGNAL_MASK(X86_SLP_S5_DEASSERTED)
+#define IN_SLP_A_DEASSERTED X86_SIGNAL_MASK(X86_SLP_A_DEASSERTED)
+#define IN_SLP_SUS_DEASSERTED X86_SIGNAL_MASK(X86_SLP_SUS_DEASSERTED)
+#define IN_SLP_ME_DEASSERTED X86_SIGNAL_MASK(X86_SLP_ME_DEASSERTED)
/* All always-on supplies */
#define IN_PGOOD_ALWAYS_ON (IN_PGOOD_5VALW)
@@ -50,10 +50,10 @@
#define IN_PGOOD_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE)
/* All PM_SLP signals from PCH deasserted */
-#define IN_ALL_PM_SLP_DEASSERTED (IN_PCH_SLP_S3n_DEASSERTED | \
- IN_PCH_SLP_S4n_DEASSERTED | \
- IN_PCH_SLP_S5n_DEASSERTED | \
- IN_PCH_SLP_An_DEASSERTED)
+#define IN_ALL_PM_SLP_DEASSERTED (IN_SLP_S3_DEASSERTED | \
+ IN_SLP_S4_DEASSERTED | \
+ IN_SLP_S5_DEASSERTED | \
+ IN_SLP_A_DEASSERTED)
/* All inputs in the right state for S0 */
#define IN_ALL_S0 (IN_PGOOD_ALWAYS_ON | IN_PGOOD_ALL_NONCORE | \
IN_PGOOD_CPU_CORE | IN_ALL_PM_SLP_DEASSERTED)
diff --git a/power/tegra.c b/power/tegra.c
index c808b494d6..6e9960e7d3 100644
--- a/power/tegra.c
+++ b/power/tegra.c
@@ -438,9 +438,8 @@ static int check_for_power_on_event(void)
}
/* check for power button press */
- if (power_button_is_pressed()) {
+ if (power_button_is_pressed())
return 4;
- }
if (power_request == POWER_REQ_ON) {
power_request = POWER_REQ_NONE;
diff --git a/test/pingpong.c b/test/pingpong.c
index 852dbc3bdf..c11267db74 100644
--- a/test/pingpong.c
+++ b/test/pingpong.c
@@ -16,7 +16,7 @@
static int wake_count[3];
-int TaskAbc(void *data)
+int task_abc(void *data)
{
int myid = task_get_current() - TASK_ID_TESTA;
task_id_t next = task_get_current() + 1;
@@ -45,7 +45,7 @@ int TaskAbc(void *data)
return EC_SUCCESS;
}
-int TaskTick(void *data)
+int task_tick(void *data)
{
task_wait_event(-1);
ccprintf("\n[starting Task T]\n");
diff --git a/test/pingpong.tasklist b/test/pingpong.tasklist
index 1dd8aa3b91..84cf7b11d4 100644
--- a/test/pingpong.tasklist
+++ b/test/pingpong.tasklist
@@ -15,7 +15,7 @@
* 's' is the stack size in bytes; must be a multiple of 8
*/
#define CONFIG_TEST_TASK_LIST \
- TASK_TEST(TESTA, TaskAbc, NULL, TASK_STACK_SIZE) \
- TASK_TEST(TESTB, TaskAbc, NULL, TASK_STACK_SIZE) \
- TASK_TEST(TESTC, TaskAbc, NULL, TASK_STACK_SIZE) \
- TASK_TEST(TICK, TaskTick, NULL, 256)
+ TASK_TEST(TESTA, task_abc, NULL, TASK_STACK_SIZE) \
+ TASK_TEST(TESTB, task_abc, NULL, TASK_STACK_SIZE) \
+ TASK_TEST(TESTC, task_abc, NULL, TASK_STACK_SIZE) \
+ TASK_TEST(TICK, task_tick, NULL, 256)
diff --git a/test/powerdemo.c b/test/powerdemo.c
index a5e79e0366..46bc3d8203 100644
--- a/test/powerdemo.c
+++ b/test/powerdemo.c
@@ -61,7 +61,7 @@ static void __set_state(int new_state, int pin_value, int timeout)
int power_demo_init(void)
{
- volatile uint32_t scratch __attribute__((unused));
+ volatile uint32_t scratch __attribute__((unused));
/* Set up TIMER1 as our state timer */
/* Enable TIMER1 clock */
diff --git a/test/stress.c b/test/stress.c
index 36afd5a587..a51ab416eb 100644
--- a/test/stress.c
+++ b/test/stress.c
@@ -128,7 +128,7 @@ __attribute__((weak)) int adc_read_all_channels(int *data)
int i;
int rv = EC_SUCCESS;
- for (i = 0 ; i < ADC_CH_COUNT; ++i) {
+ for (i = 0; i < ADC_CH_COUNT; ++i) {
data[i] = adc_read_channel(i);
if (data[i] == ADC_READ_ERROR)
rv = EC_ERROR_UNKNOWN;
diff --git a/test/timer_dos.c b/test/timer_dos.c
index 73b06d681e..69803f0a31 100644
--- a/test/timer_dos.c
+++ b/test/timer_dos.c
@@ -22,7 +22,7 @@ static uint32_t prng(uint32_t x)
#define TEST_TIME (3 * SECOND)
-int TaskTimer(void *seed)
+int task_timer(void *seed)
{
uint32_t num = (uint32_t)seed;
task_id_t id = task_get_current();
diff --git a/test/timer_dos.tasklist b/test/timer_dos.tasklist
index d34fd59010..3ebce139e2 100644
--- a/test/timer_dos.tasklist
+++ b/test/timer_dos.tasklist
@@ -15,7 +15,7 @@
* 's' is the stack size in bytes; must be a multiple of 8
*/
#define CONFIG_TEST_TASK_LIST \
- TASK_TEST(TMRA, TaskTimer, (void *)1234, TASK_STACK_SIZE) \
- TASK_TEST(TMRB, TaskTimer, (void *)5678, TASK_STACK_SIZE) \
- TASK_TEST(TMRC, TaskTimer, (void *)8462, TASK_STACK_SIZE) \
- TASK_TEST(TMRD, TaskTimer, (void *)3719, TASK_STACK_SIZE)
+ TASK_TEST(TMRA, task_timer, (void *)1234, TASK_STACK_SIZE) \
+ TASK_TEST(TMRB, task_timer, (void *)5678, TASK_STACK_SIZE) \
+ TASK_TEST(TMRC, task_timer, (void *)8462, TASK_STACK_SIZE) \
+ TASK_TEST(TMRD, task_timer, (void *)3719, TASK_STACK_SIZE)
diff --git a/util/ectool.c b/util/ectool.c
index a1361a6637..3c42045cda 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -761,7 +761,8 @@ int cmd_serial_test(int argc, char *argv[])
while (*c) {
/* Wait for space in transmit FIFO */
- while (!(inb(0x2fd) & 0x20)) {}
+ while (!(inb(0x2fd) & 0x20))
+ ;
/* Put the next character */
outb(*c++, 0x2f8);
@@ -3217,7 +3218,7 @@ static int get_value(const struct param_info *param, const char *config)
static int show_fields(struct ec_mkbp_config *config, int argc, char *argv[])
{
const struct param_info *param;
- uint32_t mask ;
+ uint32_t mask;
int i;
if (!argc) {
diff --git a/util/lock/csem.c b/util/lock/csem.c
index a84cbbb2b1..bdb49fd1da 100644
--- a/util/lock/csem.c
+++ b/util/lock/csem.c
@@ -72,9 +72,8 @@ static int does_semctl_set_otime(void)
/* create a test semaphore */
sem_id = semget(IPC_PRIVATE, 1, S_IRUSR|S_IWUSR);
- if (sem_id < 0) {
+ if (sem_id < 0)
return -1;
- }
/* set the value */
if (csem_setval(sem_id, 1) < 0) {
@@ -99,22 +98,21 @@ int csem_create(key_t key, unsigned val)
/* see if we need to trigger a semop to set sem_otime */
if (need_otime_hack < 0) {
int ret = does_semctl_set_otime();
- if (ret < 0) {
+ if (ret < 0)
return -1;
- }
+
need_otime_hack = !ret;
}
/* create it or fail */
sem_id = semget(key, 1, IPC_CREAT|IPC_EXCL | S_IRUSR|S_IWUSR);
- if (sem_id < 0) {
+ if (sem_id < 0)
return -1;
- }
/* initalize the value */
- if (need_otime_hack) {
+ if (need_otime_hack)
val++;
- }
+
if (csem_setval(sem_id, val) < 0) {
csem_destroy(sem_id);
return -1;
@@ -145,9 +143,8 @@ int csem_get(key_t key)
/* get the (assumed existing) semaphore */
sem_id = semget(key, 1, S_IRUSR|S_IWUSR);
- if (sem_id < 0) {
+ if (sem_id < 0)
return -1;
- }
/* loop until sem_otime != 0, which means it has been initialized */
for (i = 0; i < MAX_OTIME_LOOPS; i++) {
@@ -181,9 +178,8 @@ int csem_get_or_create(key_t key, unsigned val)
/* it must exist already - get it */
sem_id = csem_get(key);
- if (sem_id < 0) {
+ if (sem_id < 0)
return -1;
- }
return sem_id;
}
@@ -202,9 +198,9 @@ int csem_setval(int sem_id, unsigned val)
{
union semun arg;
arg.val = val;
- if (semctl(sem_id, 0, SETVAL, arg) < 0) {
+ if (semctl(sem_id, 0, SETVAL, arg) < 0)
return -1;
- }
+
return 0;
}
@@ -247,8 +243,8 @@ int csem_down_undo(int sem_id)
}
static int csem_down_timeout_undoflag(int sem_id,
- struct timespec *timeout,
- int undoflag)
+ struct timespec *timeout,
+ int undoflag)
{
struct sembuf sops;
sops.sem_num = 0;
@@ -272,8 +268,8 @@ time_t csem_get_otime(int sem_id)
union semun arg;
struct semid_ds ds;
arg.buf = &ds;
- if (semctl(sem_id, 0, IPC_STAT, arg) < 0) {
+ if (semctl(sem_id, 0, IPC_STAT, arg) < 0)
return -1;
- }
+
return ds.sem_otime;
}
diff --git a/util/lock/ipc_lock.c b/util/lock/ipc_lock.c
index 5bc816c894..790014e67b 100644
--- a/util/lock/ipc_lock.c
+++ b/util/lock/ipc_lock.c
@@ -40,9 +40,9 @@ static int lock_init(struct ipc_lock *lock)
if (lock->sem < 0) {
/* get or create the semaphore, init to 1 if needed */
int sem = csem_get_or_create(lock->key, 1);
- if (sem < 0) {
+ if (sem < 0)
return -1;
- }
+
lock->sem = sem;
}
return 0;
@@ -63,14 +63,13 @@ int acquire_lock(struct ipc_lock *lock, int timeout_msecs)
/* initialize the lock */
if (lock_init(lock) < 0) {
fprintf(stderr, "%s(): failed to init lock 0x%08x\n",
- __func__, (uint32_t)lock->key);
+ __func__, (uint32_t)lock->key);
return -1;
}
/* check if it is already held */
- if (lock->is_held) {
+ if (lock->is_held)
return 1;
- }
/* calculate the timeout */
if (timeout_msecs >= 0) {
@@ -84,7 +83,7 @@ int acquire_lock(struct ipc_lock *lock, int timeout_msecs)
ret = csem_down_timeout_undo(lock->sem, timeout_ptr);
if (ret < 0) {
fprintf(stderr, "%s(): failed to acquire lock 0x%08x\n",
- __func__, (uint32_t)lock->key);
+ __func__, (uint32_t)lock->key);
return -1;
}
@@ -101,6 +100,6 @@ int release_lock(struct ipc_lock *lock)
/* NOTE: do not destroy the semaphore, we want it to persist */
return 0;
}
- /* did not hold the lock */
- return -1;
+ /* did not hold the lock */
+ return -1;
}
diff --git a/util/stm32mon.c b/util/stm32mon.c
index 2c347dc908..e018e4898c 100644
--- a/util/stm32mon.c
+++ b/util/stm32mon.c
@@ -225,11 +225,11 @@ int send_command(int fd, uint8_t cmd, payload_t *loads, int cnt,
}
/* Send the command payloads */
- for (p = loads, c = 0; c < cnt ; c++, p++) {
+ for (p = loads, c = 0; c < cnt; c++, p++) {
crc = 0;
size = p->size;
data = p->data;
- for (i = 0; i < size ; i++)
+ for (i = 0; i < size; i++)
crc ^= data[i];
if (size == 1)
crc = 0xff ^ crc;
@@ -291,7 +291,7 @@ struct stm32_def *command_get_id(int fd)
return NULL;
}
chipid = (id[1] << 8) | id[2];
- for (def = chip_defs ; def->id ; def++)
+ for (def = chip_defs; def->id; def++)
if (def->id == chipid)
break;
if (def->id == 0)
@@ -625,7 +625,8 @@ int write_flash(int fd, struct stm32_def *chip, const char *filename,
free(buffer);
return -EIO;
}
- if ((res = fread(buffer, 1, size, hnd)) <= 0) {
+ res = fread(buffer, 1, size, hnd);
+ if (res <= 0) {
fprintf(stderr, "Cannot read %s\n", filename);
free(buffer);
return -EIO;