summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-12-02 22:05:35 -0500
committerTom Rini <trini@konsulko.com>2019-12-02 22:05:35 -0500
commita4ef0657e3075d0f951d78cc1398cb7e05af648a (patch)
tree9a4387de5845e6fd1331f0af32bfd82fac9eb039 /lib
parent357040645f9f56b33909520483df9f840be7e181 (diff)
parentcb3ef6810a27c8ddf5db8694bcef9337f27d12ce (diff)
Merge branch '2019-12-02-master-imports'
- A large series of clean-ups to reduce common.h contents
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile4
-rw-r--r--lib/crc32.c5
-rw-r--r--lib/crc8.c7
-rw-r--r--lib/efi_loader/efi_boottime.c3
-rw-r--r--lib/efi_loader/efi_console.c1
-rw-r--r--lib/efi_loader/efi_image_loader.c1
-rw-r--r--lib/efi_loader/efi_memory.c1
-rw-r--r--lib/efi_loader/efi_runtime.c2
-rw-r--r--lib/efi_loader/efi_variable.c1
-rw-r--r--lib/efi_selftest/efi_selftest_config_table.c1
-rw-r--r--lib/efi_selftest/efi_selftest_crc32.c1
-rw-r--r--lib/gunzip.c1
-rw-r--r--lib/hashtable.c1
-rw-r--r--lib/lz4_wrapper.c1
-rw-r--r--lib/qsort.c1
-rw-r--r--lib/rand.c1
-rw-r--r--lib/strmhz.c21
-rw-r--r--lib/time.c1
-rw-r--r--lib/trace.c1
-rw-r--r--lib/uuid.c1
-rw-r--r--lib/vsprintf.c19
-rw-r--r--lib/zlib/deflate.c1
22 files changed, 50 insertions, 26 deletions
diff --git a/lib/Makefile b/lib/Makefile
index d248d8626ce..e15a189f65b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -109,12 +109,12 @@ ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y)
ifdef CONFIG_$(SPL_TPL_)USE_TINY_PRINTF
obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o
else
-obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += vsprintf.o strmhz.o
+obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += vsprintf.o
endif
obj-$(CONFIG_$(SPL_TPL_)STRTO) += strto.o
else
# Main U-Boot always uses the full printf support
-obj-y += vsprintf.o strto.o strmhz.o
+obj-y += vsprintf.o strto.o
endif
subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
diff --git a/lib/crc32.c b/lib/crc32.c
index eee21f8d739..e9be3bf386e 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -10,6 +10,7 @@
#ifdef USE_HOSTCC
#include <arpa/inet.h>
+#include <u-boot/crc.h>
#else
#include <common.h>
#include <efi_loader.h>
@@ -244,12 +245,12 @@ uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len,
chunk = end - curr;
if (chunk > chunk_sz)
chunk = chunk_sz;
- crc = crc32 (crc, curr, chunk);
+ crc = crc32(crc, curr, chunk);
curr += chunk;
WATCHDOG_RESET ();
}
#else
- crc = crc32 (crc, buf, len);
+ crc = crc32(crc, buf, len);
#endif
return crc;
diff --git a/lib/crc8.c b/lib/crc8.c
index 55f7c07285c..87b87b675b2 100644
--- a/lib/crc8.c
+++ b/lib/crc8.c
@@ -3,7 +3,12 @@
* Copyright (c) 2013 Google, Inc
*/
-#include "linux/crc8.h"
+#ifdef USE_HOSTCC
+#include <arpa/inet.h>
+#else
+#include <common.h>
+#endif
+#include <u-boot/crc.h>
#define POLY (0x1070U << 3)
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 493d906c641..88a7604bbf3 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -8,11 +8,14 @@
#include <common.h>
#include <div64.h>
#include <efi_loader.h>
+#include <irq_func.h>
#include <malloc.h>
+#include <time.h>
#include <linux/libfdt_env.h>
#include <u-boot/crc.h>
#include <bootm.h>
#include <pe.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index a55e4b33ece..218f7caa12f 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <charset.h>
+#include <time.h>
#include <dm/device.h>
#include <efi_loader.h>
#include <env.h>
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index 13541cfa7a2..d5de6df16d8 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <cpu_func.h>
#include <efi_loader.h>
#include <pe.h>
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index d46001f608b..89adf203102 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <efi_loader.h>
+#include <init.h>
#include <malloc.h>
#include <mapmem.h>
#include <watchdog.h>
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index ced00516f73..df0485cdad3 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -7,10 +7,12 @@
#include <common.h>
#include <command.h>
+#include <cpu_func.h>
#include <dm.h>
#include <elf.h>
#include <efi_loader.h>
#include <rtc.h>
+#include <u-boot/crc.h>
/* For manual relocation support */
DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 46f35bc60ba..c316bdfec0e 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -11,6 +11,7 @@
#include <hexdump.h>
#include <malloc.h>
#include <search.h>
+#include <u-boot/crc.h>
#define READ_ONLY BIT(31)
diff --git a/lib/efi_selftest/efi_selftest_config_table.c b/lib/efi_selftest/efi_selftest_config_table.c
index 4467f492ac5..2bf12b5bb68 100644
--- a/lib/efi_selftest/efi_selftest_config_table.c
+++ b/lib/efi_selftest/efi_selftest_config_table.c
@@ -9,6 +9,7 @@
*/
#include <efi_selftest.h>
+#include <u-boot/crc.h>
static const struct efi_system_table *sys_table;
static struct efi_boot_services *boottime;
diff --git a/lib/efi_selftest/efi_selftest_crc32.c b/lib/efi_selftest/efi_selftest_crc32.c
index 4881e8ac6f2..19153c759aa 100644
--- a/lib/efi_selftest/efi_selftest_crc32.c
+++ b/lib/efi_selftest/efi_selftest_crc32.c
@@ -10,6 +10,7 @@
*/
#include <efi_selftest.h>
+#include <u-boot/crc.h>
const struct efi_system_table *st;
efi_status_t (EFIAPI *bs_crc32)(const void *data, efi_uintn_t data_size,
diff --git a/lib/gunzip.c b/lib/gunzip.c
index 1d65616c13d..9e6ccd692a3 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -12,6 +12,7 @@
#include <image.h>
#include <malloc.h>
#include <memalign.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
#include <u-boot/zlib.h>
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 2caab0a4c6d..907e8a642f3 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -14,6 +14,7 @@
#include <errno.h>
#include <malloc.h>
+#include <sort.h>
#ifdef USE_HOSTCC /* HOST build */
# include <string.h>
diff --git a/lib/lz4_wrapper.c b/lib/lz4_wrapper.c
index 1c68e67452d..1e1e8d50853 100644
--- a/lib/lz4_wrapper.c
+++ b/lib/lz4_wrapper.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <compiler.h>
#include <image.h>
+#include <lz4.h>
#include <linux/kernel.h>
#include <linux/types.h>
diff --git a/lib/qsort.c b/lib/qsort.c
index 57098841f9a..f63d4ef7268 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -18,6 +18,7 @@
#include <linux/types.h>
#include <common.h>
#include <exports.h>
+#include <sort.h>
void qsort(void *base,
size_t nel,
diff --git a/lib/rand.c b/lib/rand.c
index af4cf3a0e8c..d256baf5cee 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <rand.h>
static unsigned int y = 1U;
diff --git a/lib/strmhz.c b/lib/strmhz.c
deleted file mode 100644
index 66afe91ab99..00000000000
--- a/lib/strmhz.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2002-2006
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- */
-#include <common.h>
-
-char *strmhz (char *buf, unsigned long hz)
-{
- long l, n;
- long m;
-
- n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
- l = sprintf (buf, "%ld", n);
-
- hz -= n * 1000000L;
- m = DIV_ROUND_CLOSEST(hz, 1000L);
- if (m != 0)
- sprintf (buf + l, ".%03ld", m);
- return (buf);
-}
diff --git a/lib/time.c b/lib/time.c
index f30fc05804b..75de48f9003 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <time.h>
#include <timer.h>
#include <watchdog.h>
#include <div64.h>
diff --git a/lib/trace.c b/lib/trace.c
index f2402b93593..6716c7c2f09 100644
--- a/lib/trace.c
+++ b/lib/trace.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <mapmem.h>
+#include <time.h>
#include <trace.h>
#include <asm/io.h>
#include <asm/sections.h>
diff --git a/lib/uuid.c b/lib/uuid.c
index a48e19c06ea..3d3c7abcaea 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <env.h>
+#include <time.h>
#include <linux/ctype.h>
#include <errno.h>
#include <common.h>
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 425f2f53f79..c6467ecd5ff 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2,6 +2,8 @@
* linux/lib/vsprintf.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
@@ -17,6 +19,7 @@
#include <div64.h>
#include <hexdump.h>
#include <stdarg.h>
+#include <vsprintf.h>
#include <linux/ctype.h>
#include <linux/err.h>
#include <linux/types.h>
@@ -873,3 +876,19 @@ bool str2long(const char *p, ulong *num)
*num = simple_strtoul(p, &endptr, 16);
return *p != '\0' && *endptr == '\0';
}
+
+char *strmhz(char *buf, unsigned long hz)
+{
+ long l, n;
+ long m;
+
+ n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
+ l = sprintf(buf, "%ld", n);
+
+ hz -= n * 1000000L;
+ m = DIV_ROUND_CLOSEST(hz, 1000L);
+ if (m != 0)
+ sprintf(buf + l, ".%03ld", m);
+
+ return buf;
+}
diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c
index 9a20b703448..1fe58d5da6c 100644
--- a/lib/zlib/deflate.c
+++ b/lib/zlib/deflate.c
@@ -50,6 +50,7 @@
/* @(#) $Id$ */
#include "deflate.h"
+#include <u-boot/crc.h>
const char deflate_copyright[] =
" deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";