This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8858

-- gerrit

commit e387c668cee3e51945617554a62221f1741dd3cb
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sat Apr 19 17:05:16 2025 +0200

    target: armv7a: use proper type for struct armv7a_cache_common::outer_cache
    
    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.anto...@gmail.com>

diff --git a/src/target/armv7a.c b/src/target/armv7a.c
index fb8862611a..4d353dec65 100644
--- a/src/target/armv7a.c
+++ b/src/target/armv7a.c
@@ -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;
 
diff --git a/src/target/armv7a.h b/src/target/armv7a.h
index 8943f1c697..2706c4629b 100644
--- a/src/target/armv7a.h
+++ b/src/target/armv7a.h
@@ -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);
 };
 
diff --git a/src/target/armv7a_cache_l2x.c b/src/target/armv7a_cache_l2x.c
index 39c503f096..bc60e6d193 100644
--- a/src/target/armv7a_cache_l2x.c
+++ b/src/target/armv7a_cache_l2x.c
@@ -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");

-- 

Reply via email to