Skip to content

Commit f05111d

Browse files
dcpleungnashif
authored andcommitted
kernel: rename Z_KERNEL_STACK_LEN to K_KERNEL_STACK_LEN
Since there is a K_THREAD_STACK_LEN, its kernel counterpart should also be prefixed with K_ for consistency. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent 42356b6 commit f05111d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

include/zephyr/arch/arc/arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ BUILD_ASSERT(CONFIG_PRIVILEGED_STACK_SIZE % Z_ARC_MPU_ALIGN == 0,
188188
* in another area of memory generated at build time by gen_kobject_list.py
189189
*
190190
* +------------+ <- thread.arch.priv_stack_start
191-
* | Priv Stack | } Z_KERNEL_STACK_LEN(CONFIG_PRIVILEGED_STACK_SIZE)
191+
* | Priv Stack | } K_KERNEL_STACK_LEN(CONFIG_PRIVILEGED_STACK_SIZE)
192192
* +------------+
193193
*
194194
* +------------+ <- thread.stack_obj = thread.stack_info.start

include/zephyr/kernel/thread_stack.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static inline char *z_stack_ptr_align(char *ptr)
104104
#define Z_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN
105105
#endif /* ARCH_KERNEL_STACK_OBJ_ALIGN */
106106

107-
#define Z_KERNEL_STACK_LEN(size) \
107+
#define K_KERNEL_STACK_LEN(size) \
108108
ROUND_UP(Z_KERNEL_STACK_SIZE_ADJUST(size), Z_KERNEL_STACK_OBJ_ALIGN)
109109

110110
/**
@@ -137,7 +137,7 @@ static inline char *z_stack_ptr_align(char *ptr)
137137
*/
138138
#define K_KERNEL_STACK_ARRAY_DECLARE(sym, nmemb, size) \
139139
extern struct z_thread_stack_element \
140-
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
140+
sym[nmemb][K_KERNEL_STACK_LEN(size)]
141141

142142
/**
143143
* @brief Declare a reference to a pinned thread stack array
@@ -151,7 +151,7 @@ static inline char *z_stack_ptr_align(char *ptr)
151151
*/
152152
#define K_KERNEL_PINNED_STACK_ARRAY_DECLARE(sym, nmemb, size) \
153153
extern struct z_thread_stack_element \
154-
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
154+
sym[nmemb][K_KERNEL_STACK_LEN(size)]
155155

156156
/**
157157
* @brief Define a toplevel kernel stack memory region in specified section
@@ -188,7 +188,7 @@ static inline char *z_stack_ptr_align(char *ptr)
188188
#define Z_KERNEL_STACK_ARRAY_DEFINE_IN(sym, nmemb, size, lsect) \
189189
struct z_thread_stack_element lsect \
190190
__aligned(Z_KERNEL_STACK_OBJ_ALIGN) \
191-
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
191+
sym[nmemb][K_KERNEL_STACK_LEN(size)]
192192

193193
/**
194194
* @brief Define a toplevel kernel stack memory region
@@ -290,7 +290,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
290290
#ifndef CONFIG_USERSPACE
291291
#define K_THREAD_STACK_RESERVED K_KERNEL_STACK_RESERVED
292292
#define K_THREAD_STACK_SIZEOF K_KERNEL_STACK_SIZEOF
293-
#define K_THREAD_STACK_LEN Z_KERNEL_STACK_LEN
293+
#define K_THREAD_STACK_LEN K_KERNEL_STACK_LEN
294294
#define K_THREAD_STACK_DEFINE K_KERNEL_STACK_DEFINE
295295
#define K_THREAD_STACK_ARRAY_DEFINE K_KERNEL_STACK_ARRAY_DEFINE
296296
#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER

scripts/build/gen_kobject_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def write_gperf_table(fp, syms, objs, little_endian, static_begin, static_end):
794794
# memory section.
795795
fp.write("static uint8_t Z_GENERIC_SECTION(.priv_stacks.noinit) "
796796
" __aligned(Z_KERNEL_STACK_OBJ_ALIGN)"
797-
" priv_stacks[%d][Z_KERNEL_STACK_LEN(CONFIG_PRIVILEGED_STACK_SIZE)];\n"
797+
" priv_stacks[%d][K_KERNEL_STACK_LEN(CONFIG_PRIVILEGED_STACK_SIZE)];\n"
798798
% stack_counter)
799799

800800
fp.write("static const struct z_stack_data stack_data[%d] = {\n"

tests/kernel/threads/thread_stack/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void stack_buffer_scenarios(void)
271271
if (scenario_data.is_user) {
272272
adjusted = K_THREAD_STACK_LEN(scenario_data.declared_size);
273273
} else {
274-
adjusted = Z_KERNEL_STACK_LEN(scenario_data.declared_size);
274+
adjusted = K_KERNEL_STACK_LEN(scenario_data.declared_size);
275275
}
276276
adjusted -= reserved;
277277

0 commit comments

Comments
 (0)