Skip to content

Commit bcd1d19

Browse files
simheinnashif
authored andcommitted
kernel: add closing comments to config endifs
Add a closing comment to the endif with the configuration information to which the endif belongs too. To make the code more clearer if the configs need adaptions. Signed-off-by: Simon Hein <[email protected]>
1 parent 6266dc1 commit bcd1d19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+437
-431
lines changed

include/zephyr/kernel/internal/mm.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
(CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_OFFSET))
4040
#else
4141
#define Z_MEM_VM_OFFSET 0
42-
#endif
42+
#endif /* CONFIG_MMU */
4343

4444
#define Z_MEM_PHYS_ADDR(virt) ((virt) - Z_MEM_VM_OFFSET)
4545
#define Z_MEM_VIRT_ADDR(phys) ((phys) + Z_MEM_VM_OFFSET)
@@ -70,26 +70,26 @@ static inline uintptr_t z_mem_phys_addr(void *virt)
7070
__ASSERT(
7171
#if CONFIG_KERNEL_VM_BASE != 0
7272
(addr >= CONFIG_KERNEL_VM_BASE) &&
73-
#endif
73+
#endif /* CONFIG_KERNEL_VM_BASE != 0 */
7474
#if (CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE) != 0
7575
(addr < (CONFIG_KERNEL_VM_BASE +
7676
(CONFIG_KERNEL_VM_SIZE))),
7777
#else
7878
false,
79-
#endif
79+
#endif /* CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE != 0 */
8080
"address %p not in permanent mappings", virt);
8181
#else
8282
/* Should be identity-mapped */
8383
__ASSERT(
8484
#if CONFIG_SRAM_BASE_ADDRESS != 0
8585
(addr >= CONFIG_SRAM_BASE_ADDRESS) &&
86-
#endif
86+
#endif /* CONFIG_SRAM_BASE_ADDRESS != 0 */
8787
#if (CONFIG_SRAM_BASE_ADDRESS + (CONFIG_SRAM_SIZE * 1024UL)) != 0
8888
(addr < (CONFIG_SRAM_BASE_ADDRESS +
8989
(CONFIG_SRAM_SIZE * 1024UL))),
9090
#else
9191
false,
92-
#endif
92+
#endif /* (CONFIG_SRAM_BASE_ADDRESS + (CONFIG_SRAM_SIZE * 1024UL)) != 0 */
9393
"physical address 0x%lx not in RAM",
9494
(unsigned long)addr);
9595
#endif /* CONFIG_MMU */
@@ -111,15 +111,15 @@ static inline void *z_mem_virt_addr(uintptr_t phys)
111111
__ASSERT(
112112
#if CONFIG_SRAM_BASE_ADDRESS != 0
113113
(phys >= CONFIG_SRAM_BASE_ADDRESS) &&
114-
#endif
114+
#endif /* CONFIG_SRAM_BASE_ADDRESS != 0 */
115115
#if (CONFIG_SRAM_BASE_ADDRESS + (CONFIG_SRAM_SIZE * 1024UL)) != 0
116116
(phys < (CONFIG_SRAM_BASE_ADDRESS +
117117
(CONFIG_SRAM_SIZE * 1024UL))),
118118
#else
119119
false,
120-
#endif
120+
#endif /* (CONFIG_SRAM_BASE_ADDRESS + (CONFIG_SRAM_SIZE * 1024UL)) != 0 */
121121
"physical address 0x%lx not in RAM", (unsigned long)phys);
122-
#endif
122+
#endif /* CONFIG_KERNEL_VM_USE_CUSTOM_MEM_RANGE_CHECK */
123123

124124
/* TODO add assertion that this page frame is pinned to boot mapping,
125125
* the above check won't be sufficient with demand paging

include/zephyr/kernel/internal/smp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
void z_sched_ipi(void);
1010

11-
#endif
11+
#endif /* ZEPHYR_INCLUDE_KERNEL_INTERNAL_SMP_H_ */

include/zephyr/kernel/mm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <zephyr/toolchain.h>
1212
#if defined(CONFIG_ARM_MMU) && defined(CONFIG_ARM64)
1313
#include <zephyr/arch/arm64/arm_mem.h>
14-
#endif
14+
#endif /* CONFIG_ARM_MMU && CONFIG_ARM64 */
1515

1616
#include <zephyr/kernel/internal/mm.h>
1717

include/zephyr/kernel/mm/demand_paging.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct k_mem_paging_stats_t {
4747
#if !defined(CONFIG_DEMAND_PAGING_ALLOW_IRQ) || defined(__DOXYGEN__)
4848
/** Number of page faults while in ISR */
4949
unsigned long in_isr;
50-
#endif
50+
#endif /* !CONFIG_DEMAND_PAGING_ALLOW_IRQ */
5151
} pagefaults;
5252

