xref: /openbmc/linux/arch/xtensa/include/uapi/asm/poll.h (revision c71d227f)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * include/asm-xtensa/poll.h
4  *
5  * This file is subject to the terms and conditions of the GNU General
6  * Public License.  See the file "COPYING" in the main directory of
7  * this archive for more details.
8  *
9  * Copyright (C) 2001 - 2005 Tensilica Inc.
10  */
11 
12 #ifndef _XTENSA_POLL_H
13 #define _XTENSA_POLL_H
14 
15 #ifndef __KERNEL__
16 #define POLLWRNORM	POLLOUT
17 #define POLLWRBAND	(__force __poll_t)0x0100
18 #define POLLREMOVE	(__force __poll_t)0x0800
19 #else
20 #define __ARCH_HAS_MANGLED_POLL
21 static inline __u16 mangle_poll(__poll_t val)
22 {
23 	__u16 v = (__force __u16)val;
24 	/* bit 9 -> bit 8, bit 8 -> bit 2 */
25 	return (v & ~0x300) | ((v & 0x200) >> 1) | ((v & 0x100) >> 6);
26 }
27 
28 static inline __poll_t demangle_poll(__u16 v)
29 {
30         /* bit 8 -> bit 9, bit 2 -> bits 2 and 8 */
31 	return (__force __poll_t)((v & ~0x100) | ((v & 0x100) << 1) |
32 				((v & 4) << 6));
33 }
34 #endif
35 
36 #include <asm-generic/poll.h>
37 
38 #endif /* _XTENSA_POLL_H */
39