From 4486fd014e8966d7d778628bacc21a1d05560f18 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 30 May 2019 13:42:42 +0000 Subject: [PATCH] scst/include/backport.h: Fix build against MOFED >= 4.5 for lk < v4.18 Avoid that the following error is reported when building SCST against a Linux kernel older than v4.18 combined with MOFED >= 4.5: scst/include/backport.h:910:21: error: redefinition of 'kvcalloc' static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) ^ In file included from ./include/linux/highmem.h:8:0, from ./include/linux/bio.h:21, from ./scst/include/backport.h:24, from ./scst/include/scst_debug.h:42, from isert-scst/isert_dbg.h:29, from isert-scst/iser_global.c:40: /usr/src/ofa_kernel/default/include/linux/mm.h:78:21: note: previous definition of 'kvcalloc' was here static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) ^ Signed-off-by: Sergey Gorenko [bvanassche: renamed MOFED_*_VERSION INTO MOFED_*] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8398 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 3ebdf5770..853faf8ea 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -905,7 +905,9 @@ static inline void *kvzalloc(size_t size, gfp_t flags) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) && \ + (!defined(MOFED_MAJOR) || !defined(MOFED_MINOR) || \ + MOFED_MAJOR < 4 || (MOFED_MAJOR == 4 && MOFED_MINOR < 5)) /* See also commit 1c542f38ab8d ("mm: Introduce kvcalloc()") # v4.18. */ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) {