Skip to content

Commit 90072f3

Browse files
Flavio Ceolinnashif
authored andcommitted
sys: kobject: Fix header to avoid re-declaratiions
Some functions were being re-declared if the file was included without USERSPACE being defined. In this scenarion we have some functions implemented as static inline besides their prototypes. This is also a code guideline problem (Rule 8.8). Signed-off-by: Flavio Ceolin <[email protected]>
1 parent d8a2004 commit 90072f3

File tree

1 file changed

+49
-47
lines changed

1 file changed

+49
-47
lines changed

include/sys/kobject.h

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -134,52 +134,6 @@ struct z_object_assignment {
134134
* @param obj Address of the kernel object
135135
*/
136136
void z_object_init(const void *obj);
137-
#else
138-
/* LCOV_EXCL_START */
139-
#define K_THREAD_ACCESS_GRANT(thread, ...)
140-
141-
/**
142-
* @internal
143-
*/
144-
static inline void z_object_init(const void *obj)
145-
{
146-
ARG_UNUSED(obj);
147-
}
148-
149-
/**
150-
* @internal
151-
*/
152-
static inline void z_impl_k_object_access_grant(const void *object,
153-
struct k_thread *thread)
154-
{
155-
ARG_UNUSED(object);
156-
ARG_UNUSED(thread);
157-
}
158-
159-
/**
160-
* @internal
161-
*/
162-
static inline void k_object_access_revoke(const void *object,
163-
struct k_thread *thread)
164-
{
165-
ARG_UNUSED(object);
166-
ARG_UNUSED(thread);
167-
}
168-
169-
/**
170-
* @internal
171-
*/
172-
static inline void z_impl_k_object_release(const void *object)
173-
{
174-
ARG_UNUSED(object);
175-
}
176-
177-
static inline void k_object_access_all_grant(const void *object)
178-
{
179-
ARG_UNUSED(object);
180-
}
181-
/* LCOV_EXCL_STOP */
182-
#endif /* !CONFIG_USERSPACE */
183137

184138
/**
185139
* Grant a thread access to a kernel object
@@ -236,6 +190,54 @@ __syscall void k_object_release(const void *object);
236190
*/
237191
void k_object_access_all_grant(const void *object);
238192

193+
#else
194+
/* LCOV_EXCL_START */
195+
#define K_THREAD_ACCESS_GRANT(thread, ...)
196+
197+
/**
198+
* @internal
199+
*/
200+
static inline void z_object_init(const void *obj)
201+
{
202+
ARG_UNUSED(obj);
203+
}
204+
205+
/**
206+
* @internal
207+
*/
208+
static inline void z_impl_k_object_access_grant(const void *object,
209+
struct k_thread *thread)
210+
{
211+
ARG_UNUSED(object);
212+
ARG_UNUSED(thread);
213+
}
214+
215+
/**
216+
* @internal
217+
*/
218+
static inline void k_object_access_revoke(const void *object,
219+
struct k_thread *thread)
220+
{
221+
ARG_UNUSED(object);
222+
ARG_UNUSED(thread);
223+
}
224+
225+
/**
226+
* @internal
227+
*/
228+
static inline void z_impl_k_object_release(const void *object)
229+
{
230+
ARG_UNUSED(object);
231+
}
232+
233+
static inline void k_object_access_all_grant(const void *object)
234+
{
235+
ARG_UNUSED(object);
236+
}
237+
/* LCOV_EXCL_STOP */
238+
#endif /* !CONFIG_USERSPACE */
239+
240+
#ifdef CONFIG_DYNAMIC_OBJECTS
239241
/**
240242
* Allocate a kernel object of a designated type
241243
*
@@ -252,7 +254,6 @@ void k_object_access_all_grant(const void *object);
252254
*/
253255
__syscall void *k_object_alloc(enum k_objects otype);
254256

255-
#ifdef CONFIG_DYNAMIC_OBJECTS
256257
/**
257258
* Allocate memory and install as a generic kernel object
258259
*
@@ -310,6 +311,7 @@ static inline struct z_object *z_dynamic_object_create(size_t size)
310311
*/
311312
void k_object_free(void *obj);
312313
#else
314+
313315
/* LCOV_EXCL_START */
314316
static inline void *z_impl_k_object_alloc(enum k_objects otype)
315317
{

0 commit comments

Comments
 (0)