Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions include/osdep_service_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@
#endif

typedef struct semaphore _sema;
#ifdef CONFIG_PREEMPT_RT
typedef raw_spinlock_t _lock;
#else
typedef spinlock_t _lock;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
typedef struct mutex _mutex;
#else
Expand Down Expand Up @@ -220,32 +224,56 @@ __inline static _list *get_list_head(_queue *queue)

__inline static void _enter_critical(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_lock_irqsave(plock, *pirqL);
#else
spin_lock_irqsave(plock, *pirqL);
#endif
}

__inline static void _exit_critical(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_unlock_irqrestore(plock, *pirqL);
#else
spin_unlock_irqrestore(plock, *pirqL);
#endif
}

__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_lock_irqsave(plock, *pirqL);
#else
spin_lock_irqsave(plock, *pirqL);
#endif
}

__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_unlock_irqrestore(plock, *pirqL);
#else
spin_unlock_irqrestore(plock, *pirqL);
#endif
}

__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_lock_bh(plock);
#else
spin_lock_bh(plock);
#endif
}

__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL)
{
#ifdef CONFIG_PREEMPT_RT
raw_spin_unlock_bh(plock);
#else
spin_unlock_bh(plock);
#endif
}

__inline static int _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL)
Expand Down
20 changes: 20 additions & 0 deletions os_dep/osdep_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,11 @@ void _rtw_spinlock_init(_lock *plock)

#ifdef PLATFORM_LINUX

#ifdef CONFIG_PREEMPT_RT
raw_spin_lock_init(plock);
#else
spin_lock_init(plock);
#endif

#endif
#ifdef PLATFORM_FREEBSD
Expand Down Expand Up @@ -1198,7 +1202,11 @@ void _rtw_spinlock(_lock *plock)

#ifdef PLATFORM_LINUX

#ifdef CONFIG_PREEMPT_RT
raw_spin_lock(plock);
#else
spin_lock(plock);
#endif

#endif
#ifdef PLATFORM_FREEBSD
Expand All @@ -1217,7 +1225,11 @@ void _rtw_spinunlock(_lock *plock)

#ifdef PLATFORM_LINUX

#ifdef CONFIG_PREEMPT_RT
raw_spin_unlock(plock);
#else
spin_unlock(plock);
#endif

#endif
#ifdef PLATFORM_FREEBSD
Expand All @@ -1236,7 +1248,11 @@ void _rtw_spinlock_ex(_lock *plock)

#ifdef PLATFORM_LINUX

#ifdef CONFIG_PREEMPT_RT
raw_spin_lock(plock);
#else
spin_lock(plock);
#endif

#endif
#ifdef PLATFORM_FREEBSD
Expand All @@ -1255,7 +1271,11 @@ void _rtw_spinunlock_ex(_lock *plock)

#ifdef PLATFORM_LINUX

#ifdef CONFIG_PREEMPT_RT
raw_spin_unlock(plock);
#else
spin_unlock(plock);
#endif

#endif
#ifdef PLATFORM_FREEBSD
Expand Down