diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-02-07 12:10:44 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2017-02-07 15:07:17 +0100 |
commit | d3e1fea74808833b6d27acf5ffa0de98e09053ae (patch) | |
tree | 26f82f6796506896945617ce406c7e6ec82690e2 /backport/backport-include/linux | |
parent | 1ad829ea1e8e33b84a98a416d894ebd0c416d52b (diff) |
backports: add version compare macros
The whole version comparison mess is getting bigger and bigger,
add new macros to contain it a bit:
* LINUX_VERSION_IS_LESS
* LINUX_VERSION_IS_GEQ
* LINUX_VERSION_IN_RANGE
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport/backport-include/linux')
-rw-r--r-- | backport/backport-include/linux/version.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/backport/backport-include/linux/version.h b/backport/backport-include/linux/version.h index d356613d..9d389f4e 100644 --- a/backport/backport-include/linux/version.h +++ b/backport/backport-include/linux/version.h @@ -1,3 +1,5 @@ +#ifndef _BP_LINUX_VERSION_H +#define _BP_LINUX_VERSION_H #include_next <linux/version.h> #ifndef RHEL_RELEASE_VERSION @@ -7,3 +9,10 @@ #ifndef RHEL_RELEASE_CODE #define RHEL_RELEASE_CODE 0 #endif + +#define LINUX_VERSION_IS_LESS(x1,x2,x3) (LINUX_VERSION_CODE < KERNEL_VERSION(x1,x2,x3)) +#define LINUX_VERSION_IS_GEQ(x1,x2,x3) (LINUX_VERSION_CODE >= KERNEL_VERSION(x1,x2,x3)) +#define LINUX_VERSION_IN_RANGE(x1,x2,x3, y1,y2,y3) \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(x1,x2,x3) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(y1,y2,y3)) +#endif /* _BP_LINUX_VERSION_H */ |