5353
struct {

include/zephyr/kernel/obj_core.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct k_obj_core;
7676
#else
7777
#define K_OBJ_CORE_INIT(objp, type) do { } while (0)
7878
#define K_OBJ_CORE_LINK(objp) do { } while (0)
79-
#endif
79+
#endif /* CONFIG_OBJ_CORE */
8080

8181
/**
8282
* INTERNAL_HIDDEN @endcond
@@ -114,7 +114,7 @@ struct k_obj_type {
114114
#ifdef CONFIG_OBJ_CORE_STATS
115115
/** Pointer to object core statistics descriptor */
116116
struct k_obj_core_stats_desc *stats_desc;
117-
#endif
117+
#endif /* CONFIG_OBJ_CORE_STATS */
118118
};
119119

120120
/** Object core structure */
@@ -123,7 +123,7 @@ struct k_obj_core {
123123
struct k_obj_type *type; /**< Object type to which object belongs */
124124
#ifdef CONFIG_OBJ_CORE_STATS
125125
void *stats; /**< Pointer to kernel object's stats */
126-
#endif
126+
#endif /* CONFIG_OBJ_CORE_STATS */
127127
};
128128

129129
/**
@@ -280,7 +280,7 @@ static inline void k_obj_core_stats_init(struct k_obj_core *obj_core,
280280
{
281281
obj_core->stats = stats;
282282
}
283-
#endif
283+
#endif /* CONFIG_OBJ_CORE_STATS */
284284

285285
/**
286286
* @brief Register kernel object for gathering statistics

include/zephyr/kernel/stats.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ struct k_cycle_stats {
2626
uint64_t longest; /**< \# of cycles in longest usage window */
2727
uint32_t num_windows; /**< \# of usage windows */
2828
/** @} */
29-
#endif
29+
#endif /* CONFIG_SCHED_THREAD_USAGE_ANALYSIS */
3030
bool track_usage; /**< true if gathering usage stats */
3131
};
3232

33-
#endif
33+
#endif /* ZEPHYR_INCLUDE_KERNEL_STATS_H_ */

include/zephyr/kernel/thread.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#ifdef CONFIG_DEMAND_PAGING_THREAD_STATS
1111
#include <zephyr/kernel/mm/demand_paging.h>
12-
#endif
12+
#endif /* CONFIG_DEMAND_PAGING_THREAD_STATS */
1313

1414
#include <zephyr/kernel/stats.h>
1515
#include <zephyr/arch/arch_interface.h>
@@ -38,7 +38,7 @@ struct __thread_entry {
3838
void *parameter2;
3939
void *parameter3;
4040
};
41-
#endif
41+
#endif /* CONFIG_THREAD_MONITOR */
4242

4343
struct k_thread;
4444

@@ -96,14 +96,14 @@ struct _thread_base {
9696
#else /* Little Endian */
9797
int8_t prio;
9898
uint8_t sched_locked;
99-
#endif
99+
#endif /* CONFIG_BIG_ENDIAN */
100100
};
101101
uint16_t preempt;
102102
};
103103

104104
#ifdef CONFIG_SCHED_DEADLINE
105105
int prio_deadline;
106-
#endif
106+
#endif /* CONFIG_SCHED_DEADLINE */
107107

108108
uint32_t order_key;
109109

