From 8d38a8459b0de45f5ff41f3e11c278a5cf395fd0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:35:56 -0700 Subject: mtd: Rename free() to rfree() This function name conflicts with our desire to #define free() to something else on sandbox. Since it deals with resources, rename it to rfree(). Signed-off-by: Simon Glass --- include/linux/mtd/mtd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index ceffd994de8..1b9151714c0 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -129,8 +129,8 @@ struct mtd_oob_region { struct mtd_ooblayout_ops { int (*ecc)(struct mtd_info *mtd, int section, struct mtd_oob_region *oobecc); - int (*free)(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobfree); + int (*rfree)(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobfree); }; /* -- cgit v1.2.3 From 1ea1c7d80f9dd7a4827cddf25fba71d0034510e4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:36:00 -0700 Subject: string: Allow arch override of strndup() also At present architectures can override strdup() but not strndup(). Use the same option for both. Signed-off-by: Simon Glass --- include/linux/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/string.h b/include/linux/string.h index 5d63be4ce5b..bb1d5ab07e3 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -93,8 +93,8 @@ size_t strcspn(const char *s, const char *reject); #ifndef __HAVE_ARCH_STRDUP extern char * strdup(const char *); -#endif extern char * strndup(const char *, size_t); +#endif #ifndef __HAVE_ARCH_STRSWAB extern char * strswab(const char *); #endif -- cgit v1.2.3 From f72bdc60b230f5e5d77eaad0b2defe07a46c02a9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:36:01 -0700 Subject: sandbox: Rename strdup() functions These functions include calls to a memory-allocation routine and so need to use the system routine when called from a library. To preserve access to these functions for libraries that need it, such as SDL, rename these functions within U-Boot. Signed-off-by: Simon Glass --- include/linux/string.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux') diff --git a/include/linux/string.h b/include/linux/string.h index bb1d5ab07e3..d67998e5c41 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -91,6 +91,11 @@ extern __kernel_size_t strnlen(const char *,__kernel_size_t); size_t strcspn(const char *s, const char *reject); #endif +#ifdef CONFIG_SANDBOX +# define strdup sandbox_strdup +# define strndup sandbox_strndup +#endif + #ifndef __HAVE_ARCH_STRDUP extern char * strdup(const char *); extern char * strndup(const char *, size_t); -- cgit v1.2.3 From 336d4615f8fa774557d14f9b3245daa9e5fe3dbc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:36:16 -0700 Subject: dm: core: Create a new header file for 'compat' features At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass --- include/linux/clk-provider.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 0ef6e685ad6..8a20743ad84 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -13,6 +13,7 @@ #include #include #include +#include static inline void clk_dm(ulong id, struct clk *clk) { -- cgit v1.2.3 From f217651575f30256955f22a1691115a70e7f5934 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:36:17 -0700 Subject: dm: core: Drop the inclusion of linux/compat.h in dm.h Most files don't need this header and it pulls in quite of lots of stuff, malloc() in particular. Drop it. Signed-off-by: Simon Glass --- include/linux/compat.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/compat.h b/include/linux/compat.h index d0f51baab40..171188a76f0 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -123,7 +123,10 @@ static inline void kmem_cache_destroy(struct kmem_cache *cachep) #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +/* This is also defined in ARMv8's mmu.h */ +#ifndef PAGE_SIZE #define PAGE_SIZE 4096 +#endif /* drivers/char/random.c */ #define get_random_bytes(...) -- cgit v1.2.3