Fix the following errors and warnings detected by checkpatch.pl:
ERROR: Bad function definition - void init_timer() should probably be void init_timer(void)
ERROR: Prefixing 0x with decimal output is defective
WARNING: Comparisons should place the constant on the right side of the test
WARNING: char * array declaration might be better as static const
TEST=Build and run on Galileo Gen2
Change-Id: Iec5a6af53d53d9d96c60c3fc7b70d4e20bcef1fc
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 36984d85e7
Original-Change-Id: I9f618eea95e1f92fa34f4f89da27c0b16ae7f4ee
Original-Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Original-Reviewed-on: https://review.coreboot.org/18763
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/455830
40 lines
1 KiB
C
40 lines
1 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <console/console.h>
|
|
#include <timer.h>
|
|
#include <delay.h>
|
|
#include <thread.h>
|
|
|
|
__attribute__((weak)) void init_timer(void) { /* do nothing */ }
|
|
|
|
void udelay(unsigned int usec)
|
|
{
|
|
struct stopwatch sw;
|
|
|
|
/*
|
|
* As the timer granularity is in microseconds pad the
|
|
* requested delay by one to get at least >= requested usec delay.
|
|
*/
|
|
usec += 1;
|
|
|
|
if (!thread_yield_microseconds(usec))
|
|
return;
|
|
|
|
stopwatch_init_usecs_expire(&sw, usec);
|
|
|
|
while (!stopwatch_expired(&sw))
|
|
;
|
|
}
|