From 842cb7a7ae59f5b298e138c0cddbe6fd7cf63f72 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Tue, 2 Jun 2015 21:02:21 -0700 Subject: [PATCH] [warnings] fix warnings post-smp Most of the warnings are printf related due to lk_time_t now being defined as an unsigned int instead of unsigned long. --- app/stringtests/string_tests.c | 14 +++++++------- arch/arm/arm-m/systick/systick.c | 2 +- arch/arm/arm/faults.c | 4 ++-- dev/timer/arm_cortex_a9/arm_cortex_a9_timer.c | 4 ++-- dev/timer/arm_generic/arm_generic_timer.c | 4 ++-- kernel/debug.c | 6 +++--- kernel/timer.c | 16 ++++++++-------- platform/microblaze/timer.c | 2 +- target/lpcexpresso1549/init.c | 4 +--- 9 files changed, 27 insertions(+), 29 deletions(-) diff --git a/app/stringtests/string_tests.c b/app/stringtests/string_tests.c index 763bc07a..2f740862 100644 --- a/app/stringtests/string_tests.c +++ b/app/stringtests/string_tests.c @@ -172,10 +172,10 @@ static void bench_memcpy(void) mine = bench_memcpy_routine(&mymemcpy, srcalign, dstalign); printf("srcalign %zu, dstalign %zu: ", srcalign, dstalign); - printf(" null memcpy %lu msecs\n", null); - printf("c memcpy %lu msecs, %llu bytes/sec; ", c, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / c); - printf("libc memcpy %lu msecs, %llu bytes/sec; ", libc, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / libc); - printf("my memcpy %lu msecs, %llu bytes/sec; ", mine, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / mine); + printf(" null memcpy %u msecs\n", null); + printf("c memcpy %u msecs, %llu bytes/sec; ", c, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / c); + printf("libc memcpy %u msecs, %llu bytes/sec; ", libc, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / libc); + printf("my memcpy %u msecs, %llu bytes/sec; ", mine, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / mine); printf("\n"); if (dstalign < 8) @@ -263,9 +263,9 @@ static void bench_memset(void) mine = bench_memset_routine(&mymemset, dstalign, BUFFER_SIZE); printf("dstalign %zu: ", dstalign); - printf("c memset %lu msecs, %llu bytes/sec; ", c, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / c); - printf("libc memset %lu msecs, %llu bytes/sec; ", libc, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / libc); - printf("my memset %lu msecs, %llu bytes/sec; ", mine, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / mine); + printf("c memset %u msecs, %llu bytes/sec; ", c, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / c); + printf("libc memset %u msecs, %llu bytes/sec; ", libc, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / libc); + printf("my memset %u msecs, %llu bytes/sec; ", mine, (uint64_t)BUFFER_SIZE * ITERATIONS * 1000ULL / mine); printf("\n"); } } diff --git a/arch/arm/arm-m/systick/systick.c b/arch/arm/arm-m/systick/systick.c index e9f0765f..dd3637e3 100644 --- a/arch/arm/arm-m/systick/systick.c +++ b/arch/arm/arm-m/systick/systick.c @@ -86,7 +86,7 @@ void _systick(void) status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval) { - LTRACEF("callback %p, arg %p, interval %ld\n", callback, arg, interval); + LTRACEF("callback %p, arg %p, interval %u\n", callback, arg, interval); DEBUG_ASSERT(tick_rate != 0 && tick_rate_mhz != 0); diff --git a/arch/arm/arm/faults.c b/arch/arm/arm/faults.c index ad4cd56f..28225227 100644 --- a/arch/arm/arm/faults.c +++ b/arch/arm/arm/faults.c @@ -187,7 +187,7 @@ void arm_data_abort_handler(struct arm_fault_frame *frame) break; case 0b01001: case 0b01011: // domain fault - dprintf(CRITICAL, "domain fault, domain %d\n", BITS_SHIFT(fsr, 7, 4)); + dprintf(CRITICAL, "domain fault, domain %lu\n", BITS_SHIFT(fsr, 7, 4)); break; case 0b01101: case 0b01111: // permission fault @@ -246,7 +246,7 @@ void arm_prefetch_abort_handler(struct arm_fault_frame *frame) break; case 0b01001: case 0b01011: // domain fault - dprintf(CRITICAL, "domain fault, domain %d\n", BITS_SHIFT(fsr, 7, 4)); + dprintf(CRITICAL, "domain fault, domain %lu\n", BITS_SHIFT(fsr, 7, 4)); break; case 0b01101: case 0b01111: // permission fault diff --git a/dev/timer/arm_cortex_a9/arm_cortex_a9_timer.c b/dev/timer/arm_cortex_a9/arm_cortex_a9_timer.c index ce7077b9..ed06d546 100644 --- a/dev/timer/arm_cortex_a9/arm_cortex_a9_timer.c +++ b/dev/timer/arm_cortex_a9/arm_cortex_a9_timer.c @@ -115,7 +115,7 @@ lk_time_t current_time(void) status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval) { - LTRACEF("callback %p, arg %p, interval %lu\n", callback, arg, interval); + LTRACEF("callback %p, arg %p, interval %u\n", callback, arg, interval); uint64_t ticks = u64_mul_u64_fp32_64(interval, timer_freq_msec_conversion); if (unlikely(ticks == 0)) @@ -143,7 +143,7 @@ status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg status_t platform_set_oneshot_timer (platform_timer_callback callback, void *arg, lk_time_t interval) { - LTRACEF("callback %p, arg %p, timeout %lu\n", callback, arg, interval); + LTRACEF("callback %p, arg %p, timeout %u\n", callback, arg, interval); uint64_t ticks = u64_mul_u64_fp32_64(interval, timer_freq_msec_conversion); if (unlikely(ticks == 0)) diff --git a/dev/timer/arm_generic/arm_generic_timer.c b/dev/timer/arm_generic/arm_generic_timer.c index 6193be3b..e42022af 100644 --- a/dev/timer/arm_generic/arm_generic_timer.c +++ b/dev/timer/arm_generic/arm_generic_timer.c @@ -259,7 +259,7 @@ static void test_lk_time_to_cntpct(uint32_t cntfrq, lk_time_t lk_time) uint64_t expected_cntpct = ((uint64_t)cntfrq * lk_time + 500) / 1000; test_time_conversion_check_result(cntpct, expected_cntpct, 1, false); - LTRACEF_LEVEL(2, "lk_time_to_cntpct(%lu): got %llu, expect %llu\n", lk_time, cntpct, expected_cntpct); + LTRACEF_LEVEL(2, "lk_time_to_cntpct(%u): got %llu, expect %llu\n", lk_time, cntpct, expected_cntpct); } static void test_cntpct_to_lk_time(uint32_t cntfrq, lk_time_t expected_lk_time, uint32_t wrap_count) @@ -275,7 +275,7 @@ static void test_cntpct_to_lk_time(uint32_t cntfrq, lk_time_t expected_lk_time, lk_time = cntpct_to_lk_time(cntpct); test_time_conversion_check_result(lk_time, expected_lk_time, (1000 + cntfrq - 1) / cntfrq, true); - LTRACEF_LEVEL(2, "cntpct_to_lk_time(%llu): got %lu, expect %lu\n", cntpct, lk_time, expected_lk_time); + LTRACEF_LEVEL(2, "cntpct_to_lk_time(%llu): got %u, expect %u\n", cntpct, lk_time, expected_lk_time); } static void test_cntpct_to_lk_bigtime(uint32_t cntfrq, uint64_t expected_s) diff --git a/kernel/debug.c b/kernel/debug.c index d66cbaa0..06d1da20 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -212,13 +212,13 @@ static void kevdump_cb(const uintptr_t *i) printf("%lu.%lu: timer call %p, arg %p\n", i[0], i[1] >> 16, (void *)i[2], (void *)i[3]); break; case KERNEL_EVLOG_IRQ_ENTER: - printf("%lu.%lu: irq entry %u\n", i[0], i[1] >> 16, (uint)i[2]); + printf("%lu.%lu: irq entry %lu\n", i[0], i[1] >> 16, i[2]); break; case KERNEL_EVLOG_IRQ_EXIT: - printf("%lu.%lu: irq exit %u\n", i[0], i[1] >> 16, (uint)i[2]); + printf("%lu.%lu: irq exit %lu\n", i[0], i[1] >> 16, i[2]); break; default: - printf("%lu: unknown id 0x%x 0x%x 0x%x\n", i[0], i[1], (uint)i[2], (uint)i[3]); + printf("%lu: unknown id 0x%lx 0x%lx 0x%lx\n", i[0], i[1], i[2], i[3]); } } diff --git a/kernel/timer.c b/kernel/timer.c index 48ec7dad..7aaa9e5e 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -71,7 +71,7 @@ static void insert_timer_in_queue(uint cpu, timer_t *timer) DEBUG_ASSERT(arch_ints_disabled()); - LTRACEF("timer %p, cpu %u, scheduled %lu, periodic %lu\n", timer, cpu, timer->scheduled_time, timer->periodic_time); + LTRACEF("timer %p, cpu %u, scheduled %u, periodic %u\n", timer, cpu, timer->scheduled_time, timer->periodic_time); list_for_every_entry(&timers[cpu].timer_queue, entry, timer_t, node) { if (TIME_GT(entry->scheduled_time, timer->scheduled_time)) { @@ -88,7 +88,7 @@ static void timer_set(timer_t *timer, lk_time_t delay, lk_time_t period, timer_c { lk_time_t now; - LTRACEF("timer %p, delay %lu, period %lu, callback %p, arg %p\n", timer, delay, period, callback, arg); + LTRACEF("timer %p, delay %u, period %u, callback %p, arg %p\n", timer, delay, period, callback, arg); DEBUG_ASSERT(timer->magic == TIMER_MAGIC); @@ -102,7 +102,7 @@ static void timer_set(timer_t *timer, lk_time_t delay, lk_time_t period, timer_c timer->callback = callback; timer->arg = arg; - LTRACEF("scheduled time %lu\n", timer->scheduled_time); + LTRACEF("scheduled time %u\n", timer->scheduled_time); spin_lock_saved_state_t state; spin_lock_irqsave(&timer_lock, state); @@ -113,7 +113,7 @@ static void timer_set(timer_t *timer, lk_time_t delay, lk_time_t period, timer_c #if PLATFORM_HAS_DYNAMIC_TIMER if (list_peek_head_type(&timers[cpu].timer_queue, timer_t, node) == timer) { /* we just modified the head of the timer queue */ - LTRACEF("setting new timer for %u msecs\n", (uint)delay); + LTRACEF("setting new timer for %u msecs\n", delay); platform_set_oneshot_timer(timer_tick, NULL, delay); } #endif @@ -225,7 +225,7 @@ static enum handler_return timer_tick(void *arg, lk_time_t now) uint cpu = arch_curr_cpu_num(); - LTRACEF("cpu %u now %lu, sp %p\n", cpu, now, __GET_FRAME()); + LTRACEF("cpu %u now %u, sp %p\n", cpu, now, __GET_FRAME()); spin_lock(&timer_lock); @@ -234,7 +234,7 @@ static enum handler_return timer_tick(void *arg, lk_time_t now) timer = list_peek_head_type(&timers[cpu].timer_queue, timer_t, node); if (likely(timer == 0)) break; - LTRACEF("next item on timer queue %p at %lu now %lu (%p, arg %p)\n", timer, timer->scheduled_time, now, timer->callback, timer->arg); + LTRACEF("next item on timer queue %p at %u now %u (%p, arg %p)\n", timer, timer->scheduled_time, now, timer->callback, timer->arg); if (likely(TIME_LT(now, timer->scheduled_time))) break; @@ -246,7 +246,7 @@ static enum handler_return timer_tick(void *arg, lk_time_t now) /* we pulled it off the list, release the list lock to handle it */ spin_unlock(&timer_lock); - LTRACEF("dequeued timer %p, scheduled %lu periodic %lu\n", timer, timer->scheduled_time, timer->periodic_time); + LTRACEF("dequeued timer %p, scheduled %u periodic %u\n", timer, timer->scheduled_time, timer->periodic_time); THREAD_STATS_INC(timers); @@ -264,7 +264,7 @@ static enum handler_return timer_tick(void *arg, lk_time_t now) * by the callback put it back in the list */ if (periodic && !list_in_list(&timer->node) && timer->periodic_time > 0) { - LTRACEF("periodic timer, period %u\n", (uint)timer->periodic_time); + LTRACEF("periodic timer, period %u\n", timer->periodic_time); timer->scheduled_time = now + timer->periodic_time; insert_timer_in_queue(cpu, timer); } diff --git a/platform/microblaze/timer.c b/platform/microblaze/timer.c index 7f9bc448..f90bb966 100644 --- a/platform/microblaze/timer.c +++ b/platform/microblaze/timer.c @@ -60,7 +60,7 @@ static uint32_t ticks = 0; status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval) { - LTRACEF("cb %p, arg %p, interval %ld\n", callback, arg, interval); + LTRACEF("cb %p, arg %p, interval %u\n", callback, arg, interval); uint32_t count = ((uint64_t)TIMER_RATE * interval / 1000); diff --git a/target/lpcexpresso1549/init.c b/target/lpcexpresso1549/init.c index 53de1be1..606e4ab7 100644 --- a/target/lpcexpresso1549/init.c +++ b/target/lpcexpresso1549/init.c @@ -114,8 +114,6 @@ STATIC const SWM_GRP_T swmSetup[] = { /* Sets up system pin muxing */ void Board_SetupMuxing(void) { - int i; - /* Enable SWM and IOCON clocks */ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON); Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); @@ -125,7 +123,7 @@ void Board_SetupMuxing(void) Chip_IOCON_SetPinMuxing(LPC_IOCON, ioconSetup, sizeof(ioconSetup) / sizeof(PINMUX_GRP_T)); /* SWM assignable pin setup */ - for (i = 0; i < (sizeof(swmSetup) / sizeof(SWM_GRP_T)); i++) { + for (uint i = 0; i < (sizeof(swmSetup) / sizeof(SWM_GRP_T)); i++) { Chip_SWM_MovablePortPinAssign((CHIP_SWM_PIN_MOVABLE_T) swmSetup[i].assignedpin, swmSetup[i].port, swmSetup[i].pin); }