Skip to content

Commit 1c61d6e

Browse files
authored
Merge pull request #4923 from mysterywolf/internal
[kernel] Standardize internal functions' name
2 parents 546d12b + 67f2f32 commit 1c61d6e

File tree

4 files changed

+42
-41
lines changed

4 files changed

+42
-41
lines changed

src/cpu.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#include <rtthread.h>
1212

1313
#ifdef RT_USING_SMP
14-
static struct rt_cpu rt_cpus[RT_CPUS_NR];
14+
static struct rt_cpu _cpus[RT_CPUS_NR];
1515
rt_hw_spinlock_t _cpus_lock;
1616

1717
/*
1818
* disable scheduler
1919
*/
20-
static void rt_preempt_disable(void)
20+
static void _cpu_preempt_disable(void)
2121
{
2222
register rt_base_t level;
2323
struct rt_thread *current_thread;
@@ -42,7 +42,7 @@ static void rt_preempt_disable(void)
4242
/*
4343
* enable scheduler
4444
*/
45-
static void rt_preempt_enable(void)
45+
static void _cpu_preempt_enable(void)
4646
{
4747
register rt_base_t level;
4848
struct rt_thread *current_thread;
@@ -73,23 +73,23 @@ RTM_EXPORT(rt_spin_lock_init)
7373

7474
void rt_spin_lock(struct rt_spinlock *lock)
7575
{
76-
rt_preempt_disable();
76+
_cpu_preempt_disable();
7777
rt_hw_spin_lock(&lock->lock);
7878
}
7979
RTM_EXPORT(rt_spin_lock)
8080

8181
void rt_spin_unlock(struct rt_spinlock *lock)
8282
{
8383
rt_hw_spin_unlock(&lock->lock);
84-
rt_preempt_enable();
84+
_cpu_preempt_enable();
8585
}
8686
RTM_EXPORT(rt_spin_unlock)
8787

8888
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
8989
{
9090
unsigned long level;
9191

92-
rt_preempt_disable();
92+
_cpu_preempt_disable();
9393

9494
level = rt_hw_local_irq_disable();
9595
rt_hw_spin_lock(&lock->lock);
@@ -103,7 +103,7 @@ void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
103103
rt_hw_spin_unlock(&lock->lock);
104104
rt_hw_local_irq_enable(level);
105105

106-
rt_preempt_enable();
106+
_cpu_preempt_enable();
107107
}
108108
RTM_EXPORT(rt_spin_unlock_irqrestore)
109109

@@ -112,12 +112,12 @@ RTM_EXPORT(rt_spin_unlock_irqrestore)
112112
*/
113113
struct rt_cpu *rt_cpu_self(void)
114114
{
115-
return &rt_cpus[rt_hw_cpu_id()];
115+
return &_cpus[rt_hw_cpu_id()];
116116
}
117117

118118
struct rt_cpu *rt_cpu_index(int index)
119119
{
120-
return &rt_cpus[index];
120+
return &_cpus[index];
121121
}
122122

123123
/**

src/object.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif /* RT_USING_MODULE */
2424

2525
/*
26-
* define object_info for the number of rt_object_container items.
26+
* define object_info for the number of _object_container items.
2727
*/
2828
enum rt_object_info_type
2929
{
@@ -60,8 +60,9 @@ enum rt_object_info_type
6060
};
6161

6262
#define _OBJ_CONTAINER_LIST_INIT(c) \
63-
{&(rt_object_container[c].object_list), &(rt_object_container[c].object_list)}
64-
static struct rt_object_information rt_object_container[RT_Object_Info_Unknown] =
63+
{&(_object_container[c].object_list), &(_object_container[c].object_list)}
64+
65+
static struct rt_object_information _object_container[RT_Object_Info_Unknown] =
6566
{
6667
/* initialize object container - thread */
6768
{RT_Object_Class_Thread, _OBJ_CONTAINER_LIST_INIT(RT_Object_Info_Thread), sizeof(struct rt_thread)},
@@ -211,7 +212,7 @@ rt_object_get_information(enum rt_object_class_type type)
211212
int index;
212213

213214
for (index = 0; index < RT_Object_Info_Unknown; index ++)
214-
if (rt_object_container[index].type == type) return &rt_object_container[index];
215+
if (_object_container[index].type == type) return &_object_container[index];
215216

216217
return RT_NULL;
217218
}

src/signal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct siginfo_node
3535
struct rt_slist_node list;
3636
};
3737

38-
static struct rt_mempool *_rt_siginfo_pool;
38+
static struct rt_mempool *_siginfo_pool;
3939
static void _signal_deliver(rt_thread_t tid);
4040
void rt_thread_handle_sig(rt_bool_t clean_state);
4141

@@ -538,7 +538,7 @@ int rt_thread_kill(rt_thread_t tid, int sig)
538538
}
539539
rt_hw_interrupt_enable(level);
540540

