bzr branch
http://suren.me/webbzr/alps/pcitool
1
by Suren A. Chilingaryan
Initial import |
1 |
/**
|
2 |
*
|
|
3 |
* @file compat.h
|
|
4 |
* @author Michael Stapelberg
|
|
5 |
* @date 2009-04-05
|
|
6 |
* @brief Contains compatibility definitions for the different linux kernel versions to avoid
|
|
7 |
* putting ifdefs all over the driver code.
|
|
8 |
*
|
|
9 |
*/
|
|
10 |
#ifndef _COMPAT_H
|
|
11 |
#define _COMPAT_H
|
|
12 |
||
364
by Suren A. Chilingaryan
Drop support of kernels prior to 3.2 (Debian 7, Ubuntu 12.04) |
13 |
#include <linux/version.h> |
14 |
||
15 |
/* Check macros and kernel version first */
|
|
16 |
#ifndef KERNEL_VERSION
|
|
17 |
# error "No KERNEL_VERSION macro! Stopping."
|
|
18 |
#endif
|
|
19 |
||
20 |
#ifndef LINUX_VERSION_CODE
|
|
21 |
# error "No LINUX_VERSION_CODE macro! Stopping."
|
|
22 |
#endif
|
|
23 |
||
24 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
|
|
25 |
# error "Linux 3.2 and latter are supported"
|
|
26 |
#endif
|
|
27 |
||
28 |
/* VM_RESERVED is removed in 3.7-rc1 */
|
|
29 |
#ifndef VM_RESERVED
|
|
30 |
# define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP)
|
|
31 |
#endif
|
|
32 |
||
358
by Suren A. Chilingaryan
Support emulation mode without real hardware |
33 |
|
209
by Suren A. Chilingaryan
__devinit/__devexit are removed in 3.8 |
34 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
|
35 |
# define __devinit
|
|
36 |
# define __devexit
|
|
37 |
# define __devinitdata
|
|
38 |
#endif
|
|
39 |
||
406
by Suren A. Chilingaryan
Support kernels up to 4.9 (patch provided by Timo) |
40 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
|
41 |
# define get_user_pages_compat(vma, nr, pages) get_user_pages(vma, nr, FOLL_WRITE, pages, NULL)
|
|
42 |
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
|
|
43 |
# define get_user_pages_compat(vma, nr, pages) get_user_pages(vma, nr, 1, 0, pages, NULL)
|
|
413
by Suren A. Chilingaryan
Due to active back-porting in Linux LTS branches, there are some comptaibility issues in the driver. This adds support for kernel 4.4.159 |
44 |
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,159))
|
45 |
// Looks like some updates from 4.9 were backported to 4.4 LTS kernel. On Ubuntu, at least 4.4.159 needs this variant
|
|
46 |
# define get_user_pages_compat(vma, nr, pages) get_user_pages(current, current->mm, vma, nr, FOLL_WRITE, pages, NULL)
|
|
406
by Suren A. Chilingaryan
Support kernels up to 4.9 (patch provided by Timo) |
47 |
#else
|
48 |
# define get_user_pages_compat(vma, nr, pages) get_user_pages(current, current->mm, vma, nr, 1, 0, pages, NULL)
|
|
49 |
#endif
|
|
50 |
||
414
by Suren A. Chilingaryan
Kernel 5.5 compatibility (patch from Timo) |
51 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0)
|
52 |
# define ioremap_nocache ioremap
|
|
53 |
// ioremap_nocache and ioremap are now platform independent and identical, as of
|
|
54 |
// Kernel Version 5.5
|
|
55 |
// https://lore.kernel.org/linux-mips/20191209194819.GA28157@lst.de/T/
|
|
56 |
#endif
|
|
406
by Suren A. Chilingaryan
Support kernels up to 4.9 (patch provided by Timo) |
57 |
|
1
by Suren A. Chilingaryan
Initial import |
58 |
#endif
|