diff mbox series

[7/7] cmd: cache: Remove weak functions

Message ID 20240619212759.3456158-7-trini@konsulko.com
State Accepted
Commit 7d6cee2cd0e2e2507aca1e3a6fe0e2cb241a116e
Delegated to: Tom Rini
Headers show
Series [1/7] m68k: Implement a default flush_dcache_all | expand

Commit Message

Tom Rini June 19, 2024, 9:27 p.m. UTC
It should be up to an architecture to decide how to implement cache
functions, and if they need to use weak functions or not. Allowing the
cache command to be built without cache functionality implemented is
unhelpful. Further, guard the call to noncached_set_region with
CONFIG_SYS_NONCACHED_MEMORY as that's when it's implemented and again is
an architecture specific detail.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
This patch series is intended to replace
https://patchwork.ozlabs.org/project/uboot/patch/20240616173105.7430-2-heinrich.schuchardt@canonical.com/
---
 cmd/cache.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

Comments

Ilias Apalodimas June 20, 2024, 5:48 a.m. UTC | #1
On Thu, 20 Jun 2024 at 00:28, Tom Rini <trini@konsulko.com> wrote:
>
> It should be up to an architecture to decide how to implement cache
> functions, and if they need to use weak functions or not. Allowing the
> cache command to be built without cache functionality implemented is
> unhelpful. Further, guard the call to noncached_set_region with
> CONFIG_SYS_NONCACHED_MEMORY as that's when it's implemented and again is
> an architecture specific detail.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> This patch series is intended to replace
> https://patchwork.ozlabs.org/project/uboot/patch/20240616173105.7430-2-heinrich.schuchardt@canonical.com/
> ---
>  cmd/cache.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/cmd/cache.c b/cmd/cache.c
> index 0254ff17f9b2..7a2068296ef1 100644
> --- a/cmd/cache.c
> +++ b/cmd/cache.c
> @@ -13,16 +13,6 @@
>
>  static int parse_argv(const char *);
>
> -void __weak invalidate_icache_all(void)
> -{
> -       /* please define arch specific invalidate_icache_all */
> -       puts("No arch specific invalidate_icache_all available!\n");
> -}
> -
> -__weak void noncached_set_region(void)
> -{
> -}
> -
>  static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
>                      char *const argv[])
>  {
> @@ -52,12 +42,6 @@ static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
>         return 0;
>  }
>
> -void __weak flush_dcache_all(void)
> -{
> -       puts("No arch specific flush_dcache_all available!\n");
> -       /* please define arch specific flush_dcache_all */
> -}
> -
>  static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
>                      char *const argv[])
>  {
> @@ -69,7 +53,9 @@ static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
>                         break;
>                 case 1:
>                         dcache_enable();
> +#ifdef CONFIG_SYS_NONCACHED_MEMORY
>                         noncached_set_region();
> +#endif
>                         break;
>                 case 2:
>                         flush_dcache_all();
> --
> 2.34.1
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/cmd/cache.c b/cmd/cache.c
index 0254ff17f9b2..7a2068296ef1 100644
--- a/cmd/cache.c
+++ b/cmd/cache.c
@@ -13,16 +13,6 @@ 
 
 static int parse_argv(const char *);
 
-void __weak invalidate_icache_all(void)
-{
-	/* please define arch specific invalidate_icache_all */
-	puts("No arch specific invalidate_icache_all available!\n");
-}
-
-__weak void noncached_set_region(void)
-{
-}
-
 static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
 		     char *const argv[])
 {
@@ -52,12 +42,6 @@  static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
-void __weak flush_dcache_all(void)
-{
-	puts("No arch specific flush_dcache_all available!\n");
-	/* please define arch specific flush_dcache_all */
-}
-
 static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
 		     char *const argv[])
 {
@@ -69,7 +53,9 @@  static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
 			break;
 		case 1:
 			dcache_enable();
+#ifdef CONFIG_SYS_NONCACHED_MEMORY
 			noncached_set_region();
+#endif
 			break;
 		case 2:
 			flush_dcache_all();