]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
target: armv7a: use proper type for struct armv7a_cache_common::outer_cache
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 19 Apr 2025 15:05:16 +0000 (17:05 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 9 May 2025 12:09:34 +0000 (12:09 +0000)
The field 'outer_cache' is always initialized and used as a
pointer to 'struct armv7a_l2x_cache'.
There is no reason for using type 'void *' for it.

Change the type of 'outer_cache'.
Drop the useless cast while reading 'outer_cache'.

Change-Id: Iaea9d02e247da26e230f887c85fbf8e9d7be34d5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8858
Tested-by: jenkins
src/target/armv7a.c
src/target/armv7a.h
src/target/armv7a_cache_l2x.c

index fb8862611a02a7eaa710eaba8cacf415e4e6e057..4d353dec65396bd2046856ff25ec109dfa50c502 100644 (file)
@@ -182,8 +182,7 @@ done:
 int armv7a_handle_cache_info_command(struct command_invocation *cmd,
        struct armv7a_cache_common *armv7a_cache)
 {
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a_cache->outer_cache);
+       struct armv7a_l2x_cache *l2x_cache = armv7a_cache->outer_cache;
 
        int cl;
 
index 8943f1c6972a22c933d6b30f67cf2d60d1bfeecf..2706c4629b1de2295df34571e1a827604d511fe9 100644 (file)
@@ -66,7 +66,7 @@ struct armv7a_cache_common {
        int i_cache_enabled;
        int d_u_cache_enabled;
        /* outer unified cache if some */
-       void *outer_cache;
+       struct armv7a_l2x_cache *outer_cache;
        int (*flush_all_data_cache)(struct target *target);
 };
 
index 39c503f0966be0847756264959bd4e4ea3f81ba5..bc60e6d193e6e3d9128775d5e3adb8a8062d041d 100644 (file)
@@ -21,8 +21,8 @@
 static int arm7a_l2x_sanity_check(struct target *target)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a->armv7a_mmu.armv7a_cache.outer_cache);
+       struct armv7a_l2x_cache *l2x_cache =
+               armv7a->armv7a_mmu.armv7a_cache.outer_cache;
 
        if (target->state != TARGET_HALTED) {
                LOG_ERROR("%s: target not halted", __func__);
@@ -42,8 +42,8 @@ static int arm7a_l2x_sanity_check(struct target *target)
 int arm7a_l2x_flush_all_data(struct target *target)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a->armv7a_mmu.armv7a_cache.outer_cache);
+       struct armv7a_l2x_cache *l2x_cache =
+               armv7a->armv7a_mmu.armv7a_cache.outer_cache;
        uint32_t l2_way_val;
        int retval;
 
@@ -62,8 +62,8 @@ int armv7a_l2x_cache_flush_virt(struct target *target, target_addr_t virt,
                                        uint32_t size)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a->armv7a_mmu.armv7a_cache.outer_cache);
+       struct armv7a_l2x_cache *l2x_cache =
+               armv7a->armv7a_mmu.armv7a_cache.outer_cache;
        /* FIXME: different controllers have different linelen? */
        uint32_t i, linelen = 32;
        int retval;
@@ -97,8 +97,8 @@ static int armv7a_l2x_cache_inval_virt(struct target *target, target_addr_t virt
                                        uint32_t size)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a->armv7a_mmu.armv7a_cache.outer_cache);
+       struct armv7a_l2x_cache *l2x_cache =
+               armv7a->armv7a_mmu.armv7a_cache.outer_cache;
        /* FIXME: different controllers have different linelen */
        uint32_t i, linelen = 32;
        int retval;
@@ -132,8 +132,8 @@ static int armv7a_l2x_cache_clean_virt(struct target *target, target_addr_t virt
                                        unsigned int size)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a->armv7a_mmu.armv7a_cache.outer_cache);
+       struct armv7a_l2x_cache *l2x_cache =
+               armv7a->armv7a_mmu.armv7a_cache.outer_cache;
        /* FIXME: different controllers have different linelen */
        uint32_t i, linelen = 32;
        int retval;
@@ -166,8 +166,7 @@ done:
 static int arm7a_handle_l2x_cache_info_command(struct command_invocation *cmd,
        struct armv7a_cache_common *armv7a_cache)
 {
-       struct armv7a_l2x_cache *l2x_cache = (struct armv7a_l2x_cache *)
-               (armv7a_cache->outer_cache);
+       struct armv7a_l2x_cache *l2x_cache = armv7a_cache->outer_cache;
 
        if (armv7a_cache->info == -1) {
                command_print(cmd, "cache not yet identified");