Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Linux-Kernel
linux-evl
Commits
8f804501
Commit
8f804501
authored
Dec 26, 2020
by
Philippe Gerum
Browse files
evl/wait: reduce header dependency
Signed-off-by:
Philippe Gerum
<
rpm@xenomai.org
>
parent
2e89b304
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/evl/timeout.h
0 → 100644
View file @
8f804501
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2020 Philippe Gerum <rpm@xenomai.org>
*/
#ifndef _EVL_TIMEOUT_H
#define _EVL_TIMEOUT_H
#include <linux/ktime.h>
/*
* Basic assumption throughout the code: ktime_t is a 64bit signed
* scalar type holding an internal time unit, which means that:
*
* - we may compare two ktime_t values using basic relational operators
* - we may check for nullness by comparing to 0 directly
* - we must use ktime_to_ns()/ns_to_ktime() helpers for converting
* to/from nanoseconds.
*/
#define EVL_INFINITE 0
#define EVL_NONBLOCK ((s64)((u64)1 << 63))
static
inline
bool
timeout_infinite
(
ktime_t
kt
)
{
return
kt
==
0
;
}
static
inline
bool
timeout_nonblock
(
ktime_t
kt
)
{
return
kt
<
0
;
}
static
inline
bool
timeout_valid
(
ktime_t
kt
)
{
return
kt
>
0
;
}
/* Timer modes */
enum
evl_tmode
{
EVL_REL
,
EVL_ABS
,
};
/*
* So that readers do not need to pull evl/clock.h for defining timed
* object initializers which only refer to the built-in clock
* addresses in the common case.
*/
extern
struct
evl_clock
evl_mono_clock
,
evl_realtime_clock
;
#endif
/* !_EVL_TIMEOUT_H */
include/evl/timer.h
View file @
8f804501
...
...
@@ -16,39 +16,7 @@
#include <evl/stat.h>
#include <evl/list.h>
#include <evl/assert.h>
/*
* Basic assumption throughout the code: ktime_t is a 64bit signed
* scalar type holding an internal time unit, which means that:
*
* - we may compare two ktime_t values using basic relational operators
* - we may check for nullness by comparing to 0 directly
* - we must use ktime_to_ns()/ns_to_ktime() helpers for converting
* to/from nanoseconds.
*/
#define EVL_INFINITE 0
#define EVL_NONBLOCK ((s64)((u64)1 << 63))
static
inline
bool
timeout_infinite
(
ktime_t
kt
)
{
return
kt
==
0
;
}
static
inline
bool
timeout_nonblock
(
ktime_t
kt
)
{
return
kt
<
0
;
}
static
inline
bool
timeout_valid
(
ktime_t
kt
)
{
return
kt
>
0
;
}
/* Timer modes */
enum
evl_tmode
{
EVL_REL
,
EVL_ABS
,
};
#include <evl/timeout.h>
/* Timer status */
#define EVL_TIMER_DEQUEUED 0x00000001
...
...
include/evl/wait.h
View file @
8f804501
...
...
@@ -8,13 +8,10 @@
#ifndef _EVL_WAIT_H
#define _EVL_WAIT_H
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/spinlock.h>
#include <evl/list.h>
#include <evl/timer.h>
#include <evl/clock.h>
#include <uapi/evl/thread.h>
#include <linux/list.h>
#include <evl/assert.h>
#include <evl/timeout.h>
#define EVL_WAIT_FIFO 0
#define EVL_WAIT_PRIO BIT(0)
...
...
@@ -63,9 +60,9 @@ struct evl_wait_queue {
\
raw_spin_lock_irqsave(&(__wq)->lock, __flags); \
if (!(__cond)) { \
if (timeout_nonblock(__timeout)) \
if (timeout_nonblock(__timeout))
{
\
__ret = -EAGAIN; \
else {
\
}
else { \
do { \
evl_add_wait_queue(__wq, __timeout, \
__timeout_mode); \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment