Commit b6f896cd authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/ksem: switch to evl_sem



Now that we don't have the evl_sem element in kernel space anymore,
convert evl_ksem from the kernel API to evl_sem.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent dbeb60c2
......@@ -4,29 +4,29 @@
* Copyright (C) 2019 Philippe Gerum <rpm@xenomai.org>
*/
#ifndef _EVENLESS_KSEM_H
#define _EVENLESS_KSEM_H
#ifndef _EVENLESS_SEM_H
#define _EVENLESS_SEM_H
#include <linux/ktime.h>
#include <evenless/wait.h>
struct evl_ksem {
struct evl_sem {
unsigned int value;
struct evl_wait_queue wait_queue;
};
void evl_init_sem(struct evl_ksem *sem,
void evl_init_sem(struct evl_sem *sem,
unsigned int value);
void evl_destroy_sem(struct evl_ksem *sem);
void evl_destroy_sem(struct evl_sem *sem);
int evl_down_timeout(struct evl_ksem *sem,
int evl_down_timeout(struct evl_sem *sem,
ktime_t timeout);
int evl_down(struct evl_ksem *sem);
int evl_down(struct evl_sem *sem);
int evl_trydown(struct evl_ksem *sem);
int evl_trydown(struct evl_sem *sem);
void evl_up(struct evl_ksem *sem);
void evl_up(struct evl_sem *sem);
#endif /* !_EVENLESS_KSEM_H */
#endif /* !_EVENLESS_SEM_H */
......@@ -9,13 +9,13 @@ evenless-y := \
file.o \
init.o \
irq.o \
ksem.o \
lock.o \
memory.o \
monitor.o \
mutex.o \
poll.o \
proxy.o \
sem.o \
syscall.o \
thread.o \
tick.o \
......
......@@ -8,22 +8,22 @@
#include <evenless/wait.h>
#include <evenless/clock.h>
#include <evenless/sched.h>
#include <evenless/ksem.h>
#include <evenless/sem.h>
void evl_init_sem(struct evl_ksem *sem, unsigned int value)
void evl_init_sem(struct evl_sem *sem, unsigned int value)
{
sem->value = value;
evl_init_wait(&sem->wait_queue, &evl_mono_clock, EVL_WAIT_PRIO);
}
EXPORT_SYMBOL_GPL(evl_init_sem);
void evl_destroy_sem(struct evl_ksem *sem)
void evl_destroy_sem(struct evl_sem *sem)
{
evl_destroy_wait(&sem->wait_queue);
}
EXPORT_SYMBOL_GPL(evl_destroy_sem);
static bool down_sem(struct evl_ksem *sem)
static bool down_sem(struct evl_sem *sem)
{
if (sem->value > 0) {
--sem->value;
......@@ -33,21 +33,21 @@ static bool down_sem(struct evl_ksem *sem)
return false;
}
int evl_down_timeout(struct evl_ksem *sem, ktime_t timeout)
int evl_down_timeout(struct evl_sem *sem, ktime_t timeout)
{
return evl_wait_event_timeout(&sem->wait_queue, timeout,
EVL_ABS, down_sem(sem));
}
EXPORT_SYMBOL_GPL(evl_down_timeout);
int evl_down(struct evl_ksem *sem)
int evl_down(struct evl_sem *sem)
{
return evl_wait_event_timeout(&sem->wait_queue, EVL_INFINITE,
EVL_REL, down_sem(sem));
}
EXPORT_SYMBOL_GPL(evl_down);
int evl_trydown(struct evl_ksem *sem)
int evl_trydown(struct evl_sem *sem)
{
unsigned long flags;
bool ret;
......@@ -60,7 +60,7 @@ int evl_trydown(struct evl_ksem *sem)
}
EXPORT_SYMBOL_GPL(evl_trydown);
void evl_up(struct evl_ksem *sem)
void evl_up(struct evl_sem *sem)
{
unsigned long flags;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment