diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-12-17 13:43:17 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-12-19 00:12:28 +0000 |
commit | 6ab8e91658f1efc894b648cc0748af8d804915e4 (patch) | |
tree | c33da7914793452ecb37084e505230171d4eff9e /common | |
parent | e5935f17d1798a1f19c6003e57f140446774484f (diff) | |
download | chrome-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
Diffstat (limited to 'common')
-rw-r--r-- | common/battery.c | 4 | ||||
-rw-r--r-- | common/charge_state.c | 2 | ||||
-rw-r--r-- | common/fmap.c | 12 | ||||
-rw-r--r-- | common/i2c.c | 12 | ||||
-rw-r--r-- | common/lightbar.c | 10 | ||||
-rw-r--r-- | common/pmu_tps65090_charger.c | 5 | ||||
-rw-r--r-- | common/printf.c | 2 | ||||
-rw-r--r-- | common/sha256.c | 2 | ||||
-rw-r--r-- | common/timer.c | 2 | ||||
-rw-r--r-- | common/uart_buffering.c | 6 | ||||
-rw-r--r-- | common/util.c | 9 |
11 files changed, 35 insertions, 31 deletions
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; } |