@@ -117,15 +117,15 @@ struct _thread_base {
117117
/* Recursive count of irq_lock() calls */
118118
uint8_t global_lock_count;
119119

120-
#endif
120+
#endif /* CONFIG_SMP */
121121

122122
#ifdef CONFIG_SCHED_CPU_MASK
123123
/* "May run on" bits for each CPU */
124124
#if CONFIG_MP_MAX_NUM_CPUS <= 8
125125
uint8_t cpu_mask;
126126
#else
127127
uint16_t cpu_mask;
128-
#endif
128+
#endif /* CONFIG_MP_MAX_NUM_CPUS */
129129
#endif /* CONFIG_SCHED_CPU_MASK */
130130

131131
/* data returned by APIs */
@@ -134,17 +134,17 @@ struct _thread_base {
134134
#ifdef CONFIG_SYS_CLOCK_EXISTS
135135
/* this thread's entry in a timeout queue */
136136
struct _timeout timeout;
137-
#endif
137+
#endif /* CONFIG_SYS_CLOCK_EXISTS */
138138

139139
#ifdef CONFIG_TIMESLICE_PER_THREAD
140140
int32_t slice_ticks;
141141
k_thread_timeslice_fn_t slice_expired;
142142
void *slice_data;
143-
#endif
143+
#endif /* CONFIG_TIMESLICE_PER_THREAD */
144144

145145
#ifdef CONFIG_SCHED_THREAD_USAGE
146146
struct k_cycle_stats usage; /* Track thread usage statistics */
147-
#endif
147+
#endif /* CONFIG_SCHED_THREAD_USAGE */
148148
};
149149

150150
typedef struct _thread_base _thread_base_t;
@@ -190,9 +190,9 @@ struct _mem_domain_info {
190190
struct _thread_userspace_local_data {
191191
#if defined(CONFIG_ERRNO) && !defined(CONFIG_ERRNO_IN_TLS) && !defined(CONFIG_LIBC_ERRNO)
192192
int errno_var;
193-
#endif
193+
#endif /* CONFIG_ERRNO && !CONFIG_ERRNO_IN_TLS && !CONFIG_LIBC_ERRNO */
194194
};
195-
#endif
195+
#endif /* CONFIG_THREAD_USERSPACE_LOCAL_DATA */
196196

197197
typedef struct k_thread_runtime_stats {
198198
#ifdef CONFIG_SCHED_THREAD_USAGE
@@ -203,7 +203,7 @@ typedef struct k_thread_runtime_stats {
203203
* as the total # of non-idle cycles. In the context of CPU statistics,
204204
* it refers to the sum of non-idle + idle cycles.
205205
*/
206-
#endif
206+
#endif /* CONFIG_SCHED_THREAD_USAGE */
207207

208208
#ifdef CONFIG_SCHED_THREAD_USAGE_ANALYSIS
209209
/*
@@ -216,7 +216,7 @@ typedef struct k_thread_runtime_stats {
216216
uint64_t current_cycles; /* current # of non-idle cycles */
217217
uint64_t peak_cycles; /* peak # of non-idle cycles */
218218
uint64_t average_cycles; /* average # of non-idle cycles */
219-
#endif
219+
#endif /* CONFIG_SCHED_THREAD_USAGE_ANALYSIS */
220220

221221
#ifdef CONFIG_SCHED_THREAD_USAGE_ALL
222222
/*
@@ -226,7 +226,7 @@ typedef struct k_thread_runtime_stats {
226226
*/
227227

228228
uint64_t idle_cycles;
229-
#endif
229+
#endif /* CONFIG_SCHED_THREAD_USAGE_ALL */
230230

231231
#if defined(__cplusplus) && !defined(CONFIG_SCHED_THREAD_USAGE) && \
232232
!defined(CONFIG_SCHED_THREAD_USAGE_ANALYSIS) && !defined(CONFIG_SCHED_THREAD_USAGE_ALL)
@@ -262,7 +262,7 @@ struct k_thread {
262262

263263
#if defined(CONFIG_POLL)
264264
struct z_poller poller;
265-
#endif
265+
#endif /* CONFIG_POLL */
266266

267267
#if defined(CONFIG_EVENTS)
268268
struct k_thread *next_event_link;
@@ -272,36 +272,36 @@ struct k_thread {
272272

273273
/** true if timeout should not wake the thread */
274274
bool no_wake_on_timeout;
275-
#endif
275+
#endif /* CONFIG_EVENTS */
276276

277277
#if defined(CONFIG_THREAD_MONITOR)
278278
/** thread entry and parameters description */
279279
struct __thread_entry entry;
280280

281281
/** next item in list of all threads */
282282
struct k_thread *next_thread;
283-
#endif
283+
#endif /* CONFIG_THREAD_MONITOR */
284284

285285
#if defined(CONFIG_THREAD_NAME)
286286
/** Thread name */
287287
char name[CONFIG_THREAD_MAX_NAME_LEN];
288-
#endif
288+
#endif /* CONFIG_THREAD_NAME */
289289

290290
#ifdef CONFIG_THREAD_CUSTOM_DATA
291291
/** crude thread-local storage */
292292
void *custom_data;
293-
#endif
293+
#endif /* CONFIG_THREAD_CUSTOM_DATA */
294294

295295
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
296296
struct _thread_userspace_local_data *userspace_local_data;
297-
#endif
297+
#endif /* CONFIG_THREAD_USERSPACE_LOCAL_DATA */
298298

299299
#if defined(CONFIG_ERRNO) && !defined(CONFIG_ERRNO_IN_TLS) && !defined(CONFIG_LIBC_ERRNO)
300300
#ifndef CONFIG_USERSPACE
301301
/** per-thread errno variable */
302302
int errno_var;
303-
#endif
304-
#endif
303+
#endif /* CONFIG_USERSPACE */
304+
#endif /* CONFIG_ERRNO && !CONFIG_ERRNO_IN_TLS && !CONFIG_LIBC_ERRNO */
305305

306306
#if defined(CONFIG_THREAD_STACK_INFO)
307307
/** Stack Info */
@@ -328,7 +328,7 @@ struct k_thread {
328328

329329
/** Context handle returned via arch_switch() */
330330
void *switch_handle;
331-
#endif
331+
#endif /* CONFIG_USE_SWITCH */
332332
/** resource pool */
333333
struct k_heap *resource_pool;
334334

@@ -340,21 +340,21 @@ struct k_thread {
340340
#ifdef CONFIG_DEMAND_PAGING_THREAD_STATS
341341
/** Paging statistics */
342342
struct k_mem_paging_stats_t paging_stats;
343-
#endif
343+
#endif /* CONFIG_DEMAND_PAGING_THREAD_STATS */
344344

345345
#ifdef CONFIG_PIPES
346346
/** Pipe descriptor used with blocking k_pipe operations */
347347
struct _pipe_desc pipe_desc;
348-
#endif
348+
#endif /* CONFIG_PIPES */
349349

350350
#ifdef CONFIG_OBJ_CORE_THREAD
351351
struct k_obj_core obj_core;
352-
#endif
352+
#endif /* CONFIG_OBJ_CORE_THREAD */
353353

354354
#ifdef CONFIG_SMP
355355
/** threads waiting in k_thread_suspend() */
356356
_wait_q_t halt_queue;
357-
#endif
357+
#endif /* CONFIG_SMP */
358358

359359
/** arch-specifics: must always be at the end */
360360
struct _thread_arch arch;
@@ -363,4 +363,4 @@ struct k_thread {
363363
typedef struct k_thread _thread_t;
364364
typedef struct k_thread *k_tid_t;
365365

366-
#endif
366+
#endif /* ZEPHYR_INCLUDE_KERNEL_THREAD_H_ */

include/zephyr/kernel/thread_stack.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static inline char *z_stack_ptr_align(char *ptr)
9292
#define K_KERNEL_STACK_RESERVED ((size_t)ARCH_KERNEL_STACK_RESERVED)
9393
#else
9494
#define K_KERNEL_STACK_RESERVED ((size_t)0)
95-
#endif
95+
#endif /* ARCH_KERNEL_STACK_RESERVED */
9696

9797
#define Z_KERNEL_STACK_SIZE_ADJUST(size) (ROUND_UP(size, \
9898
ARCH_STACK_PTR_ALIGN) + \
@@ -102,7 +102,7 @@ static inline char *z_stack_ptr_align(char *ptr)
102102
#define Z_KERNEL_STACK_OBJ_ALIGN ARCH_KERNEL_STACK_OBJ_ALIGN
103103
#else
104104
#define Z_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN
105-
#endif
105+
#endif /* ARCH_KERNEL_STACK_OBJ_ALIGN */
106106

107107
#define Z_KERNEL_STACK_LEN(size) \
108108
ROUND_UP(Z_KERNEL_STACK_SIZE_ADJUST(size), Z_KERNEL_STACK_OBJ_ALIGN)
@@ -232,7 +232,7 @@ static inline char *z_stack_ptr_align(char *ptr)
232232
#else
233233
#define K_KERNEL_PINNED_STACK_DEFINE(sym, size) \
234234
Z_KERNEL_STACK_DEFINE_IN(sym, size, __kstackmem)
235-
#endif
235+
#endif /* CONFIG_LINKER_USE_PINNED_SECTION */
236236

237237
/**
238238
* @brief Define a toplevel array of kernel stack memory regions
@@ -265,7 +265,7 @@ static inline char *z_stack_ptr_align(char *ptr)
265265
#else
266266
#define K_KERNEL_PINNED_STACK_ARRAY_DEFINE(sym, nmemb, size) \
267267
Z_KERNEL_STACK_ARRAY_DEFINE_IN(sym, nmemb, size, __kstackmem)
268-
#endif
268+
#endif /* CONFIG_LINKER_USE_PINNED_SECTION */
269269

270270
/**
271271
* @brief Define an embedded stack memory region
@@ -320,7 +320,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
320320
#define K_THREAD_STACK_RESERVED ((size_t)(ARCH_THREAD_STACK_RESERVED))
321321
#else
322322
#define K_THREAD_STACK_RESERVED ((size_t)0U)
323-
#endif
323+
#endif /* ARCH_THREAD_STACK_RESERVED */
324324

325325
/**
326326
* @brief Properly align the lowest address of a stack object
@@ -553,7 +553,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
553553
#else
554554
#define K_THREAD_PINNED_STACK_DEFINE(sym, size) \
555555
K_THREAD_STACK_DEFINE(sym, size)
556-
#endif
556+
#endif /* CONFIG_LINKER_USE_PINNED_SECTION */
557557

558558
/**
559559
* @brief Calculate size of stacks to be allocated in a stack array
@@ -611,7 +611,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
611611
#else
612612
#define K_THREAD_PINNED_STACK_ARRAY_DEFINE(sym, nmemb, size) \
613613
K_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size)
614-
#endif
614+
#endif /* CONFIG_LINKER_USE_PINNED_SECTION */
615615

616616
/**
617617
* @brief Define an embedded stack memory region

0 commit comments

Comments
 (0)