backport: implement alloc_percpu_gfp() for < 3.18.
authorSara Sharon <sara.sharon@intel.com>
Sun, 18 Feb 2018 13:24:59 +0000 (15:24 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 23 Feb 2018 11:35:02 +0000 (12:35 +0100)
mac80211 now uses the alloc_percpu_gfp() function, which doesn't exist
in kernels older than 3.18.  Backport it accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
backport-include/linux/percpu.h [new file with mode: 0644]

diff --git a/backport-include/linux/percpu.h b/backport-include/linux/percpu.h
new file mode 100644 (file)
index 0000000..10be03c
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2018 Intel Corporation
+ */
+#ifndef __BACKPORT_PERCPU_H
+#define __BACKPORT_PERCPU_H
+#include_next <linux/percpu.h>
+
+#if LINUX_VERSION_IS_LESS(3,18,0)
+static inline void __percpu *__alloc_gfp_warn(void)
+{
+       WARN(1, "Cannot backport alloc_percpu_gfp");
+       return NULL;
+}
+
+#define alloc_percpu_gfp(type, gfp) \
+       ({ (gfp == GFP_KERNEL) ? alloc_percpu(type) : __alloc_gfp_warn(); })
+#endif /* LINUX_VERSION_IS_LESS(3,18,0) */
+
+#endif /* __BACKPORT_PERCPU_H */