From 8bfc53036ae2e040287a92c8a9e8f84571a19080 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 12 Feb 2014 23:16:18 -0500 Subject: [PATCH] Fix checkpatch warnings --- src/cli/main.c | 2 +- src/common/cpu8051.c | 13 ++++++++----- src/common/opcode2c.pl | 16 ++++++---------- src/common/timers.c | 9 ++++++--- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/cli/main.c b/src/cli/main.c index fca5d9e..35f78d0 100644 --- a/src/cli/main.c +++ b/src/cli/main.c @@ -32,7 +32,7 @@ main(int argc, char **argv) if (options.filename != NULL) { rc = hexfile_load(options.filename); - if (rc == false) + if (!rc) exit(1); } diff --git a/src/common/cpu8051.c b/src/common/cpu8051.c index 10bc2d2..5a00709 100644 --- a/src/common/cpu8051.c +++ b/src/common/cpu8051.c @@ -173,7 +173,8 @@ cpu8051_interrupt_fire(int interrupt_no, int priority) static int cpu8051_interrupt_enabled(int interrupt_no) { - return (memory_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ? 1 : 0; + return (memory_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ? + 1 : 0; } static void @@ -200,8 +201,9 @@ cpu8051_check_interrupts(void) if (cpu8051_interrupt_enabled(INTERRUPT_1) && cpu8051_interrupt_fire(INTERRUPT_1, i) && (memory_read_direct(_TCON_) & 0x20)) { - memory_write_direct(_TCON_, - memory_read_direct(_TCON_) & 0xDF); + memory_write_direct( + _TCON_, + memory_read_direct(_TCON_) & 0xDF); cpu8051_process_interrupt(0x0B, i); return; } @@ -209,8 +211,9 @@ cpu8051_check_interrupts(void) if (cpu8051_interrupt_enabled(INTERRUPT_3) && cpu8051_interrupt_fire(INTERRUPT_3, i) && (memory_read_direct(_TCON_) & 0x80)) { - memory_write_direct(_TCON_, - memory_read_direct(_TCON_) & 0x7F); + memory_write_direct( + _TCON_, + memory_read_direct(_TCON_) & 0x7F); cpu8051_process_interrupt(0x1B, i); return; } diff --git a/src/common/opcode2c.pl b/src/common/opcode2c.pl index 27c9f56..5268785 100755 --- a/src/common/opcode2c.pl +++ b/src/common/opcode2c.pl @@ -834,17 +834,13 @@ print INST_DEF "\n"; print INST_DEF "/* Exported variables. */\n"; print INST_DEF "#ifdef INSTRUCTIONS_8051_M\n"; print INST_DEF "OPCODE_FP opcode_table[256] = {\n"; -for( $i=0; $i<256; $i++ ) { - $ifunc=substr($instfunction[$i], 9); - if( $i < 255 ) { - print INST_DEF " cpu8051_$ifunc,\n"; - } - else { - print INST_DEF " cpu8051_$ifunc\n"; - print INST_DEF "};\n"; - } -} +for ($i = 0; $i < 256; $i++) { + $ifunc = substr($instfunction[$i], 9); + + print INST_DEF "\tcpu8051_$ifunc,\n"; +} +print INST_DEF "};\n"; print INST_DEF "#else\n"; print INST_DEF "OPCODE_FP opcode_table[256];\n"; print INST_DEF "#endif\n\n\n"; diff --git a/src/common/timers.c b/src/common/timers.c index 3e7f3ec..53c2fb1 100644 --- a/src/common/timers.c +++ b/src/common/timers.c @@ -59,7 +59,8 @@ timer_increment_check_overflow(uint8_t counter_address, uint8_t tf_mask) tmp &= 0xFF; if (tmp == 0) { /* If overflow set TFx */ - memory_write_direct(_TCON_, memory_read_direct(_TCON_) | tf_mask); + memory_write_direct(_TCON_, + memory_read_direct(_TCON_) | tf_mask); } memory_write_direct(counter_address, tmp); /* Save new value. */ @@ -103,7 +104,9 @@ process_timer(uint8_t tl, uint8_t th, uint8_t tf_mask, uint8_t TR, uint8_t mode, tmp &= 0xFF; if (tmp == 0) { /* If overflow -> reload and set TF0 */ - memory_write_direct(_TCON_, memory_read_direct(_TCON_) | tf_mask); + memory_write_direct( + _TCON_, + memory_read_direct(_TCON_) | tf_mask); memory_write_direct(tl, memory_read_direct(th)); } else { memory_write_direct(tl, tmp); @@ -153,7 +156,7 @@ timers_check(void) /* Timer 1 */ tr = memory_read_direct(_TCON_) & 0x40; - mode = (memory_read_direct(_TMOD_) & 0x30) >> 4 ; + mode = (memory_read_direct(_TMOD_) & 0x30) >> 4; gate = memory_read_direct(_TMOD_) & 0x80; timer_counter = memory_read_direct(_TMOD_) & 0x40; -- 2.20.1