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 /util | |
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 'util')
-rw-r--r-- | util/ectool.c | 5 | ||||
-rw-r--r-- | util/lock/csem.c | 32 | ||||
-rw-r--r-- | util/lock/ipc_lock.c | 15 | ||||
-rw-r--r-- | util/stm32mon.c | 9 |
4 files changed, 29 insertions, 32 deletions
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; |