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);