1328653Shselasky/*-
2328653Shselasky * Copyright (c) 2017 Mellanox Technologies, Ltd.
3328653Shselasky * All rights reserved.
4328653Shselasky *
5328653Shselasky * Redistribution and use in source and binary forms, with or without
6328653Shselasky * modification, are permitted provided that the following conditions
7328653Shselasky * are met:
8328653Shselasky * 1. Redistributions of source code must retain the above copyright
9328653Shselasky *    notice unmodified, this list of conditions, and the following
10328653Shselasky *    disclaimer.
11328653Shselasky * 2. Redistributions in binary form must reproduce the above copyright
12328653Shselasky *    notice, this list of conditions and the following disclaimer in the
13328653Shselasky *    documentation and/or other materials provided with the distribution.
14328653Shselasky *
15328653Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16328653Shselasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17328653Shselasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18328653Shselasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19328653Shselasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20328653Shselasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21328653Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22328653Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23328653Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24328653Shselasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25328653Shselasky *
26328653Shselasky * $FreeBSD: stable/11/sys/compat/linuxkpi/common/include/linux/preempt.h 328653 2018-02-01 13:01:44Z hselasky $
27328653Shselasky */
28328653Shselasky
29328653Shselasky#ifndef _LINUX_PREEMPT_H_
30328653Shselasky#define	_LINUX_PREEMPT_H_
31328653Shselasky
32328653Shselasky#include <linux/list.h>
33328653Shselasky
34328653Shselasky#define	in_interrupt() \
35328653Shselasky	(curthread->td_intr_nesting_level || curthread->td_critnest)
36328653Shselasky
37328653Shselasky#define	preempt_disable()	critical_enter()
38328653Shselasky#define	preempt_enable()	critical_exit()
39328653Shselasky
40328653Shselasky#endif					/* _LINUX_PREEMPT_H_ */
41