541-
si_node = (struct siginfo_node *) rt_mp_alloc(_rt_siginfo_pool, 0);
541+
si_node = (struct siginfo_node *) rt_mp_alloc(_siginfo_pool, 0);
542542
if (si_node)
543543
{
544544
rt_slist_init(&(si_node->list));
@@ -576,8 +576,8 @@ int rt_thread_kill(rt_thread_t tid, int sig)
576576

577577
int rt_system_signal_init(void)
578578
{
579-
_rt_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node));
580-
if (_rt_siginfo_pool == RT_NULL)
579+
_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node));
580+
if (_siginfo_pool == RT_NULL)
581581
{
582582
LOG_E("create memory pool for signal info failed.");
583583
RT_ASSERT(0);

src/thread.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
7777
#endif /* RT_USING_HOOK */
7878

7979
/* must be invoke witch rt_hw_interrupt_disable */
80-
static void _rt_thread_cleanup_execute(rt_thread_t thread)
80+
static void _thread_cleanup_execute(rt_thread_t thread)
8181
{
8282
register rt_base_t level;
8383
#ifdef RT_USING_MODULE
@@ -101,7 +101,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread)
101101
rt_hw_interrupt_enable(level);
102102
}
103103

104-
static void _rt_thread_exit(void)
104+
static void _thread_exit(void)
105105
{
106106
struct rt_thread *thread;
107107
register rt_base_t level;
@@ -112,7 +112,7 @@ static void _rt_thread_exit(void)
112112
/* disable interrupt */
113113
level = rt_hw_interrupt_disable();
114114

115-
_rt_thread_cleanup_execute(thread);
115+
_thread_cleanup_execute(thread);
116116

117117
/* remove from schedule */
118118
rt_schedule_remove_thread(thread);
@@ -139,14 +139,14 @@ static void _rt_thread_exit(void)
139139
rt_hw_interrupt_enable(level);
140140
}
141141

142-
static rt_err_t _rt_thread_init(struct rt_thread *thread,
143-
const char *name,
144-
void (*entry)(void *parameter),
145-
void *parameter,
146-
void *stack_start,
147-
rt_uint32_t stack_size,
148-
rt_uint8_t priority,
149-
rt_uint32_t tick)
142+
static rt_err_t _thread_init(struct rt_thread *thread,
143+
const char *name,
144+
void (*entry)(void *parameter),
145+
void *parameter,
146+
void *stack_start,
147+
rt_uint32_t stack_size,
148+
rt_uint8_t priority,
149+
rt_uint32_t tick)
150150
{
151151
/* init thread list */
152152
rt_list_init(&(thread->tlist));
@@ -163,11 +163,11 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
163163
#ifdef ARCH_CPU_STACK_GROWS_UPWARD
164164
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
165165
(void *)((char *)thread->stack_addr),
166-
(void *)_rt_thread_exit);
166+
(void *)_thread_exit);
167167
#else
168168
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
169169
(rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
170-
(void *)_rt_thread_exit);
170+
(void *)_thread_exit);
171171
#endif /* ARCH_CPU_STACK_GROWS_UPWARD */
172172

173173
/* priority init */
@@ -274,14 +274,14 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
274274
/* initialize thread object */
275275
rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
276276

277-
return _rt_thread_init(thread,
278-
name,
279-
entry,
280-
parameter,
281-
stack_start,
282-
stack_size,
283-
priority,
284-
tick);
277+
return _thread_init(thread,
278+
name,
279+
entry,
280+
parameter,
281+
stack_start,
282+
stack_size,
283+
priority,
284+
tick);
285285
}
286286
RTM_EXPORT(rt_thread_init);
287287

@@ -376,7 +376,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
376376
rt_schedule_remove_thread(thread);
377377
}
378378

379-
_rt_thread_cleanup_execute(thread);
379+
_thread_cleanup_execute(thread);
380380

381381
/* release thread timer */
382382
rt_timer_detach(&(thread->thread_timer));
@@ -440,7 +440,7 @@ rt_thread_t rt_thread_create(const char *name,
440440
return RT_NULL;
441441
}
442442

443-
_rt_thread_init(thread,
443+
_thread_init(thread,
444444
name,
445445
entry,
446446
parameter,
@@ -479,7 +479,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
479479
rt_schedule_remove_thread(thread);
480480
}
481481

482-
_rt_thread_cleanup_execute(thread);
482+
_thread_cleanup_execute(thread);
483483

484484
/* release thread timer */
485485
rt_timer_detach(&(thread->thread_timer));

0 commit comments

Comments
 (0)