Skip to content

Commit 506f21b

Browse files
Wayne Rennashif
authored andcommitted
arch: arc: small optimization in mpu driver
to avoid _get_num_regions to access the aux reg each time in the for loop Signed-off-by: Wayne Ren <[email protected]>
1 parent eab5ff7 commit 506f21b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arc/core/mpu/arc_mpu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ void arc_core_mpu_enable(void)
296296
* simulate MPU enable
297297
*/
298298
#elif CONFIG_ARC_MPU_VER == 3
299-
arc_core_mpu_default(0);
299+
#define MPU_ENABLE_ATTR 0
300+
arc_core_mpu_default(MPU_ENABLE_ATTR);
300301
#endif
301302
}
302303

@@ -506,7 +507,8 @@ void arc_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain)
506507
* it doesn't work for memory domain, because the dynamic region numbers.
507508
* So be careful to avoid the overlap situation.
508509
*/
509-
for (; region_index < _get_num_regions() - 1; region_index++) {
510+
u32_t num_regions = _get_num_regions() - 1;
511+
for (; region_index < num_regions; region_index++) {
510512
#endif
511513
if (num_partitions && pparts->size) {
512514
SYS_LOG_DBG("set region 0x%x 0x%x 0x%x",

0 commit comments

Comments
 (0)