3b162f2d29703b326ad2583ab04a338a5575a741
[sfrench/cifs-2.6.git] / arch / blackfin / include / uapi / asm / poll.h
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * Copyright 2004-2009 Analog Devices Inc.
4  *
5  * Licensed under the GPL-2 or later.
6  *
7  */
8
9 #ifndef _UAPI__BFIN_POLL_H
10 #define _UAPI__BFIN_POLL_H
11
12 #ifndef __KERNEL__
13 #define POLLWRNORM      POLLOUT
14 #define POLLWRBAND      (__force __poll_t)256
15 #else
16 #define __ARCH_HAS_MANGLED_POLL
17 static inline __u16 mangle_poll(__poll_t val)
18 {
19         __u16 v = (__force __u16)val;
20         /* bit 9 -> bit 8, bit 8 -> bit 2 */
21         return (v & ~0x300) | ((v & 0x200) >> 1) | ((v & 0x100) >> 6);
22 }
23
24 static inline __poll_t demangle_poll(__u16 v)
25 {
26         /* bit 8 -> bit 9, bit 2 -> bits 2 and 8 */
27         return (__force __poll_t)((v & ~0x100) | ((v & 0x100) << 1) |
28                                 ((v & 4) << 6));
29 }
30 #endif
31
32 #include <asm-generic/poll.h>
33
34 #endif /* _UAPI__BFIN_POLL_H */