From 07152ef10d8491ac04d8d29eb5df459a87b34e81 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 23 Mar 2021 19:32:46 -0500 Subject: [PATCH] rtl8188eu: Use CONFIG_PREEMPT_RT to select raw spin lock form for real-time kernels Signed-off-by: Larry Finger --- include/osdep_service_linux.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/osdep_service_linux.h b/include/osdep_service_linux.h index 4a51c1d..7826e79 100644 --- a/include/osdep_service_linux.h +++ b/include/osdep_service_linux.h @@ -125,7 +125,11 @@ 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 @@ -202,6 +206,23 @@ __inline static _list *get_list_head(_queue *queue) ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) +#ifdef CONFIG_PREEMPT_RT +__inline static void _enter_critical(_lock *plock, unsigned long *pirqL) +{ + raw_spin_lock_irqsave(plock, *pirqL); +} + +__inline static void _exit_critical(_lock *plock, unsigned long *pirqL) +{ + raw_spin_unlock_irqrestore(plock, *pirqL); +} + +__inline static void _enter_critical_ex(_lock *plock, unsigned long *pirqL) +{ + raw_spin_lock_irqsave(plock, *pirqL); +} + +#else __inline static void _enter_critical(_lock *plock, unsigned long *pirqL) { spin_lock_irqsave(plock, *pirqL); @@ -217,6 +238,7 @@ __inline static void _enter_critical_ex(_lock *plock, unsigned long *pirqL) spin_lock_irqsave(plock, *pirqL); } +#endif __inline static void _exit_critical_ex(_lock *plock, unsigned long *pirqL) { spin_unlock_irqrestore(plock, *pirqL);