diff options
Diffstat (limited to 'backport/backport-include/linux')
153 files changed, 0 insertions, 7992 deletions
diff --git a/backport/backport-include/linux/acpi.h b/backport/backport-include/linux/acpi.h deleted file mode 100644 index 2f1072f7..00000000 --- a/backport/backport-include/linux/acpi.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __BACKPORT_LINUX_ACPI_H -#define __BACKPORT_LINUX_ACPI_H -#include_next <linux/acpi.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,8,0) -/* - * Backports - * - * commit 95f8a082b9b1ead0c2859f2a7b1ac91ff63d8765 - * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> - * Date: Wed Nov 21 00:21:50 2012 +0100 - * - * ACPI / driver core: Introduce struct acpi_dev_node and related macros - * - * To avoid adding an ACPI handle pointer to struct device on - * architectures that don't use ACPI, or generally when CONFIG_ACPI is - * not set, in which cases that pointer is useless, define struct - * acpi_dev_node that will contain the handle pointer if CONFIG_ACPI is - * set and will be empty otherwise and use it to represent the ACPI - * device node field in struct device. - * - * In addition to that define macros for reading and setting the ACPI - * handle of a device that don't generate code when CONFIG_ACPI is - * unset. Modify the ACPI subsystem to use those macros instead of - * referring to the given device's ACPI handle directly. - * - * Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> - * Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> - * Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> - */ -#ifdef CONFIG_ACPI -#define ACPI_HANDLE(dev) DEVICE_ACPI_HANDLE(dev) -#else -#define ACPI_HANDLE(dev) (NULL) -#endif /* CONFIG_ACPI */ -#endif /* LINUX_VERSION_IS_LESS(3,8,0) */ - -#ifndef ACPI_COMPANION -#ifdef CONFIG_ACPI -static inline struct acpi_device *_acpi_get_companion(struct device *dev) -{ - struct acpi_device *adev; - int ret; - - ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); - if (ret < 0) - adev = NULL; - - return adev; -} -#define ACPI_COMPANION(dev) _acpi_get_companion(dev) -#else -#define ACPI_COMPANION(dev) (NULL) -#endif /* CONFIG_ACPI */ -#endif /* ACPI_COMPANION */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define acpi_dev_remove_driver_gpios LINUX_BACKPORT(acpi_dev_remove_driver_gpios) -static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} -#endif /* LINUX_VERSION_IS_LESS(3, 19, 0) */ - -#if LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0) -#define devm_acpi_dev_add_driver_gpios LINUX_BACKPORT(devm_acpi_dev_add_driver_gpios) -static inline int devm_acpi_dev_add_driver_gpios(struct device *dev, - const struct acpi_gpio_mapping *gpios) -{ - return -ENXIO; -} -#endif /* LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0) */ - -#endif /* __BACKPORT_LINUX_ACPI_H */ diff --git a/backport/backport-include/linux/atomic.h b/backport/backport-include/linux/atomic.h deleted file mode 100644 index b4dd2e1d..00000000 --- a/backport/backport-include/linux/atomic.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __BP_ATOMIC_H -#define __BP_ATOMIC_H -#include_next <linux/atomic.h> - -/* atomic_cmpxchg_relaxed */ -#ifndef atomic_cmpxchg_relaxed -#define atomic_cmpxchg_relaxed atomic_cmpxchg -#define atomic_cmpxchg_acquire atomic_cmpxchg -#define atomic_cmpxchg_release atomic_cmpxchg - -#else /* atomic_cmpxchg_relaxed */ - -#ifndef atomic_cmpxchg_acquire -#define atomic_cmpxchg_acquire(...) \ - __atomic_op_acquire(atomic_cmpxchg, __VA_ARGS__) -#endif - -#ifndef atomic_cmpxchg_release -#define atomic_cmpxchg_release(...) \ - __atomic_op_release(atomic_cmpxchg, __VA_ARGS__) -#endif - -#ifndef atomic_cmpxchg -#define atomic_cmpxchg(...) \ - __atomic_op_fence(atomic_cmpxchg, __VA_ARGS__) -#endif -#endif /* atomic_cmpxchg_relaxed */ - -/* these were introduced together, so just a single check is enough */ -#ifndef atomic_try_cmpxchg_acquire -#ifndef atomic_try_cmpxchg -#define __atomic_try_cmpxchg(type, _p, _po, _n) \ -({ \ - typeof(_po) __po = (_po); \ - typeof(*(_po)) __r, __o = *__po; \ - __r = atomic_cmpxchg##type((_p), __o, (_n)); \ - if (unlikely(__r != __o)) \ - *__po = __r; \ - likely(__r == __o); \ -}) - -#define atomic_try_cmpxchg(_p, _po, _n) __atomic_try_cmpxchg(, _p, _po, _n) -#define atomic_try_cmpxchg_relaxed(_p, _po, _n) __atomic_try_cmpxchg(_relaxed, _p, _po, _n) -#define atomic_try_cmpxchg_acquire(_p, _po, _n) __atomic_try_cmpxchg(_acquire, _p, _po, _n) -#define atomic_try_cmpxchg_release(_p, _po, _n) __atomic_try_cmpxchg(_release, _p, _po, _n) -#else /* atomic_try_cmpxchg */ -#define atomic_try_cmpxchg_relaxed atomic_try_cmpxchg -#define atomic_try_cmpxchg_acquire atomic_try_cmpxchg -#define atomic_try_cmpxchg_release atomic_try_cmpxchg -#endif /* atomic_try_cmpxchg */ - -#endif /* atomic_try_cmpxchg_acquire */ - -#endif /* __BP_ATOMIC_H */ diff --git a/backport/backport-include/linux/bcm47xx_nvram.h b/backport/backport-include/linux/bcm47xx_nvram.h deleted file mode 100644 index 5295a023..00000000 --- a/backport/backport-include/linux/bcm47xx_nvram.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __BACKPORTS_BCM47XX_NVRAM_H -#define __BACKPORTS_BCM47XX_NVRAM_H -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(4,1,0) -#include_next <linux/bcm47xx_nvram.h> -#else -#include <linux/types.h> -#include <linux/kernel.h> -#endif - -#if LINUX_VERSION_IS_LESS(4,2,0) -#define bcm47xx_nvram_get_contents LINUX_BACKPORT(bcm47xx_nvram_get_contents) -static inline char *bcm47xx_nvram_get_contents(size_t *val_len) -{ - return NULL; -} - -#define bcm47xx_nvram_release_contents LINUX_BACKPORT(bcm47xx_nvram_release_contents) -static inline void bcm47xx_nvram_release_contents(char *nvram) -{ -} -#endif /* LINUX_VERSION_IS_GEQ(4,1,0) */ - -#endif /* __BACKPORTS_BCM47XX_NVRAM_H */ diff --git a/backport/backport-include/linux/bitops.h b/backport/backport-include/linux/bitops.h deleted file mode 100644 index 86360d04..00000000 --- a/backport/backport-include/linux/bitops.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __BACKPORT_BITOPS_H -#define __BACKPORT_BITOPS_H -#include_next <linux/bitops.h> -#include <linux/version.h> -#include <generated/utsrelease.h> - -#ifndef GENMASK - -/* - * Create a contiguous bitmask starting at bit position @l and ending at - * position @h. For example - * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. - */ -#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) -#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) - -#endif - -#ifndef BIT_ULL -#define BIT_ULL(nr) (1ULL << (nr)) -#endif - -#endif /* __BACKPORT_BITOPS_H */ diff --git a/backport/backport-include/linux/bp-devcoredump.h b/backport/backport-include/linux/bp-devcoredump.h deleted file mode 100644 index 1e4abf64..00000000 --- a/backport/backport-include/linux/bp-devcoredump.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __BACKPORT_LINUX_DEVCOREDUMP_H -#define __BACKPORT_LINUX_DEVCOREDUMP_H -#include <linux/version.h> -#include <linux/scatterlist.h> - -/* We only need to add our wrapper inside the range from 3.18 until - * 4.6, outside that we can let our BPAUTO mechanism handle it. - */ -#if (LINUX_VERSION_IS_GEQ(3,18,0) && \ - LINUX_VERSION_IS_LESS(4,7,0)) -static inline -void backport_dev_coredumpm(struct device *dev, struct module *owner, - void *data, size_t datalen, gfp_t gfp, - ssize_t (*read_fn)(char *buffer, loff_t offset, - size_t count, void *data, - size_t datalen), - void (*free_fn)(void *data)) -{ - return dev_coredumpm(dev, owner, (const void *)data, datalen, gfp, - (void *)read_fn, (void *)free_fn); -} - -#define dev_coredumpm LINUX_BACKPORT(dev_coredumpm) - -#define dev_coredumpsg LINUX_BACKPORT(dev_coredumpsg) -void dev_coredumpsg(struct device *dev, struct scatterlist *table, - size_t datalen, gfp_t gfp); - -#endif /* (LINUX_VERSION_IS_GEQ(3,18,0) && \ - LINUX_VERSION_IS_LESS(4,7,0)) */ - -#endif /* __BACKPORT_LINUX_DEVCOREDUMP_H */ diff --git a/backport/backport-include/linux/bug.h b/backport/backport-include/linux/bug.h deleted file mode 100644 index 8595fd2b..00000000 --- a/backport/backport-include/linux/bug.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BP_BUG_H -#define __BP_BUG_H -#include_next <linux/bug.h> - -#ifndef __BUILD_BUG_ON_NOT_POWER_OF_2 -#ifdef __CHECKER__ -#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) -#else -#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ - BUILD_BUG_ON(((n) & ((n) - 1)) != 0) -#endif /* __CHECKER__ */ -#endif /* __BUILD_BUG_ON_NOT_POWER_OF_2 */ - -#ifndef BUILD_BUG_ON_MSG -#define BUILD_BUG_ON_MSG(x, msg) BUILD_BUG_ON(x) -#endif - -#endif /* __BP_BUG_H */ diff --git a/backport/backport-include/linux/build_bug.h b/backport/backport-include/linux/build_bug.h deleted file mode 100644 index 13ee5d6a..00000000 --- a/backport/backport-include/linux/build_bug.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BP_BUILD_BUG_H -#define __BP_BUILD_BUG_H - -#if LINUX_VERSION_IS_GEQ(4,13,0) -#include_next <linux/build_bug.h> -#else /* LINUX_VERSION_IS_GEQ(4,13,0) */ -#include <linux/bug.h> -#endif /* LINUX_VERSION_IS_GEQ(4,13,0) */ - -#endif /* __BP_BUILD_BUG_H */ diff --git a/backport/backport-include/linux/cache.h b/backport/backport-include/linux/cache.h deleted file mode 100644 index bd7cdcfc..00000000 --- a/backport/backport-include/linux/cache.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _BACKPORT_CACHE_H -#define _BACKPORT_CACHE_H - -#include_next <linux/cache.h> - -#ifndef __ro_after_init -#define __ro_after_init -#endif - -#endif /* _BACKPORT_CACHE_H */ diff --git a/backport/backport-include/linux/clk.h b/backport/backport-include/linux/clk.h deleted file mode 100644 index 62d9218b..00000000 --- a/backport/backport-include/linux/clk.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef __BACKPORT_LINUX_CLK_H -#define __BACKPORT_LINUX_CLK_H -#include_next <linux/clk.h> -#include <linux/version.h> - -/* - * commit 93abe8e4 - we only backport the non CONFIG_COMMON_CLK - * case as the CONFIG_COMMON_CLK case requires arch support. By - * using the backport_ namespace for older kernels we force usage - * of these helpers and that's required given that 3.5 added some - * of these helpers expecting a few exported symbols for the non - * CONFIG_COMMON_CLK case. The 3.5 kernel is not supported as - * per kernel.org so we don't send a fix upstream for that. - */ -#if LINUX_VERSION_IS_LESS(3,6,0) - -#ifndef CONFIG_COMMON_CLK - -/* - * Whoopsie! - * - * clk_enable() and clk_disable() have been left without - * a nop export symbols when !CONFIG_COMMON_CLK since its - * introduction on v2.6.16, but fixed until 3.6. - */ -#if 0 -#define clk_enable LINUX_BACKPORT(clk_enable) -static inline int clk_enable(struct clk *clk) -{ - return 0; -} - -#define clk_disable LINUX_BACKPORT(clk_disable) -static inline void clk_disable(struct clk *clk) {} -#endif - - -#define clk_get LINUX_BACKPORT(clk_get) -static inline struct clk *clk_get(struct device *dev, const char *id) -{ - return NULL; -} - -#define devm_clk_get LINUX_BACKPORT(devm_clk_get) -static inline struct clk *devm_clk_get(struct device *dev, const char *id) -{ - return NULL; -} - -#define clk_put LINUX_BACKPORT(clk_put) -static inline void clk_put(struct clk *clk) {} - -#define devm_clk_put LINUX_BACKPORT(devm_clk_put) -static inline void devm_clk_put(struct device *dev, struct clk *clk) {} - -#define clk_get_rate LINUX_BACKPORT(clk_get_rate) -static inline unsigned long clk_get_rate(struct clk *clk) -{ - return 0; -} - -#define clk_set_rate LINUX_BACKPORT(clk_set_rate) -static inline int clk_set_rate(struct clk *clk, unsigned long rate) -{ - return 0; -} - -#define clk_round_rate LINUX_BACKPORT(clk_round_rate) -static inline long clk_round_rate(struct clk *clk, unsigned long rate) -{ - return 0; -} - -#define clk_set_parent LINUX_BACKPORT(clk_set_parent) -static inline int clk_set_parent(struct clk *clk, struct clk *parent) -{ - return 0; -} - -#define clk_get_parent LINUX_BACKPORT(clk_get_parent) -static inline struct clk *clk_get_parent(struct clk *clk) -{ - return NULL; -} -#endif /* CONFIG_COMMON_CLK */ - -#endif /* #if LINUX_VERSION_IS_LESS(3,0,0) */ - -#if LINUX_VERSION_IS_LESS(3,3,0) && \ - LINUX_VERSION_IS_GEQ(3,2,0) -#define clk_prepare_enable LINUX_BACKPORT(clk_prepare_enable) -/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ -static inline int clk_prepare_enable(struct clk *clk) -{ - int ret; - - ret = clk_prepare(clk); - if (ret) - return ret; - ret = clk_enable(clk); - if (ret) - clk_unprepare(clk); - - return ret; -} - -#define clk_disable_unprepare LINUX_BACKPORT(clk_disable_unprepare) -/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */ -static inline void clk_disable_unprepare(struct clk *clk) -{ - clk_disable(clk); - clk_unprepare(clk); -} -#endif /* < 3,3,0 && >= 3,2,0 */ - -#endif /* __LINUX_CLK_H */ diff --git a/backport/backport-include/linux/compat.h b/backport/backport-include/linux/compat.h deleted file mode 100644 index f41ee5e6..00000000 --- a/backport/backport-include/linux/compat.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __BACKPORT_COMPAT_H -#define __BACKPORT_COMPAT_H - -#include_next <linux/compat.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) -#ifdef CONFIG_X86_X32_ABI -#define COMPAT_USE_64BIT_TIME \ - (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)) -#else -#define COMPAT_USE_64BIT_TIME 0 -#endif -#endif - -#if LINUX_VERSION_IS_LESS(3,4,0) -#define compat_put_timespec LINUX_BACKPORT(compat_put_timespec) -extern int compat_put_timespec(const struct timespec *, void __user *); -#endif - -#endif /* __BACKPORT_COMPAT_H */ diff --git a/backport/backport-include/linux/compiler-gcc5.h b/backport/backport-include/linux/compiler-gcc5.h deleted file mode 100644 index 9ff99f0d..00000000 --- a/backport/backport-include/linux/compiler-gcc5.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/compiler-gccN.h> diff --git a/backport/backport-include/linux/compiler-gcc6.h b/backport/backport-include/linux/compiler-gcc6.h deleted file mode 100644 index 9ff99f0d..00000000 --- a/backport/backport-include/linux/compiler-gcc6.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/compiler-gccN.h> diff --git a/backport/backport-include/linux/compiler-gcc7.h b/backport/backport-include/linux/compiler-gcc7.h deleted file mode 100644 index 9ff99f0d..00000000 --- a/backport/backport-include/linux/compiler-gcc7.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/compiler-gccN.h> diff --git a/backport/backport-include/linux/compiler-gccN.h b/backport/backport-include/linux/compiler-gccN.h deleted file mode 100644 index 97e7541d..00000000 --- a/backport/backport-include/linux/compiler-gccN.h +++ /dev/null @@ -1,126 +0,0 @@ -/* gcc version specific checks */ - -#ifndef GCC_VERSION -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -#endif - -#if GCC_VERSION < 30200 -# error Sorry, your compiler is too old - please upgrade it. -#endif - -#if GCC_VERSION < 30300 -# define __used __attribute__((__unused__)) -#else -# define __used __attribute__((__used__)) -#endif - -#ifdef CONFIG_GCOV_KERNEL -# if GCC_VERSION < 30400 -# error "GCOV profiling support for gcc versions below 3.4 not included" -# endif /* __GNUC_MINOR__ */ -#endif /* CONFIG_GCOV_KERNEL */ - -#if GCC_VERSION >= 30400 -#define __must_check __attribute__((warn_unused_result)) -#endif - -#if GCC_VERSION >= 40000 - -/* GCC 4.1.[01] miscompiles __weak */ -#ifdef __KERNEL__ -# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -# error Your version of gcc miscompiles the __weak directive -# endif -#endif - -#define __used __attribute__((__used__)) -#define __compiler_offsetof(a, b) \ - __builtin_offsetof(a, b) - -#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -#endif - -#if GCC_VERSION >= 40300 -/* Mark functions as cold. gcc will assume any path leading to a call - * to them will be unlikely. This means a lot of manual unlikely()s - * are unnecessary now for any paths leading to the usual suspects - * like BUG(), printk(), panic() etc. [but let's keep them for now for - * older compilers] - * - * Early snapshots of gcc 4.3 don't support this and we can't detect this - * in the preprocessor, but we can live with this because they're unreleased. - * Maketime probing would be overkill here. - * - * gcc also has a __attribute__((__hot__)) to move hot functions into - * a special section, but I don't see any sense in this right now in - * the kernel context - */ -#define __cold __attribute__((__cold__)) - -#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) - -#ifndef __CHECKER__ -# define __compiletime_warning(message) __attribute__((warning(message))) -# define __compiletime_error(message) __attribute__((error(message))) -#endif /* __CHECKER__ */ -#endif /* GCC_VERSION >= 40300 */ - -#if GCC_VERSION >= 40500 -/* - * Mark a position in code as unreachable. This can be used to - * suppress control flow warnings after asm blocks that transfer - * control elsewhere. - * - * Early snapshots of gcc 4.5 don't support this and we can't detect - * this in the preprocessor, but we can live with this because they're - * unreleased. Really, we need to have autoconf for the kernel. - */ -#define unreachable() __builtin_unreachable() - -/* Mark a function definition as prohibited from being cloned. */ -#define __noclone __attribute__((__noclone__)) - -#endif /* GCC_VERSION >= 40500 */ - -#if GCC_VERSION >= 40600 -/* - * Tell the optimizer that something else uses this function or variable. - */ -#define __visible __attribute__((externally_visible)) -#endif - -/* - * GCC 'asm goto' miscompiles certain code sequences: - * - * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 - * - * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. - * - * (asm goto is automatically volatile - the naming reflects this.) - */ -#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) - -#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -#if GCC_VERSION >= 40400 -#define __HAVE_BUILTIN_BSWAP32__ -#define __HAVE_BUILTIN_BSWAP64__ -#endif -#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -#define __HAVE_BUILTIN_BSWAP16__ -#endif -#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ - -#if GCC_VERSION >= 50000 -#define KASAN_ABI_VERSION 4 -#elif GCC_VERSION >= 40902 -#define KASAN_ABI_VERSION 3 -#endif - -#endif /* gcc version >= 40000 specific checks */ - -#ifndef OPTIMIZER_HIDE_VAR -#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) -#endif diff --git a/backport/backport-include/linux/compiler.h b/backport/backport-include/linux/compiler.h deleted file mode 100644 index 53c069df..00000000 --- a/backport/backport-include/linux/compiler.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef __BACKPORT_LINUX_COMPILER_H -#define __BACKPORT_LINUX_COMPILER_H -#include_next <linux/compiler.h> - -#ifndef __rcu -#define __rcu -#endif - -#ifndef __always_unused -#ifdef __GNUC__ -#define __always_unused __attribute__((unused)) -#else -#define __always_unused /* unimplemented */ -#endif -#endif - -#ifndef __PASTE -/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -#define ___PASTE(a,b) a##b -#define __PASTE(a,b) ___PASTE(a,b) -#endif - -/* Not-quite-unique ID. */ -#ifndef __UNIQUE_ID -# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) -#endif - -#ifndef barrier_data -#ifdef __GNUC__ -#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") -#else /* __GNUC__ */ -# define barrier_data(ptr) barrier() -#endif /* __GNUC__ */ -#endif - -#ifndef READ_ONCE -#include <linux/types.h> - -#define __READ_ONCE_SIZE \ -({ \ - switch (size) { \ - case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ - case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ - case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ - case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ - default: \ - barrier(); \ - __builtin_memcpy((void *)res, (const void *)p, size); \ - barrier(); \ - } \ -}) - -static __always_inline -void __read_once_size(const volatile void *p, void *res, int size) -{ - __READ_ONCE_SIZE; -} - -#define __READ_ONCE(x, check) \ -({ \ - union { typeof(x) __val; char __c[1]; } __u; \ - __read_once_size(&(x), __u.__c, sizeof(x)); \ - __u.__val; \ -}) - -#define READ_ONCE(x) __READ_ONCE(x, 1) - -static __always_inline void __write_once_size(volatile void *p, void *res, int size) -{ - switch (size) { - case 1: *(volatile __u8 *)p = *(__u8 *)res; break; - case 2: *(volatile __u16 *)p = *(__u16 *)res; break; - case 4: *(volatile __u32 *)p = *(__u32 *)res; break; - case 8: *(volatile __u64 *)p = *(__u64 *)res; break; - default: - barrier(); - __builtin_memcpy((void *)p, (const void *)res, size); - barrier(); - } -} - -#define WRITE_ONCE(x, val) \ -({ \ - union { typeof(x) __val; char __c[1]; } __u = \ - { .__val = (__force typeof(x)) (val) }; \ - __write_once_size(&(x), __u.__c, sizeof(x)); \ - __u.__val; \ -}) -#endif - -#ifndef OPTIMIZER_HIDE_VAR -#define OPTIMIZER_HIDE_VAR(var) barrier() -#endif - -#endif /* __BACKPORT_LINUX_COMPILER_H */ diff --git a/backport/backport-include/linux/completion.h b/backport/backport-include/linux/completion.h deleted file mode 100644 index f8ce5b1f..00000000 --- a/backport/backport-include/linux/completion.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __BACKPORT_COMPLETION_H -#define __BACKPORT_COMPLETION_H -#include_next <linux/completion.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,13,0) -/** - * reinit_completion - reinitialize a completion structure - * @x: pointer to completion structure that is to be reinitialized - * - * This inline function should be used to reinitialize a completion structure so it can - * be reused. This is especially important after complete_all() is used. - */ -#define reinit_completion LINUX_BACKPORT(reinit_completion) -static inline void reinit_completion(struct completion *x) -{ - x->done = 0; -} -#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ - -#endif /* __BACKPORT_COMPLETION_H */ diff --git a/backport/backport-include/linux/cordic.h b/backport/backport-include/linux/cordic.h deleted file mode 100644 index 67d6a4ae..00000000 --- a/backport/backport-include/linux/cordic.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _BACKPORT_LINUX_CORDIC_H -#define _BACKPORT_LINUX_CORDIC_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0)) -#include_next <linux/cordic.h> -#else - -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CORDIC_H_ -#define __CORDIC_H_ - -#include <linux/types.h> - -/** - * struct cordic_iq - i/q coordinate. - * - * @i: real part of coordinate (in phase). - * @q: imaginary part of coordinate (quadrature). - */ -struct cordic_iq { - s32 i; - s32 q; -}; - -/** - * cordic_calc_iq() - calculates the i/q coordinate for given angle. - * - * @theta: angle in degrees for which i/q coordinate is to be calculated. - * @coord: function output parameter holding the i/q coordinate. - * - * The function calculates the i/q coordinate for a given angle using - * cordic algorithm. The coordinate consists of a real (i) and an - * imaginary (q) part. The real part is essentially the cosine of the - * angle and the imaginary part is the sine of the angle. The returned - * values are scaled by 2^16 for precision. The range for theta is - * for -180 degrees to +180 degrees. Passed values outside this range are - * converted before doing the actual calculation. - */ -#define cordic_calc_iq LINUX_BACKPORT(cordic_calc_iq) -struct cordic_iq cordic_calc_iq(s32 theta); - -#endif /* __CORDIC_H_ */ -#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0)) */ - -#ifndef CORDIC_FLOAT -#define CORDIC_ANGLE_GEN 39797 -#define CORDIC_PRECISION_SHIFT 16 -#define CORDIC_NUM_ITER (CORDIC_PRECISION_SHIFT + 2) - -#define CORDIC_FIXED(X) ((s32)((X) << CORDIC_PRECISION_SHIFT)) -#define CORDIC_FLOAT(X) (((X) >= 0) \ - ? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \ - : -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1)) -#endif - -#endif /* _BACKPORT_LINUX_CORDIC_H */ diff --git a/backport/backport-include/linux/crc7.h b/backport/backport-include/linux/crc7.h deleted file mode 100644 index 50706ea9..00000000 --- a/backport/backport-include/linux/crc7.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _BACKPORT_LINUX_CRC7_H -#define _BACKPORT_LINUX_CRC7_H -#include_next <linux/crc7.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,16,0) -#define crc7_be LINUX_BACKPORT(crc7_be) -static inline u8 crc7_be(u8 crc, const u8 *buffer, size_t len) -{ - return crc7(crc, buffer, len) << 1; -} -#endif /* < 3.16 */ - -#endif /* _BACKPORT_LINUX_CRC7_H */ diff --git a/backport/backport-include/linux/debugfs.h b/backport/backport-include/linux/debugfs.h deleted file mode 100644 index fb50c4f5..00000000 --- a/backport/backport-include/linux/debugfs.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __BACKPORT_DEBUGFS_H_ -#define __BACKPORT_DEBUGFS_H_ -#include_next <linux/debugfs.h> -#include <linux/version.h> -#include <linux/device.h> -#include <generated/utsrelease.h> - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define debugfs_create_devm_seqfile LINUX_BACKPORT(debugfs_create_devm_seqfile) -#if defined(CONFIG_DEBUG_FS) -struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, - struct dentry *parent, - int (*read_fn)(struct seq_file *s, - void *data)); -#else -static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, - const char *name, - struct dentry *parent, - int (*read_fn)(struct seq_file *s, - void *data)) -{ - return ERR_PTR(-ENODEV); -} -#endif /* CONFIG_DEBUG_FS */ -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#if LINUX_VERSION_IS_LESS(4,4,0) -#define debugfs_create_bool LINUX_BACKPORT(debugfs_create_bool) -#ifdef CONFIG_DEBUG_FS -struct dentry *debugfs_create_bool(const char *name, umode_t mode, - struct dentry *parent, bool *value); -#else -static inline struct dentry * -debugfs_create_bool(const char *name, umode_t mode, - struct dentry *parent, bool *value) -{ - return ERR_PTR(-ENODEV); -} -#endif -#endif /* LINUX_VERSION_IS_LESS(4,4,0) */ - -#if LINUX_VERSION_IS_LESS(4,9,0) && \ - !LINUX_VERSION_IN_RANGE(4,8,4, 4,9,0) && \ - !LINUX_VERSION_IN_RANGE(4,7,10, 4,8,0) -static inline const struct file_operations * -debugfs_real_fops(const struct file *filp) -{ - /* - * Neither the pointer to the struct file_operations, nor its - * contents ever change -- srcu_dereference() is not needed here. - */ - return filp->f_path.dentry->d_fsdata; -} -#endif /* <4.9.0 but not >= 4.8.4, 4.7.10 */ - -#ifndef DEFINE_DEBUGFS_ATTRIBUTE -#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \ - DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) -#define debugfs_create_file_unsafe(name, mode, parent, data, fops) \ - debugfs_create_file(name, mode, parent, data, fops) -#endif - -#endif /* __BACKPORT_DEBUGFS_H_ */ diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h deleted file mode 100644 index 8f282ca6..00000000 --- a/backport/backport-include/linux/device.h +++ /dev/null @@ -1,280 +0,0 @@ -#ifndef __BACKPORT_DEVICE_H -#define __BACKPORT_DEVICE_H -#include <linux/export.h> -#include_next <linux/device.h> - -#include <linux/version.h> - -/* - * string.h is usually included from the asm/ folder in most configuration, - * but on some older kernels it doesn't. As we're using memcpy() in the code - * below, we need to be safe and make sure string.h is indeed there. - */ -#include <linux/string.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -/* backport - * commit 9f3b795a626ee79574595e06d1437fe0c7d51d29 - * Author: Michał Mirosław <mirq-linux@rere.qmqm.pl> - * Date: Fri Feb 1 20:40:17 2013 +0100 - * - * driver-core: constify data for class_find_device() - */ -typedef int (backport_device_find_function_t)(struct device *, void *); -#define class_find_device(cls, start, idx, fun) \ - class_find_device((cls), (start), (void *)(idx),\ - (backport_device_find_function_t *)(fun)) -#endif - -#ifndef module_driver -/** - * module_driver() - Helper macro for drivers that don't do anything - * special in module init/exit. This eliminates a lot of boilerplate. - * Each module may only use this macro once, and calling it replaces - * module_init() and module_exit(). - * - * Use this macro to construct bus specific macros for registering - * drivers, and do not use it on its own. - */ -#define module_driver(__driver, __register, __unregister) \ -static int __init __driver##_init(void) \ -{ \ - return __register(&(__driver)); \ -} \ -module_init(__driver##_init); \ -static void __exit __driver##_exit(void) \ -{ \ - __unregister(&(__driver)); \ -} \ -module_exit(__driver##_exit); -#endif - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define devm_ioremap_resource LINUX_BACKPORT(devm_ioremap_resource) -void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); -#endif - -#if LINUX_VERSION_IS_LESS(3,5,0) && \ - LINUX_VERSION_IS_GEQ(3,2,0) -#define devres_release LINUX_BACKPORT(devres_release) -extern int devres_release(struct device *dev, dr_release_t release, - dr_match_t match, void *match_data); -#endif - -#if LINUX_VERSION_IS_LESS(3,5,0) -#include <linux/ratelimit.h> - -#define dev_level_ratelimited(dev_level, dev, fmt, ...) \ -do { \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - if (__ratelimit(&_rs)) \ - dev_level(dev, fmt, ##__VA_ARGS__); \ -} while (0) - -#define dev_emerg_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) -#define dev_alert_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) -#define dev_crit_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) -#define dev_err_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) -#define dev_warn_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__) -#define dev_notice_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) -#define dev_info_ratelimited(dev, fmt, ...) \ - dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) - - -#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) -#define dev_dbg_ratelimited(dev, fmt, ...) \ -do { \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ - if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ - __ratelimit(&_rs)) \ - __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ - ##__VA_ARGS__); \ -} while (0) -#else -#define dev_dbg_ratelimited(dev, fmt, ...) \ - no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#endif /* dynamic debug */ -#endif /* <= 3.5 */ - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) -static inline void -backport_device_release_driver(struct device *dev) -{ - device_release_driver(dev); - device_lock(dev); - dev_set_drvdata(dev, NULL); - device_unlock(dev); -} -#define device_release_driver LINUX_BACKPORT(device_release_driver) - -#define kobj_to_dev LINUX_BACKPORT(kobj_to_dev) -static inline struct device *kobj_to_dev(struct kobject *kobj) -{ - return container_of(kobj, struct device, kobj); -} -#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) */ - -#if LINUX_VERSION_IS_LESS(3,10,0) -int devm_add_action(struct device *dev, void (*action) (void *), void *data); -#endif - -#if LINUX_VERSION_IS_LESS(3,11,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0) -#ifndef DEVICE_ATTR_RO -#define DEVICE_ATTR_RO(_name) \ -struct device_attribute dev_attr_ ## _name = __ATTR_RO(_name); -#endif -#ifndef DEVICE_ATTR_RW -#define DEVICE_ATTR_RW(_name) \ -struct device_attribute dev_attr_ ## _name = __ATTR_RW(_name) -#endif -#endif - -#ifndef CLASS_ATTR_RW -#define CLASS_ATTR_RW(_name) \ - struct class_attribute class_attr_##_name = __ATTR_RW(_name) -#endif -#ifndef CLASS_ATTR_RO -#define CLASS_ATTR_RO(_name) \ - struct class_attribute class_attr_##_name = __ATTR_RO(_name) -#endif - -#define ATTRIBUTE_GROUPS_BACKPORT(_name) \ -static struct BP_ATTR_GRP_STRUCT _name##_dev_attrs[ARRAY_SIZE(_name##_attrs)];\ -static void init_##_name##_attrs(void) \ -{ \ - int i; \ - for (i = 0; _name##_attrs[i]; i++) \ - _name##_dev_attrs[i] = \ - *container_of(_name##_attrs[i], \ - struct BP_ATTR_GRP_STRUCT, \ - attr); \ -} - -#ifndef __ATTRIBUTE_GROUPS -#define __ATTRIBUTE_GROUPS(_name) \ -static const struct attribute_group *_name##_groups[] = { \ - &_name##_group, \ - NULL, \ -} -#endif /* __ATTRIBUTE_GROUPS */ - -#undef ATTRIBUTE_GROUPS -#define ATTRIBUTE_GROUPS(_name) \ -static const struct attribute_group _name##_group = { \ - .attrs = _name##_attrs, \ -}; \ -static inline void init_##_name##_attrs(void) {} \ -__ATTRIBUTE_GROUPS(_name) - -#if LINUX_VERSION_IS_LESS(3,13,0) -#define devm_kmalloc(dev, size, flags) devm_kzalloc(dev, size, flags) -#endif - -#if LINUX_VERSION_IS_LESS(3,15,0) -#define devm_kstrdup LINUX_BACKPORT(devm_kstrdup) -extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); -#endif - -#if LINUX_VERSION_IS_LESS(3,13,0) -#define devm_kmalloc_array LINUX_BACKPORT(devm_kmalloc_array) -static inline void *devm_kmalloc_array(struct device *dev, - size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) - return NULL; - return devm_kmalloc(dev, n * size, flags); -} - -#define devm_kcalloc LINUX_BACKPORT(devm_kcalloc) -static inline void *devm_kcalloc(struct device *dev, - size_t n, size_t size, gfp_t flags) -{ - return devm_kmalloc_array(dev, n, size, flags); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,16,0) -#define devm_kmemdup LINUX_BACKPORT(devm_kmemdup) -static inline void *devm_kmemdup(struct device *dev, const void *src, - size_t len, gfp_t gfp) -{ - void *p; - - p = devm_kmalloc(dev, len, gfp); - if (p) - memcpy(p, src, len); - - return p; -} -#endif - -#ifndef dev_level_once -#ifdef CONFIG_PRINTK -#define dev_level_once(dev_level, dev, fmt, ...) \ -do { \ - static bool __print_once __read_mostly; \ - \ - if (!__print_once) { \ - __print_once = true; \ - dev_level(dev, fmt, ##__VA_ARGS__); \ - } \ -} while (0) -#else -#define dev_level_once(dev_level, dev, fmt, ...) \ -do { \ - if (0) \ - dev_level(dev, fmt, ##__VA_ARGS__); \ -} while (0) -#endif - -#define dev_emerg_once(dev, fmt, ...) \ - dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__) -#define dev_alert_once(dev, fmt, ...) \ - dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__) -#define dev_crit_once(dev, fmt, ...) \ - dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__) -#define dev_err_once(dev, fmt, ...) \ - dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__) -#define dev_warn_once(dev, fmt, ...) \ - dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__) -#define dev_notice_once(dev, fmt, ...) \ - dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__) -#define dev_info_once(dev, fmt, ...) \ - dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) -#define dev_dbg_once(dev, fmt, ...) \ - dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__) -#endif /* dev_level_once */ - -#if LINUX_VERSION_IS_LESS(3,17,0) -#define devm_kvasprintf LINUX_BACKPORT(devm_kvasprintf) -extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, - va_list ap); -#define devm_kasprintf LINUX_BACKPORT(devm_kasprintf) -extern char *devm_kasprintf(struct device *dev, gfp_t gfp, - const char *fmt, ...); -#endif /* < 3.17 */ - -#if LINUX_VERSION_IS_LESS(4, 1, 0) -#define dev_of_node LINUX_BACKPORT(dev_of_node) -static inline struct device_node *dev_of_node(struct device *dev) -{ -#ifndef CONFIG_OF - return NULL; -#else - return dev->of_node; -#endif -} -#endif - -#endif /* __BACKPORT_DEVICE_H */ diff --git a/backport/backport-include/linux/dma-buf.h b/backport/backport-include/linux/dma-buf.h deleted file mode 100644 index ef1d0d3d..00000000 --- a/backport/backport-include/linux/dma-buf.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _BACKPORT_DMA_BUF_H__ -#define _BACKPORT_DMA_BUF_H__ -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(3,3,0) -#include_next <linux/dma-buf.h> -#endif /* LINUX_VERSION_IS_GEQ(3,3,0) */ -#include <linux/dma-direction.h> -#include <linux/dma-attrs.h> -#include <linux/dma-mapping.h> - -#if !defined(DEFINE_DMA_BUF_EXPORT_INFO) && LINUX_VERSION_IS_GEQ(3,3,0) -/** - * helper macro for exporters; zeros and fills in most common values - */ -#define DEFINE_DMA_BUF_EXPORT_INFO(a) \ - struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME } - -struct dma_buf_export_info { - const char *exp_name; - const struct dma_buf_ops *ops; - size_t size; - int flags; - struct reservation_object *resv; - void *priv; -}; - -#ifdef dma_buf_export -#undef dma_buf_export -#endif - -static inline -struct dma_buf *backport_dma_buf_export(const struct dma_buf_export_info *exp_info) -{ -#if LINUX_VERSION_IS_LESS(3,4,0) - return dma_buf_export(exp_info->priv, - (struct dma_buf_ops *)exp_info->ops, - exp_info->size, exp_info->flags); -#elif LINUX_VERSION_IS_LESS(3,10,0) - return dma_buf_export(exp_info->priv, exp_info->ops, - exp_info->size, exp_info->flags); -#elif LINUX_VERSION_IS_LESS(3,17,0) - return dma_buf_export_named(exp_info->priv, exp_info->ops, - exp_info->size, exp_info->flags, - exp_info->exp_name); -#else - return dma_buf_export_named(exp_info->priv, exp_info->ops, - exp_info->size, exp_info->flags, - exp_info->exp_name, exp_info->resv); -#endif -} -#define dma_buf_export LINUX_BACKPORT(dma_buf_export) -#endif /* !defined(DEFINE_DMA_BUF_EXPORT_INFO) */ - -#endif /* _BACKPORT_DMA_BUF_H__ */ diff --git a/backport/backport-include/linux/dma-mapping.h b/backport/backport-include/linux/dma-mapping.h deleted file mode 100644 index 16b0e3c6..00000000 --- a/backport/backport-include/linux/dma-mapping.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __BACKPORT_LINUX_DMA_MAPPING_H -#define __BACKPORT_LINUX_DMA_MAPPING_H -#include_next <linux/dma-mapping.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,2,0) -#define dma_zalloc_coherent LINUX_BACKPORT(dma_zalloc_coherent) -static inline void *dma_zalloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); - if (ret) - memset(ret, 0, size); - return ret; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,13,0) -/* - * Set both the DMA mask and the coherent DMA mask to the same thing. - * Note that we don't check the return value from dma_set_coherent_mask() - * as the DMA API guarantees that the coherent DMA mask can be set to - * the same or smaller than the streaming DMA mask. - */ -#define dma_set_mask_and_coherent LINUX_BACKPORT(dma_set_mask_and_coherent) -static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask) -{ - int rc = dma_set_mask(dev, mask); - if (rc == 0) - dma_set_coherent_mask(dev, mask); - return rc; -} -#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ - -#endif /* __BACKPORT_LINUX_DMA_MAPPING_H */ diff --git a/backport/backport-include/linux/dynamic_debug.h b/backport/backport-include/linux/dynamic_debug.h deleted file mode 100644 index 1ff204be..00000000 --- a/backport/backport-include/linux/dynamic_debug.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __BACKPORT_LINUX_DYNAMIC_DEBUG_H -#define __BACKPORT_LINUX_DYNAMIC_DEBUG_H -#include <linux/version.h> -#include_next <linux/dynamic_debug.h> - -#if LINUX_VERSION_IS_LESS(3,2,0) -/* backports 07613b0b */ -#if defined(CONFIG_DYNAMIC_DEBUG) -#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,4)) -#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ - static struct _ddebug __used __aligned(8) \ - __attribute__((section("__verbose"))) name = { \ - .modname = KBUILD_MODNAME, \ - .function = __func__, \ - .filename = __FILE__, \ - .format = (fmt), \ - .lineno = __LINE__, \ - .flags = _DPRINTK_FLAGS_DEFAULT, \ - .enabled = false, \ - } -#else -#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ - static struct _ddebug __used __aligned(8) \ - __attribute__((section("__verbose"))) name = { \ - .modname = KBUILD_MODNAME, \ - .function = __func__, \ - .filename = __FILE__, \ - .format = (fmt), \ - .lineno = __LINE__, \ - .flags = _DPRINTK_FLAGS_DEFAULT, \ - } -#endif /* RHEL_RELEASE_CODE < 6.4 */ -#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ -#endif /* < 3.2 */ - -#endif /* __BACKPORT_LINUX_DYNAMIC_DEBUG_H */ diff --git a/backport/backport-include/linux/eeprom_93cx6.h b/backport/backport-include/linux/eeprom_93cx6.h deleted file mode 100644 index 3385a3fb..00000000 --- a/backport/backport-include/linux/eeprom_93cx6.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _COMPAT_LINUX_EEPROM_93CX6_H -#define _COMPAT_LINUX_EEPROM_93CX6_H 1 - -#include_next <linux/eeprom_93cx6.h> - -#ifndef PCI_EEPROM_WIDTH_93C86 -#define PCI_EEPROM_WIDTH_93C86 8 -#endif /* PCI_EEPROM_WIDTH_93C86 */ - -#endif /* _COMPAT_LINUX_EEPROM_93CX6_H */ diff --git a/backport/backport-include/linux/err.h b/backport/backport-include/linux/err.h deleted file mode 100644 index d08968e5..00000000 --- a/backport/backport-include/linux/err.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_LINUX_ERR_H -#define __BACKPORT_LINUX_ERR_H -#include_next <linux/err.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,12,0) -#define PTR_ERR_OR_ZERO(p) PTR_RET(p) -#endif - -#endif /* __BACKPORT_LINUX_ERR_H */ diff --git a/backport/backport-include/linux/etherdevice.h b/backport/backport-include/linux/etherdevice.h deleted file mode 100644 index a00e6660..00000000 --- a/backport/backport-include/linux/etherdevice.h +++ /dev/null @@ -1,230 +0,0 @@ -#ifndef _BACKPORT_LINUX_ETHERDEVICE_H -#define _BACKPORT_LINUX_ETHERDEVICE_H -#include_next <linux/etherdevice.h> -#include <linux/version.h> -/* - * newer kernels include this already and some - * users rely on getting this indirectly - */ -#include <asm/unaligned.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) -#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random) -static inline void eth_hw_addr_random(struct net_device *dev) -{ - dev->addr_assign_type |= NET_ADDR_RANDOM; - random_ether_addr(dev->dev_addr); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,6,0) -#include <linux/random.h> -/** - * eth_broadcast_addr - Assign broadcast address - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Assign the broadcast address to the given address array. - */ -#define eth_broadcast_addr LINUX_BACKPORT(eth_broadcast_addr) -static inline void eth_broadcast_addr(u8 *addr) -{ - memset(addr, 0xff, ETH_ALEN); -} - -/** - * eth_random_addr - Generate software assigned random Ethernet address - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Generate a random Ethernet address (MAC) that is not multicast - * and has the local assigned bit set. - */ -#define eth_random_addr LINUX_BACKPORT(eth_random_addr) -static inline void eth_random_addr(u8 *addr) -{ - get_random_bytes(addr, ETH_ALEN); - addr[0] &= 0xfe; /* clear multicast bit */ - addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ -} -#endif /* LINUX_VERSION_IS_LESS(3,6,0) */ - -#if LINUX_VERSION_IS_LESS(3,7,0) - -/* This backports: - * - * commit 6d57e9078e880a3dd232d579f42ac437a8f1ef7b - * Author: Duan Jiong <djduanjiong@gmail.com> - * Date: Sat Sep 8 16:32:28 2012 +0000 - * - * etherdevice: introduce help function eth_zero_addr() - */ -#define eth_zero_addr LINUX_BACKPORT(eth_zero_addr) -static inline void eth_zero_addr(u8 *addr) -{ - memset(addr, 0x00, ETH_ALEN); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,5,0) -#define ether_addr_equal LINUX_BACKPORT(ether_addr_equal) -static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2) -{ - return !compare_ether_addr(addr1, addr2); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define eth_prepare_mac_addr_change LINUX_BACKPORT(eth_prepare_mac_addr_change) -extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p); - -#define eth_commit_mac_addr_change LINUX_BACKPORT(eth_commit_mac_addr_change) -extern void eth_commit_mac_addr_change(struct net_device *dev, void *p); -#endif /* < 3.9 */ - -#if LINUX_VERSION_IS_LESS(3,12,0) -/** - * eth_hw_addr_inherit - Copy dev_addr from another net_device - * @dst: pointer to net_device to copy dev_addr to - * @src: pointer to net_device to copy dev_addr from - * - * Copy the Ethernet address from one net_device to another along with - * the address attributes (addr_assign_type). - */ -static inline void eth_hw_addr_inherit(struct net_device *dst, - struct net_device *src) -{ - dst->addr_assign_type = src->addr_assign_type; - memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN); -} -#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ - -#if LINUX_VERSION_IS_LESS(3,5,0) -/** - * ether_addr_equal_64bits - Compare two Ethernet addresses - * @addr1: Pointer to an array of 8 bytes - * @addr2: Pointer to an other array of 8 bytes - * - * Compare two Ethernet addresses, returns true if equal, false otherwise. - * - * The function doesn't need any conditional branches and possibly uses - * word memory accesses on CPU allowing cheap unaligned memory reads. - * arrays = { byte1, byte2, byte3, byte4, byte5, byte6, pad1, pad2 } - * - * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits. - */ -#define ether_addr_equal_64bits LINUX_BACKPORT(ether_addr_equal_64bits) -static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], - const u8 addr2[6+2]) -{ -#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 - u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2); - -#ifdef __BIG_ENDIAN - return (fold >> 16) == 0; -#else - return (fold << 16) == 0; -#endif -#else - return ether_addr_equal(addr1, addr2); -#endif -} -#endif /* LINUX_VERSION_IS_LESS(3,5,0) */ - -#if LINUX_VERSION_IS_LESS(3,14,0) -/** - * ether_addr_equal_unaligned - Compare two not u16 aligned Ethernet addresses - * @addr1: Pointer to a six-byte array containing the Ethernet address - * @addr2: Pointer other six-byte array containing the Ethernet address - * - * Compare two Ethernet addresses, returns true if equal - * - * Please note: Use only when any Ethernet address may not be u16 aligned. - */ -#define ether_addr_equal_unaligned LINUX_BACKPORT(ether_addr_equal_unaligned) -static inline bool ether_addr_equal_unaligned(const u8 *addr1, const u8 *addr2) -{ -#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - return ether_addr_equal(addr1, addr2); -#else - return memcmp(addr1, addr2, ETH_ALEN) == 0; -#endif -} - -/** - * ether_addr_copy - Copy an Ethernet address - * @dst: Pointer to a six-byte array Ethernet address destination - * @src: Pointer to a six-byte array Ethernet address source - * - * Please note: dst & src must both be aligned to u16. - */ -#define ether_addr_copy LINUX_BACKPORT(ether_addr_copy) -static inline void ether_addr_copy(u8 *dst, const u8 *src) -{ -#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - *(u32 *)dst = *(const u32 *)src; - *(u16 *)(dst + 4) = *(const u16 *)(src + 4); -#else - u16 *a = (u16 *)dst; - const u16 *b = (const u16 *)src; - - a[0] = b[0]; - a[1] = b[1]; - a[2] = b[2]; -#endif -} -#endif /* LINUX_VERSION_IS_LESS(3,14,0) */ - -#if LINUX_VERSION_IS_LESS(3,18,0) -#define eth_get_headlen LINUX_BACKPORT(eth_get_headlen) -int eth_get_headlen(unsigned char *data, unsigned int max_len); -#endif /* LINUX_VERSION_IS_LESS(3,18,0) */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define eth_skb_pad LINUX_BACKPORT(eth_skb_pad) -/** - * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame - * @skb: Buffer to pad - * - * An Ethernet frame should have a minimum size of 60 bytes. This function - * takes short frames and pads them with zeros up to the 60 byte limit. - */ -static inline int eth_skb_pad(struct sk_buff *skb) -{ - return skb_put_padto(skb, ETH_ZLEN); -} -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#if LINUX_VERSION_IS_LESS(4,11,0) -/** - * ether_addr_to_u64 - Convert an Ethernet address into a u64 value. - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Return a u64 value of the address - */ -static inline u64 ether_addr_to_u64(const u8 *addr) -{ - u64 u = 0; - int i; - - for (i = 0; i < ETH_ALEN; i++) - u = u << 8 | addr[i]; - - return u; -} - -/** - * u64_to_ether_addr - Convert a u64 to an Ethernet address. - * @u: u64 to convert to an Ethernet MAC address - * @addr: Pointer to a six-byte array to contain the Ethernet address - */ -static inline void u64_to_ether_addr(u64 u, u8 *addr) -{ - int i; - - for (i = ETH_ALEN - 1; i >= 0; i--) { - addr[i] = u & 0xff; - u = u >> 8; - } -} -#endif /* LINUX_VERSION_IS_LESS(4,11,0) */ - -#endif /* _BACKPORT_LINUX_ETHERDEVICE_H */ diff --git a/backport/backport-include/linux/ethtool.h b/backport/backport-include/linux/ethtool.h deleted file mode 100644 index 7a78bb59..00000000 --- a/backport/backport-include/linux/ethtool.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_LINUX_ETHTOOL_H -#define __BACKPORT_LINUX_ETHTOOL_H -#include_next <linux/ethtool.h> -#include <linux/version.h> - -#ifndef SPEED_UNKNOWN -#define SPEED_UNKNOWN -1 -#endif /* SPEED_UNKNOWN */ - -#ifndef DUPLEX_UNKNOWN -#define DUPLEX_UNKNOWN 0xff -#endif /* DUPLEX_UNKNOWN */ - -#ifndef ETHTOOL_FWVERS_LEN -#define ETHTOOL_FWVERS_LEN 32 -#endif - -#endif /* __BACKPORT_LINUX_ETHTOOL_H */ diff --git a/backport/backport-include/linux/eventpoll.h b/backport/backport-include/linux/eventpoll.h deleted file mode 100644 index 7cc87aa0..00000000 --- a/backport/backport-include/linux/eventpoll.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __BACKPORT_LINUX_EVENTPOLL_H -#define __BACKPORT_LINUX_EVENTPOLL_H -#include_next <linux/eventpoll.h> - -#ifndef EPOLLIN -#define EPOLLIN 0x00000001 -#endif - -#ifndef EPOLLPRI -#define EPOLLPRI 0x00000002 -#endif - -#ifndef EPOLLOUT -#define EPOLLOUT 0x00000004 -#endif - -#ifndef EPOLLERR -#define EPOLLERR 0x00000008 -#endif - -#ifndef EPOLLHUP -#define EPOLLHUP 0x00000010 -#endif - -#ifndef EPOLLRDNORM -#define EPOLLRDNORM 0x00000040 -#endif - -#ifndef EPOLLRDBAND -#define EPOLLRDBAND 0x00000080 -#endif - -#ifndef EPOLLWRNORM -#define EPOLLWRNORM 0x00000100 -#endif - -#ifndef EPOLLWRBAND -#define EPOLLWRBAND 0x00000200 -#endif - -#ifndef EPOLLMSG -#define EPOLLMSG 0x00000400 -#endif - -#ifndef EPOLLRDHUP -#define EPOLLRDHUP 0x00002000 -#endif - -#endif /* __BACKPORT_LINUX_EVENTPOLL_H */ diff --git a/backport/backport-include/linux/export.h b/backport/backport-include/linux/export.h deleted file mode 100644 index a3c7799a..00000000 --- a/backport/backport-include/linux/export.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _COMPAT_LINUX_EXPORT_H -#define _COMPAT_LINUX_EXPORT_H 1 - -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,1,0) -#include_next <linux/export.h> -#else -#ifndef pr_fmt -#define backport_undef_pr_fmt -#endif -#include <linux/module.h> -#ifdef backport_undef_pr_fmt -#undef pr_fmt -#undef backport_undef_pr_fmt -#endif -#endif /* LINUX_VERSION_IS_GEQ(3,1,0) */ - -#endif /* _COMPAT_LINUX_EXPORT_H */ diff --git a/backport/backport-include/linux/firmware.h b/backport/backport-include/linux/firmware.h deleted file mode 100644 index b5bc16be..00000000 --- a/backport/backport-include/linux/firmware.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __BACKPORT_LINUX_FIRMWARE_H -#define __BACKPORT_LINUX_FIRMWARE_H -#include_next <linux/firmware.h> - -#if LINUX_VERSION_IS_LESS(3,14,0) -#define request_firmware_direct(fw, name, device) request_firmware(fw, name, device) -#endif -#if LINUX_VERSION_IS_LESS(4,18,0) -#define firmware_request_nowarn(fw, name, device) request_firmware(fw, name, device) -#endif - -#if LINUX_VERSION_IS_LESS(4,17,0) -#define firmware_request_cache LINUX_BACKPORT(firmware_request_cache) -static inline int firmware_request_cache(struct device *device, const char *name) -{ - return 0; -} -#endif - -#endif /* __BACKPORT_LINUX_FIRMWARE_H */ diff --git a/backport/backport-include/linux/freezer.h b/backport/backport-include/linux/freezer.h deleted file mode 100644 index c6053f30..00000000 --- a/backport/backport-include/linux/freezer.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __BACKPORT_FREEZER_H_INCLUDED -#define __BACKPORT_FREEZER_H_INCLUDED -#include_next <linux/freezer.h> - -#ifdef CONFIG_FREEZER -#if LINUX_VERSION_IS_LESS(3,11,0) -/* - * Like schedule_hrtimeout_range(), but should not block the freezer. Do not - * call this with locks held. - */ -#define freezable_schedule_hrtimeout_range LINUX_BACKPORT(freezable_schedule_hrtimeout_range) -static inline int freezable_schedule_hrtimeout_range(ktime_t *expires, - unsigned long delta, const enum hrtimer_mode mode) -{ - int __retval; - freezer_do_not_count(); - __retval = schedule_hrtimeout_range(expires, delta, mode); - freezer_count(); - return __retval; -} -#endif /* LINUX_VERSION_IS_LESS(3,11,0) */ - -#else /* !CONFIG_FREEZER */ - -#ifndef freezable_schedule_hrtimeout_range -#define freezable_schedule_hrtimeout_range(expires, delta, mode) \ - schedule_hrtimeout_range(expires, delta, mode) -#endif - -#endif /* !CONFIG_FREEZER */ - -#endif /* __BACKPORT_FREEZER_H_INCLUDED */ diff --git a/backport/backport-include/linux/fs.h b/backport/backport-include/linux/fs.h deleted file mode 100644 index 6e4d4a53..00000000 --- a/backport/backport-include/linux/fs.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _COMPAT_LINUX_FS_H -#define _COMPAT_LINUX_FS_H -#include_next <linux/fs.h> -#include <linux/version.h> -/* - * some versions don't have this and thus don't - * include it from the original fs.h - */ -#include <linux/uidgid.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) -#define simple_open LINUX_BACKPORT(simple_open) -extern int simple_open(struct inode *inode, struct file *file); -#endif - -#if LINUX_VERSION_IS_LESS(3,9,0) -/** - * backport of: - * - * commit 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 - * Author: Al Viro <viro@zeniv.linux.org.uk> - * Date: Wed Jan 23 17:07:38 2013 -0500 - * - * new helper: file_inode(file) - */ -static inline struct inode *file_inode(struct file *f) -{ - return f->f_path.dentry->d_inode; -} -#endif - -#ifndef replace_fops -/* - * This one is to be used *ONLY* from ->open() instances. - * fops must be non-NULL, pinned down *and* module dependencies - * should be sufficient to pin the caller down as well. - */ -#define replace_fops(f, fops) \ - do { \ - struct file *__file = (f); \ - fops_put(__file->f_op); \ - BUG_ON(!(__file->f_op = (fops))); \ - } while(0) -#endif /* replace_fops */ - -#if (LINUX_VERSION_IS_LESS(4,5,0) && \ - LINUX_VERSION_IS_GEQ(3,2,0)) -#define no_seek_end_llseek LINUX_BACKPORT(no_seek_end_llseek) -extern loff_t no_seek_end_llseek(struct file *, loff_t, int); -#endif /* < 4.5 && >= 3.2 */ - -#endif /* _COMPAT_LINUX_FS_H */ diff --git a/backport/backport-include/linux/ftrace_event.h b/backport/backport-include/linux/ftrace_event.h deleted file mode 100644 index edea21ee..00000000 --- a/backport/backport-include/linux/ftrace_event.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_LINUX_FTRACE_EVENT_H -#define __BACKPORT_LINUX_FTRACE_EVENT_H -#include_next <linux/ftrace_event.h> - -#if LINUX_VERSION_IS_LESS(4,0,0) -const char *ftrace_print_array_seq(struct trace_seq *p, - const void *buf, int buf_len, - size_t el_size); -#endif -#endif /* __BACKPORT_LINUX_FTRACE_EVENT_H */ diff --git a/backport/backport-include/linux/genetlink.h b/backport/backport-include/linux/genetlink.h deleted file mode 100644 index afd1f678..00000000 --- a/backport/backport-include/linux/genetlink.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_LINUX_GENETLINK_H -#define __BACKPORT_LINUX_GENETLINK_H -#include_next <linux/genetlink.h> - -/* This backports: - * - * commit e9412c37082b5c932e83364aaed0c38c2ce33acb - * Author: Neil Horman <nhorman@tuxdriver.com> - * Date: Tue May 29 09:30:41 2012 +0000 - * - * genetlink: Build a generic netlink family module alias - */ -#ifndef MODULE_ALIAS_GENL_FAMILY -#define MODULE_ALIAS_GENL_FAMILY(family)\ - MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family) -#endif - -#endif /* __BACKPORT_LINUX_GENETLINK_H */ diff --git a/backport/backport-include/linux/gfp.h b/backport/backport-include/linux/gfp.h deleted file mode 100644 index d41d4277..00000000 --- a/backport/backport-include/linux/gfp.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __BACKPORT_LINUX_GFP_H -#define __BACKPORT_LINUX_GFP_H -#include_next <linux/gfp.h> - -#ifndef ___GFP_KSWAPD_RECLAIM -#define ___GFP_KSWAPD_RECLAIM 0x0u -#endif - -#ifndef __GFP_KSWAPD_RECLAIM -#define __GFP_KSWAPD_RECLAIM ((__force gfp_t)___GFP_KSWAPD_RECLAIM) /* kswapd can wake */ -#endif - -#if LINUX_VERSION_IS_LESS(4,10,0) && LINUX_VERSION_IS_GEQ(4,2,0) -#define page_frag_alloc LINUX_BACKPORT(page_frag_alloc) -static inline void *page_frag_alloc(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) -{ - return __alloc_page_frag(nc, fragsz, gfp_mask); -} - -#define __page_frag_cache_drain LINUX_BACKPORT(__page_frag_cache_drain) -void __page_frag_cache_drain(struct page *page, unsigned int count); -#endif /* < 4.10 && >= 4.2 */ - -#endif /* __BACKPORT_LINUX_GFP_H */ diff --git a/backport/backport-include/linux/gpio.h b/backport/backport-include/linux/gpio.h deleted file mode 100644 index ef4a8f18..00000000 --- a/backport/backport-include/linux/gpio.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __BACKPORT_LINUX_GPIO_H -#define __BACKPORT_LINUX_GPIO_H -#include_next <linux/gpio.h> - -#if LINUX_VERSION_IS_LESS(3,5,0) -#define devm_gpio_request_one LINUX_BACKPORT(devm_gpio_request_one) -#define devm_gpio_request LINUX_BACKPORT(devm_gpio_request) -#ifdef CONFIG_GPIOLIB -int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); -int devm_gpio_request_one(struct device *dev, unsigned gpio, - unsigned long flags, const char *label); -void devm_gpio_free(struct device *dev, unsigned int gpio); -#else -static inline int devm_gpio_request(struct device *dev, unsigned gpio, - const char *label) -{ - WARN_ON(1); - return -EINVAL; -} - -static inline int devm_gpio_request_one(struct device *dev, unsigned gpio, - unsigned long flags, const char *label) -{ - WARN_ON(1); - return -EINVAL; -} - -static inline void devm_gpio_free(struct device *dev, unsigned int gpio) -{ - WARN_ON(1); -} -#endif /* CONFIG_GPIOLIB */ -#endif - -#endif /* __BACKPORT_LINUX_GPIO_H */ diff --git a/backport/backport-include/linux/gpio/driver.h b/backport/backport-include/linux/gpio/driver.h deleted file mode 100644 index 8df5c298..00000000 --- a/backport/backport-include/linux/gpio/driver.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BP_GPIO_DRIVER_H -#define __BP_GPIO_DRIVER_H -#include <linux/version.h> -#if LINUX_VERSION_IS_LESS(3,13,0) -#include <asm-generic/gpio.h> -#else -#include_next <linux/gpio/driver.h> -#endif - -#endif /* __BP_GPIO_DRIVER_H */ diff --git a/backport/backport-include/linux/hashtable.h b/backport/backport-include/linux/hashtable.h deleted file mode 100644 index 33314dc5..00000000 --- a/backport/backport-include/linux/hashtable.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __BACKPORT_HASHTABLE_H -#define __BACKPORT_HASHTABLE_H -#include_next <linux/hashtable.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -/** - * backport: - * - * commit 0bbacca7c3911451cea923b0ad6389d58e3d9ce9 - * Author: Sasha Levin <sasha.levin@oracle.com> - * Date: Thu Feb 7 12:32:18 2013 +1100 - * - * hlist: drop the node parameter from iterators - */ -#include <linux/list.h> -#include <backport/magic.h> - -#undef hash_for_each -#define hash_for_each(name, bkt, obj, member) \ - for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ - (bkt)++)\ - hlist_for_each_entry(obj, &name[bkt], member) - -#undef hash_for_each_safe -#define hash_for_each_safe(name, bkt, tmp, obj, member) \ - for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\ - (bkt)++)\ - hlist_for_each_entry_safe(obj, tmp, &name[bkt], member) - -#undef hash_for_each_possible -#define hash_for_each_possible(name, obj, member, key) \ - hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member) - -#undef hash_for_each_possible_safe -#define hash_for_each_possible_safe(name, obj, tmp, member, key) \ - hlist_for_each_entry_safe(obj, tmp,\ - &name[hash_min(key, HASH_BITS(name))], member) - -#endif - -#endif /* __BACKPORT_HASHTABLE_H */ diff --git a/backport/backport-include/linux/hid.h b/backport/backport-include/linux/hid.h deleted file mode 100644 index 887c6b15..00000000 --- a/backport/backport-include/linux/hid.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __BACKPORT_HID_H -#define __BACKPORT_HID_H -#include_next <linux/hid.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,8,0) -#define hid_ignore LINUX_BACKPORT(hid_ignore) -extern bool hid_ignore(struct hid_device *); -#endif - -#if LINUX_VERSION_IS_LESS(3,1,0) -#define HID_TYPE_USBNONE 2 -#endif - -#ifndef HID_QUIRK_NO_IGNORE -#define HID_QUIRK_NO_IGNORE 0x40000000 -#endif - -#ifndef HID_QUIRK_HIDDEV_FORCE -#define HID_QUIRK_HIDDEV_FORCE 0x00000010 -#endif - -#ifndef HID_QUIRK_IGNORE -#define HID_QUIRK_IGNORE 0x00000004 -#endif - -#ifndef HID_USB_DEVICE -#define HID_USB_DEVICE(ven, prod) \ - .bus = BUS_USB, .vendor = (ven), .product = (prod) -#endif - -#ifndef HID_BLUETOOTH_DEVICE -#define HID_BLUETOOTH_DEVICE(ven, prod) \ - .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod) -#endif - -#ifndef hid_printk -#define hid_printk(level, hid, fmt, arg...) \ - dev_printk(level, &(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_emerg -#define hid_emerg(hid, fmt, arg...) \ - dev_emerg(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_crit -#define hid_crit(hid, fmt, arg...) \ - dev_crit(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_alert -#define hid_alert(hid, fmt, arg...) \ - dev_alert(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_err -#define hid_err(hid, fmt, arg...) \ - dev_err(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_notice -#define hid_notice(hid, fmt, arg...) \ - dev_notice(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_warn -#define hid_warn(hid, fmt, arg...) \ - dev_warn(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_info -#define hid_info(hid, fmt, arg...) \ - dev_info(&(hid)->dev, fmt, ##arg) -#endif - -#ifndef hid_dbg -#define hid_dbg(hid, fmt, arg...) \ - dev_dbg(&(hid)->dev, fmt, ##arg) -#endif - -#if LINUX_VERSION_IS_LESS(3,12,0) -#define hid_alloc_report_buf LINUX_BACKPORT(hid_alloc_report_buf) -u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); -#endif - -#endif /* __BACKPORT_HID_H */ diff --git a/backport/backport-include/linux/hrtimer.h b/backport/backport-include/linux/hrtimer.h deleted file mode 100644 index 2c186dd1..00000000 --- a/backport/backport-include/linux/hrtimer.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_LINUX_HRTIMER_H -#define __BACKPORT_LINUX_HRTIMER_H -#include_next <linux/hrtimer.h> - -#if LINUX_VERSION_IS_LESS(3,17,0) -u64 bp_ktime_divns(const ktime_t kt, s64 div); -#define ktime_divns bp_ktime_divns -#endif /* < 3.17 */ - -#endif /* __BACKPORT_LINUX_HRTIMER_H */ diff --git a/backport/backport-include/linux/hwmon.h b/backport/backport-include/linux/hwmon.h deleted file mode 100644 index 3b61b268..00000000 --- a/backport/backport-include/linux/hwmon.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __BACKPORT_LINUX_HWMON_H -#define __BACKPORT_LINUX_HWMON_H -#include_next <linux/hwmon.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,13,0) -/* - * Backports - * - * commit bab2243ce1897865e31ea6d59b0478391f51812b - * Author: Guenter Roeck <linux@roeck-us.net> - * Date: Sat Jul 6 13:57:23 2013 -0700 - * - * hwmon: Introduce hwmon_device_register_with_groups - * - * hwmon_device_register_with_groups() lets callers register a hwmon device - * together with all sysfs attributes in a single call. - * - * When using hwmon_device_register_with_groups(), hwmon attributes are attached - * to the hwmon device directly and no longer with its parent device. - * - * Signed-off-by: Guenter Roeck <linux@roeck-us.net> - */ -struct device * -hwmon_device_register_with_groups(struct device *dev, const char *name, - void *drvdata, - const struct attribute_group **groups); -struct device * -devm_hwmon_device_register_with_groups(struct device *dev, const char *name, - void *drvdata, - const struct attribute_group **groups); -#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ - -#endif /* __BACKPORT_LINUX_HWMON_H */ diff --git a/backport/backport-include/linux/i2c-mux.h b/backport/backport-include/linux/i2c-mux.h deleted file mode 100644 index d12658dc..00000000 --- a/backport/backport-include/linux/i2c-mux.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BACKPORT_LINUX_I2C_MUX_H -#define __BACKPORT_LINUX_I2C_MUX_H -#include_next <linux/i2c-mux.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,5,0) -#define i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, class, select, deselect) \ - i2c_add_mux_adapter(parent, mux_priv, force_nr, chan_id, select, deselect) -#elif LINUX_VERSION_IS_LESS(3,7,0) -#define i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, class, select, deselect) \ - i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, select, deselect) -#endif - -#endif /* __BACKPORT_LINUX_I2C_MUX_H */ diff --git a/backport/backport-include/linux/i2c.h b/backport/backport-include/linux/i2c.h deleted file mode 100644 index c8f7a8dc..00000000 --- a/backport/backport-include/linux/i2c.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __BACKPORT_LINUX_I2C_H -#define __BACKPORT_LINUX_I2C_H -#include_next <linux/i2c.h> -#include <linux/version.h> - -/* This backports - * - * commit 14674e70119ea01549ce593d8901a797f8a90f74 - * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> - * Date: Wed May 30 10:55:34 2012 +0200 - * - * i2c: Split I2C_M_NOSTART support out of I2C_FUNC_PROTOCOL_MANGLING - */ -#ifndef I2C_FUNC_NOSTART -#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ -#endif - -/* This backports: - * - * commit 7c92784a546d2945b6d6973a30f7134be78eb7a4 - * Author: Lars-Peter Clausen <lars@metafoo.de> - * Date: Wed Nov 16 10:13:36 2011 +0100 - * - * I2C: Add helper macro for i2c_driver boilerplate - */ -#ifndef module_i2c_driver -#define module_i2c_driver(__i2c_driver) \ - module_driver(__i2c_driver, i2c_add_driver, \ - i2c_del_driver) -#endif - -#ifndef I2C_CLIENT_SCCB -#define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */ - /* Must match I2C_M_STOP|IGNORE_NAK */ -#endif - -#endif /* __BACKPORT_LINUX_I2C_H */ diff --git a/backport/backport-include/linux/idr.h b/backport/backport-include/linux/idr.h deleted file mode 100644 index 01aa2c29..00000000 --- a/backport/backport-include/linux/idr.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __BACKPORT_IDR_H -#define __BACKPORT_IDR_H -/* some versions have a broken idr header */ -#include <linux/spinlock.h> -#include_next <linux/idr.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,1,0) -#define ida_simple_get LINUX_BACKPORT(ida_simple_get) -int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end, - gfp_t gfp_mask); - -#define ida_simple_remove LINUX_BACKPORT(ida_simple_remove) -void ida_simple_remove(struct ida *ida, unsigned int id); -#endif - -#if LINUX_VERSION_IS_LESS(3,9,0) -#include <linux/errno.h> -/** - * backport of idr idr_alloc() usage - * - * This backports a patch series send by Tejun Heo: - * https://lkml.org/lkml/2013/2/2/159 - */ -static inline void compat_idr_destroy(struct idr *idp) -{ - idr_remove_all(idp); - idr_destroy(idp); -} -#define idr_destroy(idp) compat_idr_destroy(idp) - -static inline int idr_alloc(struct idr *idr, void *ptr, int start, int end, - gfp_t gfp_mask) -{ - int id, ret; - - do { - if (!idr_pre_get(idr, gfp_mask)) - return -ENOMEM; - ret = idr_get_new_above(idr, ptr, start, &id); - if (!ret && id > end) { - idr_remove(idr, id); - ret = -ENOSPC; - } - } while (ret == -EAGAIN); - - return ret ? ret : id; -} - -static inline void idr_preload(gfp_t gfp_mask) -{ -} - -static inline void idr_preload_end(void) -{ -} -#endif - -#ifndef idr_for_each_entry -#define idr_for_each_entry(idp, entry, id) \ - for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id) -#endif - -#if LINUX_VERSION_IS_LESS(4, 11, 0) -static inline void *backport_idr_remove(struct idr *idr, int id) -{ - void *item = idr_find(idr, id); - idr_remove(idr, id); - return item; -} -#define idr_remove backport_idr_remove -#endif - -#endif /* __BACKPORT_IDR_H */ diff --git a/backport/backport-include/linux/if_arp.h b/backport/backport-include/linux/if_arp.h deleted file mode 100644 index b542423c..00000000 --- a/backport/backport-include/linux/if_arp.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _BACKPORTS_LINUX_AF_ARP_H -#define _BACKPORTS_LINUX_AF_ARP_H 1 - -#include_next <linux/if_arp.h> - -#ifndef ARPHRD_IEEE802154_MONITOR -#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ -#endif - -#ifndef ARPHRD_6LOWPAN -#define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ -#endif - -#endif /* _BACKPORTS_LINUX_AF_ARP_H */ diff --git a/backport/backport-include/linux/if_ether.h b/backport/backport-include/linux/if_ether.h deleted file mode 100644 index 344480a2..00000000 --- a/backport/backport-include/linux/if_ether.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __BACKPORT_IF_ETHER_H -#define __BACKPORT_IF_ETHER_H -#include_next <linux/if_ether.h> - -/* See commit b62faf3c in next-20140311 */ -#ifndef ETH_P_80221 -#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ -#endif - -/* - * backport of: - * commit e5c5d22e8dcf7c2d430336cbf8e180bd38e8daf1 - * Author: Simon Horman <horms@verge.net.au> - * Date: Thu Mar 28 13:38:25 2013 +0900 - * - * net: add ETH_P_802_3_MIN - */ -#ifndef ETH_P_802_3_MIN -#define ETH_P_802_3_MIN 0x0600 -#endif - -#ifndef ETH_P_TDLS -#define ETH_P_TDLS 0x890D /* TDLS */ -#endif - -#ifndef ETH_P_LINK_CTL -#define ETH_P_LINK_CTL 0x886c -#endif - -#ifndef ETH_P_PAE -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ -#endif - -#ifndef ETH_P_TEB -#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ -#endif - -#ifndef ETH_P_8021AD -#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ -#endif - -#ifndef ETH_P_PREAUTH -#define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ -#endif - -#ifndef ETH_MIN_MTU -#define ETH_MIN_MTU 68 -#endif - -#ifndef ETH_MAX_MTU -#define ETH_MAX_MTU 0xFFFFU -#endif - -#endif /* __BACKPORT_IF_ETHER_H */ diff --git a/backport/backport-include/linux/if_vlan.h b/backport/backport-include/linux/if_vlan.h deleted file mode 100644 index 18f63e80..00000000 --- a/backport/backport-include/linux/if_vlan.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __BACKPORT_LINUX_IF_VLAN_H_ -#define __BACKPORT_LINUX_IF_VLAN_H_ -#include_next <linux/if_vlan.h> - -#if LINUX_VERSION_IS_LESS(3,10,0) -#define vlan_insert_tag(__skb, __vlan_proto, __vlan_tci) vlan_insert_tag(__skb, __vlan_tci) -#define __vlan_put_tag(__skb, __vlan_proto, __vlan_tci) __vlan_put_tag(__skb, __vlan_tci) -#define vlan_put_tag(__skb, __vlan_proto, __vlan_tci) vlan_put_tag(__skb, __vlan_tci) -#define __vlan_hwaccel_put_tag(__skb, __vlan_proto, __vlan_tag) __vlan_hwaccel_put_tag(__skb, __vlan_tag) - -#define __vlan_find_dev_deep(__real_dev, __vlan_proto, __vlan_id) __vlan_find_dev_deep(__real_dev, __vlan_id) - -#endif - -#ifndef VLAN_PRIO_MASK -#define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ -#endif - -#ifndef VLAN_PRIO_SHIFT -#define VLAN_PRIO_SHIFT 13 -#endif - -#if LINUX_VERSION_IS_LESS(3,16,0) -#define __vlan_find_dev_deep_rcu(real_dev, vlan_proto, vlan_id) __vlan_find_dev_deep(real_dev, vlan_proto, vlan_id) -#endif - -#ifndef skb_vlan_tag_present -#define skb_vlan_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) -#endif - -#ifndef skb_vlan_tag_get -#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) -#endif - -#ifndef skb_vlan_tag_get_id -#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK) -#endif - -#endif /* __BACKPORT_LINUX_IF_VLAN_H_ */ diff --git a/backport/backport-include/linux/init.h b/backport/backport-include/linux/init.h deleted file mode 100644 index 3a122829..00000000 --- a/backport/backport-include/linux/init.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __BACKPORT_INIT_H -#define __BACKPORT_INIT_H -#include_next <linux/init.h> - -/* - * Backports 312b1485fb509c9bc32eda28ad29537896658cb8 - * Author: Sam Ravnborg <sam@ravnborg.org> - * Date: Mon Jan 28 20:21:15 2008 +0100 - * - * Introduce new section reference annotations tags: __ref, __refdata, __refconst - */ -#ifndef __ref -#define __ref __init_refok -#endif -#ifndef __refdata -#define __refdata __initdata_refok -#endif - -#endif /* __BACKPORT_INIT_H */ diff --git a/backport/backport-include/linux/input.h b/backport/backport-include/linux/input.h deleted file mode 100644 index 3442db0f..00000000 --- a/backport/backport-include/linux/input.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __BACKPORT_INPUT_H -#define __BACKPORT_INPUT_H -#include_next <linux/input.h> - -#ifndef KEY_WIMAX -#define KEY_WIMAX 246 -#endif - -#ifndef KEY_WPS_BUTTON -#define KEY_WPS_BUTTON 0x211 -#endif - -#ifndef KEY_RFKILL -#define KEY_RFKILL 247 -#endif - -#ifndef SW_RFKILL_ALL -#define SW_RFKILL_ALL 0x03 -#endif - -#endif /* __BACKPORT_INPUT_H */ diff --git a/backport/backport-include/linux/interrupt.h b/backport/backport-include/linux/interrupt.h deleted file mode 100644 index ad3cbf66..00000000 --- a/backport/backport-include/linux/interrupt.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _BP_LINUX_INTERRUPT_H -#define _BP_LINUX_INTERRUPT_H -#include <linux/version.h> -#include_next <linux/interrupt.h> -#include <linux/ktime.h> - -#if LINUX_VERSION_IS_LESS(4,10,0) -static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time, - const enum hrtimer_mode mode) -{ - ktime_t _time = { .tv64 = time }; - hrtimer_start(timer, _time, mode); -} -#define hrtimer_start LINUX_BACKPORT(hrtimer_start) -#endif - -#endif /* _BP_LINUX_INTERRUPT_H */ diff --git a/backport/backport-include/linux/io.h b/backport/backport-include/linux/io.h deleted file mode 100644 index 78ae4650..00000000 --- a/backport/backport-include/linux/io.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BP_LINUX_IO_H -#define __BP_LINUX_IO_H -#include_next <linux/io.h> - -#ifndef IOMEM_ERR_PTR -#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err) -#endif - -#endif /* __BP_LINUX_IO_H */ diff --git a/backport/backport-include/linux/ioport.h b/backport/backport-include/linux/ioport.h deleted file mode 100644 index 34244014..00000000 --- a/backport/backport-include/linux/ioport.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BACKPORT_LINUX_IOPORT_H -#define __BACKPORT_LINUX_IOPORT_H -#include_next <linux/ioport.h> - -#ifndef IORESOURCE_REG -#define IORESOURCE_REG 0x00000300 -#endif - -#endif /* __BACKPORT_LINUX_IOPORT_H */ diff --git a/backport/backport-include/linux/irq.h b/backport/backport-include/linux/irq.h deleted file mode 100644 index e216f4f8..00000000 --- a/backport/backport-include/linux/irq.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __BACKPORT_LINUX_IRQ_H -#define __BACKPORT_LINUX_IRQ_H -#include_next <linux/irq.h> - -#ifdef CONFIG_HAVE_GENERIC_HARDIRQS -#if LINUX_VERSION_IS_LESS(3,11,0) -#define irq_get_trigger_type LINUX_BACKPORT(irq_get_trigger_type) -static inline u32 irq_get_trigger_type(unsigned int irq) -{ - struct irq_data *d = irq_get_irq_data(irq); - return d ? irqd_get_trigger_type(d) : 0; -} -#endif -#endif /* CONFIG_HAVE_GENERIC_HARDIRQS */ - -#endif /* __BACKPORT_LINUX_IRQ_H */ diff --git a/backport/backport-include/linux/irqdomain.h b/backport/backport-include/linux/irqdomain.h deleted file mode 100644 index 1878a29e..00000000 --- a/backport/backport-include/linux/irqdomain.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BACKPORT_LINUX_IRQDOMAIN_H -#define __BACKPORT_LINUX_IRQDOMAIN_H -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,1,0) -#include_next <linux/irqdomain.h> -#endif - -#endif /* __BACKPORT_LINUX_IRQDOMAIN_H */ diff --git a/backport/backport-include/linux/jiffies.h b/backport/backport-include/linux/jiffies.h deleted file mode 100644 index bbadcc8c..00000000 --- a/backport/backport-include/linux/jiffies.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __BACKPORT_LNIUX_JIFFIES_H -#define __BACKPORT_LNIUX_JIFFIES_H -#include_next <linux/jiffies.h> - -#ifndef time_is_before_jiffies -#define time_is_before_jiffies(a) time_after(jiffies, a) -#endif - -#ifndef time_is_after_jiffies -#define time_is_after_jiffies(a) time_before(jiffies, a) -#endif - -#ifndef time_is_before_eq_jiffies -#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a) -#endif - -#ifndef time_is_after_eq_jiffies -#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a) -#endif - -/* - * This function is available, but not exported in kernel < 3.17, add - * an own version. - */ -#if LINUX_VERSION_IS_LESS(3,17,0) -#define nsecs_to_jiffies LINUX_BACKPORT(nsecs_to_jiffies) -extern unsigned long nsecs_to_jiffies(u64 n); -#endif /* 3.17 */ - -#endif /* __BACKPORT_LNIUX_JIFFIES_H */ diff --git a/backport/backport-include/linux/kconfig.h b/backport/backport-include/linux/kconfig.h deleted file mode 100644 index d1faad9b..00000000 --- a/backport/backport-include/linux/kconfig.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __BACKPORT_LINUX_KCONFIG_H -#define __BACKPORT_LINUX_KCONFIG_H -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(3,1,0) -#include_next <linux/kconfig.h> -#endif - -#ifndef __ARG_PLACEHOLDER_1 -#define __ARG_PLACEHOLDER_1 0, -#define config_enabled(cfg) _config_enabled(cfg) -#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) -#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) -#define ___config_enabled(__ignored, val, ...) val - -/* - * 3.1 - 3.3 had a broken version of this, so undef - * (they didn't have __ARG_PLACEHOLDER_1) - */ -#undef IS_ENABLED -#define IS_ENABLED(option) \ - (config_enabled(option) || config_enabled(option##_MODULE)) -#endif - -/* - * Since 4.9 config_enabled has been removed in favor of __is_defined. - */ -#ifndef config_enabled -#define config_enabled(cfg) __is_defined(cfg) -#endif - -#undef IS_BUILTIN -#define IS_BUILTIN(option) config_enabled(option) - -#ifndef IS_REACHABLE -/* - * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled - * code can call a function defined in code compiled based on CONFIG_FOO. - * This is similar to IS_ENABLED(), but returns false when invoked from - * built-in code when CONFIG_FOO is set to 'm'. - */ -#define IS_REACHABLE(option) (config_enabled(option) || \ - (config_enabled(option##_MODULE) && config_enabled(MODULE))) -#endif - -#endif diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h deleted file mode 100644 index 332f1537..00000000 --- a/backport/backport-include/linux/kernel.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef __BACKPORT_KERNEL_H -#define __BACKPORT_KERNEL_H -#include_next <linux/kernel.h> -#if LINUX_VERSION_IS_GEQ(4,5,0) -#include <linux/bug.h> -#endif -#include <linux/version.h> -/* - * some older kernels don't have this and thus don't - * include it from kernel.h like new kernels - */ -#include <linux/printk.h> - -/* - * This backports: - * - * From a3860c1c5dd1137db23d7786d284939c5761d517 Mon Sep 17 00:00:00 2001 - * From: Xi Wang <xi.wang@gmail.com> - * Date: Thu, 31 May 2012 16:26:04 -0700 - * Subject: [PATCH] introduce SIZE_MAX - */ -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -/* This backports: - * - * commit 36a26c69b4c70396ef569c3452690fba0c1dec08 - * Author: Nicholas Bellinger <nab@linux-iscsi.org> - * Date: Tue Jul 26 00:35:26 2011 -0700 - * - * kernel.h: Add DIV_ROUND_UP_ULL and DIV_ROUND_UP_SECTOR_T macro usage - */ -#ifndef DIV_ROUND_UP_ULL -#define DIV_ROUND_UP_ULL(ll,d) \ - ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; }) -#endif - -#ifndef USHRT_MAX -#define USHRT_MAX ((u16)(~0U)) -#endif - -#ifndef SHRT_MAX -#define SHRT_MAX ((s16)(USHRT_MAX>>1)) -#endif - -#ifndef SHRT_MIN -#define SHRT_MIN ((s16)(-SHRT_MAX - 1)) -#endif - -#ifndef U8_MAX -#define U8_MAX ((u8)~0U) -#endif - -#ifndef S8_MAX -#define S8_MAX ((s8)(U8_MAX>>1)) -#endif - -#ifndef S8_MIN -#define S8_MIN ((s8)(-S8_MAX - 1)) -#endif - -#ifndef U16_MAX -#define U16_MAX ((u16)~0U) -#endif - -#ifndef S16_MAX -#define S16_MAX ((s16)(U16_MAX>>1)) -#endif - -#ifndef S16_MIN -#define S16_MIN ((s16)(-S16_MAX - 1)) -#endif - -#ifndef U32_MAX -#define U32_MAX ((u32)~0U) -#endif - -#ifndef S32_MAX -#define S32_MAX ((s32)(U32_MAX>>1)) -#endif - -#ifndef S32_MIN -#define S32_MIN ((s32)(-S32_MAX - 1)) -#endif - -#ifndef __round_mask -#define __round_mask(x, y) ((__typeof__(x))((y)-1)) -#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) -#define round_down(x, y) ((x) & ~__round_mask(x, y)) -#endif - -#ifndef DIV_ROUND_CLOSEST -#define DIV_ROUND_CLOSEST(x, divisor)( \ -{ \ - typeof(x) __x = x; \ - typeof(divisor) __d = divisor; \ - (((typeof(x))-1) > 0 || \ - ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ - (((__x) + ((__d) / 2)) / (__d)) : \ - (((__x) - ((__d) / 2)) / (__d)); \ -} \ -) -#endif - -#ifndef DIV_ROUND_CLOSEST_ULL -#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \ -{ \ - typeof(divisor) __d = divisor; \ - unsigned long long _tmp = (x) + (__d) / 2; \ - do_div(_tmp, __d); \ - _tmp; \ -} \ -) -#endif - -#ifndef swap -#define swap(a, b) \ - do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) -#endif - -#ifndef lower_32_bits -#define lower_32_bits(n) ((u32)(n)) -#endif - -#ifndef clamp -#define clamp(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(min) __min = (min); \ - typeof(max) __max = (max); \ - (void) (&__val == &__min); \ - (void) (&__val == &__max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) -#endif - -#ifndef clamp_t -#define clamp_t(type, val, min, max) ({ \ - type __val = (val); \ - type __min = (min); \ - type __max = (max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) -#endif - -#ifndef clamp_val -#define clamp_val(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(val) __min = (min); \ - typeof(val) __max = (max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) -#endif - -#ifndef rounddown -#define rounddown(x, y) ( \ -{ \ - typeof(x) __x = (x); \ - __x - (__x % (y)); \ -} \ -) -#endif /* rounddown */ - -#if LINUX_VERSION_IS_LESS(3,2,0) -#define hex_byte_pack pack_hex_byte - -/* kernels before 3.2 didn't have error checking for the function */ -#define hex2bin LINUX_BACKPORT(hex2bin) -int __must_check hex2bin(u8 *dst, const char *src, size_t count); -#endif /* < 3.2 */ - -#if LINUX_VERSION_IS_LESS(3,18,0) -#undef clamp -#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) -#endif /* < 3.18 */ - -#if LINUX_VERSION_IS_LESS(4,6,0) -#define kstrtobool LINUX_BACKPORT(kstrtobool) -int __must_check kstrtobool(const char *s, bool *res); -#define kstrtobool_from_user LINUX_BACKPORT(kstrtobool_from_user) -int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool *res); -#endif - -#if LINUX_VERSION_IS_LESS(4,5,0) - -#undef abs -/** - * abs - return absolute value of an argument - * @x: the value. If it is unsigned type, it is converted to signed type first. - * char is treated as if it was signed (regardless of whether it really is) - * but the macro's return type is preserved as char. - * - * Return: an absolute value of x. - */ -#define abs(x) __abs_choose_expr(x, long long, \ - __abs_choose_expr(x, long, \ - __abs_choose_expr(x, int, \ - __abs_choose_expr(x, short, \ - __abs_choose_expr(x, char, \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(x), char), \ - (char)({ signed char __x = (x); __x<0?-__x:__x; }), \ - ((void)0))))))) - -#define __abs_choose_expr(x, type, other) __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(x), signed type) || \ - __builtin_types_compatible_p(typeof(x), unsigned type), \ - ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other) - -#endif - -#if LINUX_VERSION_IS_LESS(3,14,0) -static inline u32 reciprocal_scale(u32 val, u32 ep_ro) -{ - return (u32)(((u64) val * ep_ro) >> 32); -} -#endif /* LINUX_VERSION_IS_LESS(3,14,0) */ - -#if LINUX_VERSION_IS_LESS(3,18,0) -#define bin2hex LINUX_BACKPORT(bin2hex) -extern char *bin2hex(char *dst, const void *src, size_t count); -#endif - -#endif /* __BACKPORT_KERNEL_H */ - -/* - * We have to do this outside the include guard, because - * out own header (linux/export.h) has to include kernel.h - * indirectly (through module.h) and then undef's pr_fmt. - * Then, when the real kernel.h gets included again, it's - * not defined and we get problems ... - */ -#ifndef pr_fmt -#define pr_fmt(msg) msg -#endif diff --git a/backport/backport-include/linux/key.h b/backport/backport-include/linux/key.h deleted file mode 100644 index e7abbf47..00000000 --- a/backport/backport-include/linux/key.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __BP_KEY_H -#define __BP_KEY_H -#ifndef CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION -#include_next <linux/key.h> -#else -#include <linux/types.h> -#include <linux/refcount.h> -#include <linux/list.h> -#include <keys/asymmetric-type.h> - -typedef uint32_t key_perm_t; - -struct key { - refcount_t refcount; - const char *description; - s32 serial; - struct list_head list; - - struct asymmetric_key_ids kids; - struct public_key *public_key; - struct public_key_signature *sig; - - bool keyring; -}; - -typedef struct __key_reference_with_attributes *key_ref_t; - -static inline key_ref_t make_key_ref(const struct key *key, - bool possession) -{ - return (key_ref_t) ((unsigned long) key | possession); -} - -static inline struct key *key_ref_to_ptr(const key_ref_t key_ref) -{ - return (struct key *) ((unsigned long) key_ref & ~1UL); -} - -#define key_put LINUX_BACKPORT(key_put) -extern void key_put(struct key *key); - -static inline void key_ref_put(key_ref_t key_ref) -{ - key_put(key_ref_to_ptr(key_ref)); -} - -#define key_create_or_update(keyring, type, desc, payload, plen, perm, flags) \ - bp_key_create_or_update(keyring, desc, payload, plen) - -extern key_ref_t bp_key_create_or_update(key_ref_t keyring, - const char *description, - const void *payload, - size_t plen); - -#define keyring_alloc(desc, uid, gid, cred, perm, flags, restrict, dest) \ - bp_keyring_alloc(); - -extern struct key *bp_keyring_alloc(void); - -static inline s32 key_serial(const struct key *key) -{ - return key ? key->serial : 0; -} - -#endif /* CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION */ -#endif /* __BP_KEY_H */ diff --git a/backport/backport-include/linux/kfifo.h b/backport/backport-include/linux/kfifo.h deleted file mode 100644 index b4fda3c3..00000000 --- a/backport/backport-include/linux/kfifo.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef BACKPORT_LINUX_KFIFO_H -#define BACKPORT_LINUX_KFIFO_H - -#include <linux/version.h> -#include_next <linux/kfifo.h> - -#if LINUX_VERSION_IS_LESS(3,13,0) -#undef kfifo_put -/** - * kfifo_put - put data into the fifo - * @fifo: address of the fifo to be used - * @val: the data to be added - * - * This macro copies the given value into the fifo. - * It returns 0 if the fifo was full. Otherwise it returns the number - * processed elements. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_put(fifo, val) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((&val) + 1) __val = (&val); \ - unsigned int __ret; \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) { \ - typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \ - __dummy = (typeof(__val))NULL; \ - } \ - if (__recsize) \ - __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \ - __recsize); \ - else { \ - __ret = !kfifo_is_full(__tmp); \ - if (__ret) { \ - (__is_kfifo_ptr(__tmp) ? \ - ((typeof(__tmp->type))__kfifo->data) : \ - (__tmp->buf) \ - )[__kfifo->in & __tmp->kfifo.mask] = \ - *(typeof(__tmp->type))__val; \ - smp_wmb(); \ - __kfifo->in++; \ - } \ - } \ - __ret; \ -}) -#endif - -#endif /* BACKPORT_LINUX_KFIFO_H */ diff --git a/backport/backport-include/linux/kmemleak.h b/backport/backport-include/linux/kmemleak.h deleted file mode 100644 index 9af3d670..00000000 --- a/backport/backport-include/linux/kmemleak.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __BACKPORT_KMEMLEAK_H -#define __BACKPORT_KMEMLEAK_H -#include <linux/types.h> -#include_next <linux/kmemleak.h> -#endif /* __BACKPORT_KMEMLEAK_H */ diff --git a/backport/backport-include/linux/kref.h b/backport/backport-include/linux/kref.h deleted file mode 100644 index 631488f5..00000000 --- a/backport/backport-include/linux/kref.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __BACKPORT_LINUX_KREF_H -#define __BACKPORT_LINUX_KREF_H -#include_next <linux/kref.h> - -#if LINUX_VERSION_IS_LESS(4,11,0) -#include <linux/refcount.h> -static inline unsigned int kref_read(const struct kref *kref) -{ - return refcount_read((const refcount_t *)&kref->refcount); -} -#endif /* < 4.11 */ - -#endif /* __BACKPORT_LINUX_KREF_H */ diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h deleted file mode 100644 index 94272968..00000000 --- a/backport/backport-include/linux/ktime.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_LINUX_KTIME_H -#define __BACKPORT_LINUX_KTIME_H -#include_next <linux/ktime.h> -#include <linux/timekeeping.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,17,0) -#define ktime_get_raw LINUX_BACKPORT(ktime_get_raw) -extern ktime_t ktime_get_raw(void); - -#endif /* < 3.17 */ - -#ifndef ktime_to_timespec64 -/* Map the ktime_t to timespec conversion to ns_to_timespec function */ -#define ktime_to_timespec64(kt) ns_to_timespec64((kt).tv64) -#endif - -#endif /* __BACKPORT_LINUX_KTIME_H */ diff --git a/backport/backport-include/linux/leds.h b/backport/backport-include/linux/leds.h deleted file mode 100644 index b98f8a51..00000000 --- a/backport/backport-include/linux/leds.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __BACKPORT_LINUX_LEDS_H -#define __BACKPORT_LINUX_LEDS_H -#include_next <linux/leds.h> -#include <linux/version.h> - -#include <backport/leds-disabled.h> - -#ifndef CPTCFG_BPAUTO_BUILD_LEDS -#if LINUX_VERSION_IS_LESS(3,6,0) -/* - * Backports - * - * commit 959d62fa865d2e616b61a509e1cc5b88741f065e - * Author: Shuah Khan <shuahkhan@gmail.com> - * Date: Thu Jun 14 04:34:30 2012 +0800 - * - * leds: Rename led_brightness_set() to led_set_brightness() - * - * Rename leds external interface led_brightness_set() to led_set_brightness(). - * This is the second phase of the change to reduce confusion between the - * leds internal and external interfaces that set brightness. With this change, - * now the external interface is led_set_brightness(). The first phase renamed - * the internal interface led_set_brightness() to __led_set_brightness(). - * There are no changes to the interface implementations. - * - * Signed-off-by: Shuah Khan <shuahkhan@gmail.com> - * Signed-off-by: Bryan Wu <bryan.wu@canonical.com> - */ -#define led_set_brightness(_dev, _switch) led_brightness_set(_dev, _switch) -#endif /* LINUX_VERSION_IS_LESS(3,6,0) */ -#endif /* CPTCFG_BPAUTO_BUILD_LEDS */ - -#if LINUX_VERSION_IS_LESS(4,2,0) -/* - * There is no LINUX_BACKPORT() guard here because we want it to point to - * the original function which is exported normally. - */ -#ifdef CONFIG_LEDS_TRIGGERS -extern void led_trigger_remove(struct led_classdev *led_cdev); -#else -static inline void led_trigger_remove(struct led_classdev *led_cdev) {} -#endif -#endif - -#if LINUX_VERSION_IS_LESS(4,5,0) && \ - LINUX_VERSION_IS_GEQ(3,19,0) -#define led_set_brightness_sync LINUX_BACKPORT(led_set_brightness_sync) -/** - * led_set_brightness_sync - set LED brightness synchronously - * @led_cdev: the LED to set - * @brightness: the brightness to set it to - * - * Set an LED's brightness immediately. This function will block - * the caller for the time required for accessing device registers, - * and it can sleep. - * - * Returns: 0 on success or negative error value on failure - */ -extern int led_set_brightness_sync(struct led_classdev *led_cdev, - enum led_brightness value); -#endif /* < 4.5 && >= 3.19 */ - -#if LINUX_VERSION_IS_LESS(4,5,0) -#define devm_led_trigger_register LINUX_BACKPORT(devm_led_trigger_register) -extern int devm_led_trigger_register(struct device *dev, - struct led_trigger *trigger); -#endif /* < 4.5 */ - -#endif /* __BACKPORT_LINUX_LEDS_H */ diff --git a/backport/backport-include/linux/list.h b/backport/backport-include/linux/list.h deleted file mode 100644 index 13ab9762..00000000 --- a/backport/backport-include/linux/list.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __BACKPORT_LIST_H -#define __BACKPORT_LIST_H -#include_next <linux/list.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -/** - * backport: - * - * commit 0bbacca7c3911451cea923b0ad6389d58e3d9ce9 - * Author: Sasha Levin <sasha.levin@oracle.com> - * Date: Thu Feb 7 12:32:18 2013 +1100 - * - * hlist: drop the node parameter from iterators - */ -#include <backport/magic.h> - -#undef hlist_entry_safe -#define hlist_entry_safe(ptr, type, member) \ - ({ typeof(ptr) ____ptr = (ptr); \ - ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ - }) - -#define hlist_for_each_entry4(tpos, pos, head, member) \ - for (pos = (head)->first; \ - pos && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;});\ - pos = pos->next) - -#define hlist_for_each_entry_safe5(tpos, pos, n, head, member) \ - for (pos = (head)->first; \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;});\ - pos = n) - -#define hlist_for_each_entry3(pos, head, member) \ - for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \ - pos; \ - pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) - -#define hlist_for_each_entry_safe4(pos, n, head, member) \ - for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \ - pos && ({ n = pos->member.next; 1; }); \ - pos = hlist_entry_safe(n, typeof(*pos), member)) - -#undef hlist_for_each_entry -#define hlist_for_each_entry(...) \ - macro_dispatcher(hlist_for_each_entry, __VA_ARGS__)(__VA_ARGS__) -#undef hlist_for_each_entry_safe -#define hlist_for_each_entry_safe(...) \ - macro_dispatcher(hlist_for_each_entry_safe, __VA_ARGS__)(__VA_ARGS__) - -#endif - -#ifndef list_first_entry_or_null -/** - * list_first_entry_or_null - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note that if the list is empty, it returns NULL. - */ -#define list_first_entry_or_null(ptr, type, member) \ - (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) -#endif /* list_first_entry_or_null */ - -#ifndef list_next_entry -/** - * list_next_entry - get the next element in list - * @pos: the type * to cursor - * @member: the name of the list_struct within the struct. - */ -#define list_next_entry(pos, member) \ - list_entry((pos)->member.next, typeof(*(pos)), member) -#endif /* list_next_entry */ - -#ifndef list_last_entry -/** - * list_last_entry - get the last element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note, that list is expected to be not empty. - */ -#define list_last_entry(ptr, type, member) \ - list_entry((ptr)->prev, type, member) -#endif - -#endif /* __BACKPORT_LIST_H */ diff --git a/backport/backport-include/linux/list_nulls.h b/backport/backport-include/linux/list_nulls.h deleted file mode 100644 index ba28834f..00000000 --- a/backport/backport-include/linux/list_nulls.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BACKPORT_LIST_NULLS -#define __BACKPORT_LIST_NULLS -#include_next <linux/list_nulls.h> - -#ifndef NULLS_MARKER -#define NULLS_MARKER(value) (1UL | (((long)value) << 1)) -#endif - -#endif /* __BACKPORT_LIST_NULLS */ diff --git a/backport/backport-include/linux/lockdep.h b/backport/backport-include/linux/lockdep.h deleted file mode 100644 index 5a5d0d0e..00000000 --- a/backport/backport-include/linux/lockdep.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __BACKPORT_LINUX_LOCKDEP_H -#define __BACKPORT_LINUX_LOCKDEP_H -#include_next <linux/lockdep.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -#undef lockdep_assert_held -#ifdef CONFIG_LOCKDEP -#define lockdep_assert_held(l) do { \ - WARN_ON(debug_locks && !lockdep_is_held(l)); \ - } while (0) -#else -#define lockdep_assert_held(l) do { (void)(l); } while (0) -#endif /* CONFIG_LOCKDEP */ -#endif /* LINUX_VERSION_IS_LESS(3,9,0) */ - -#endif /* __BACKPORT_LINUX_LOCKDEP_H */ diff --git a/backport/backport-include/linux/math64.h b/backport/backport-include/linux/math64.h deleted file mode 100644 index 4aeb0dfb..00000000 --- a/backport/backport-include/linux/math64.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __BACKPORT_LINUX_MATH64_H -#define __BACKPORT_LINUX_MATH64_H -#include_next <linux/math64.h> - -#if LINUX_VERSION_IS_LESS(3,12,0) - -#if BITS_PER_LONG == 64 -/** - * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder - */ -#define div64_u64_rem LINUX_BACKPORT(div64_u64_rem) -static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) -{ - *remainder = dividend % divisor; - return dividend / divisor; -} -#elif BITS_PER_LONG == 32 -#ifndef div64_u64_rem -#define div64_u64_rem LINUX_BACKPORT(div64_u64_rem) -#define backports_div64_u64_rem_add 1 -extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder); -#endif - -#endif /* BITS_PER_LONG */ -#endif /* < 3.12 */ - -#endif /* __BACKPORT_LINUX_MATH64_H */ diff --git a/backport/backport-include/linux/mdio.h b/backport/backport-include/linux/mdio.h deleted file mode 100644 index e12f4467..00000000 --- a/backport/backport-include/linux/mdio.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __BACKPORT_LINUX_MDIO_H -#define __BACKPORT_LINUX_MDIO_H -#include_next <linux/mdio.h> - -#ifndef MDIO_EEE_100TX -/* EEE Supported/Advertisement/LP Advertisement registers. - * - * EEE capability Register (3.20), Advertisement (7.60) and - * Link partner ability (7.61) registers have and can use the same identical - * bit masks. - */ -#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */ -#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */ -/* Note: the two defines above can be potentially used by the user-land - * and cannot remove them now. - * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros - * using the previous ones (that can be considered obsolete). - */ -#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */ -#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */ -#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */ -#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */ -#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */ -#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */ -#endif /* MDIO_EEE_100TX */ - -#if LINUX_VERSION_IS_LESS(3,7,0) -/** - * mmd_eee_adv_to_ethtool_adv_t - * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers - * - * A small helper function that translates the MMD EEE Advertisment (7.60) - * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement - * settings. - */ -#define mmd_eee_adv_to_ethtool_adv_t LINUX_BACKPORT(mmd_eee_adv_to_ethtool_adv_t) -static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv) -{ - u32 adv = 0; - - if (eee_adv & MDIO_EEE_100TX) - adv |= ADVERTISED_100baseT_Full; - if (eee_adv & MDIO_EEE_1000T) - adv |= ADVERTISED_1000baseT_Full; - if (eee_adv & MDIO_EEE_10GT) - adv |= ADVERTISED_10000baseT_Full; - if (eee_adv & MDIO_EEE_1000KX) - adv |= ADVERTISED_1000baseKX_Full; - if (eee_adv & MDIO_EEE_10GKX4) - adv |= ADVERTISED_10000baseKX4_Full; - if (eee_adv & MDIO_EEE_10GKR) - adv |= ADVERTISED_10000baseKR_Full; - - return adv; -} - -#define ethtool_adv_to_mmd_eee_adv_t LINUX_BACKPORT(ethtool_adv_to_mmd_eee_adv_t) -/** - * ethtool_adv_to_mmd_eee_adv_t - * @adv: the ethtool advertisement settings - * - * A small helper function that translates ethtool advertisement settings - * to EEE advertisements for the MMD EEE Advertisement (7.60) and - * MMD EEE Link Partner Ability (7.61) registers. - */ -static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv) -{ - u16 reg = 0; - - if (adv & ADVERTISED_100baseT_Full) - reg |= MDIO_EEE_100TX; - if (adv & ADVERTISED_1000baseT_Full) - reg |= MDIO_EEE_1000T; - if (adv & ADVERTISED_10000baseT_Full) - reg |= MDIO_EEE_10GT; - if (adv & ADVERTISED_1000baseKX_Full) - reg |= MDIO_EEE_1000KX; - if (adv & ADVERTISED_10000baseKX4_Full) - reg |= MDIO_EEE_10GKX4; - if (adv & ADVERTISED_10000baseKR_Full) - reg |= MDIO_EEE_10GKR; - - return reg; -} -#endif /* LINUX_VERSION_IS_LESS(3,7,0) */ - -#endif /* __BACKPORT_LINUX_MDIO_H */ diff --git a/backport/backport-include/linux/mei_cl_bus.h b/backport/backport-include/linux/mei_cl_bus.h deleted file mode 100644 index c0e522f6..00000000 --- a/backport/backport-include/linux/mei_cl_bus.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __BACKPORT_LINUX_MEI_CL_BUS_H -#define __BACKPORT_LINUX_MEI_CL_BUS_H -#include_next <linux/mei_cl_bus.h> - -#if LINUX_VERSION_IS_LESS(4,3,0) -#define mei_cldev_register_event_cb(cldev, event_mask, read_cb, context) \ - mei_cl_register_event_cb(cldev, read_cb, context) -#elif LINUX_VERSION_IS_LESS(4,4,0) -#define mei_cldev_register_event_cb(cldev, event_mask, read_cb, context) \ - mei_cl_register_event_cb(cldev, event_mask, read_cb, context) -#endif - -#if LINUX_VERSION_IS_LESS(4,4,0) -#define __mei_cldev_driver_register(cldrv, owner) __mei_cl_driver_register(cldrv, owner) -#define mei_cldev_driver_register(cldrv) mei_cl_driver_register(cldrv) -#define mei_cldev_driver_unregister(cldrv) mei_cl_driver_unregister(cldrv) -#define mei_cldev_send(cldev, buf, length) mei_cl_send(cldev, buf, length) -#define mei_cldev_recv(cldev, buf, length) mei_cl_recv(cldev, buf, length) -#define mei_cldev_get_drvdata(cldev) mei_cl_get_drvdata(cldev) -#define mei_cldev_set_drvdata(cldev, data) mei_cl_set_drvdata(cldev, data) -#define mei_cldev_enable(cldev) mei_cl_enable_device(cldev) -#define mei_cldev_disable(cldev) mei_cl_disable_device(cldev) -#endif - -#endif /* __BACKPORT_LINUX_MEI_CL_BUS_H */ diff --git a/backport/backport-include/linux/mii.h b/backport/backport-include/linux/mii.h deleted file mode 100644 index e5aad0f6..00000000 --- a/backport/backport-include/linux/mii.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef __BACKPORT_LINUX_MII_H -#define __BACKPORT_LINUX_MII_H -#include_next <linux/mii.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,3,0) -#include <linux/ethtool.h> - -#define ethtool_adv_to_mii_adv_t LINUX_BACKPORT(ethtool_adv_to_mii_adv_t) -static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv) -{ - u32 result = 0; - - if (ethadv & ADVERTISED_10baseT_Half) - result |= ADVERTISE_10HALF; - if (ethadv & ADVERTISED_10baseT_Full) - result |= ADVERTISE_10FULL; - if (ethadv & ADVERTISED_100baseT_Half) - result |= ADVERTISE_100HALF; - if (ethadv & ADVERTISED_100baseT_Full) - result |= ADVERTISE_100FULL; - if (ethadv & ADVERTISED_Pause) - result |= ADVERTISE_PAUSE_CAP; - if (ethadv & ADVERTISED_Asym_Pause) - result |= ADVERTISE_PAUSE_ASYM; - - return result; -} - -#define mii_adv_to_ethtool_adv_t LINUX_BACKPORT(mii_adv_to_ethtool_adv_t) -static inline u32 mii_adv_to_ethtool_adv_t(u32 adv) -{ - u32 result = 0; - - if (adv & ADVERTISE_10HALF) - result |= ADVERTISED_10baseT_Half; - if (adv & ADVERTISE_10FULL) - result |= ADVERTISED_10baseT_Full; - if (adv & ADVERTISE_100HALF) - result |= ADVERTISED_100baseT_Half; - if (adv & ADVERTISE_100FULL) - result |= ADVERTISED_100baseT_Full; - if (adv & ADVERTISE_PAUSE_CAP) - result |= ADVERTISED_Pause; - if (adv & ADVERTISE_PAUSE_ASYM) - result |= ADVERTISED_Asym_Pause; - - return result; -} - -#define ethtool_adv_to_mii_ctrl1000_t LINUX_BACKPORT(ethtool_adv_to_mii_ctrl1000_t) -static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv) -{ - u32 result = 0; - - if (ethadv & ADVERTISED_1000baseT_Half) - result |= ADVERTISE_1000HALF; - if (ethadv & ADVERTISED_1000baseT_Full) - result |= ADVERTISE_1000FULL; - - return result; -} - -#define mii_ctrl1000_to_ethtool_adv_t LINUX_BACKPORT(mii_ctrl1000_to_ethtool_adv_t) -static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv) -{ - u32 result = 0; - - if (adv & ADVERTISE_1000HALF) - result |= ADVERTISED_1000baseT_Half; - if (adv & ADVERTISE_1000FULL) - result |= ADVERTISED_1000baseT_Full; - - return result; -} - -#define mii_lpa_to_ethtool_lpa_t LINUX_BACKPORT(mii_lpa_to_ethtool_lpa_t) -static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa) -{ - u32 result = 0; - - if (lpa & LPA_LPACK) - result |= ADVERTISED_Autoneg; - - return result | mii_adv_to_ethtool_adv_t(lpa); -} - -#define mii_stat1000_to_ethtool_lpa_t LINUX_BACKPORT(mii_stat1000_to_ethtool_lpa_t) -static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa) -{ - u32 result = 0; - - if (lpa & LPA_1000HALF) - result |= ADVERTISED_1000baseT_Half; - if (lpa & LPA_1000FULL) - result |= ADVERTISED_1000baseT_Full; - - return result; -} - -#define ethtool_adv_to_mii_adv_x LINUX_BACKPORT(ethtool_adv_to_mii_adv_x) -static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv) -{ - u32 result = 0; - - if (ethadv & ADVERTISED_1000baseT_Half) - result |= ADVERTISE_1000XHALF; - if (ethadv & ADVERTISED_1000baseT_Full) - result |= ADVERTISE_1000XFULL; - if (ethadv & ADVERTISED_Pause) - result |= ADVERTISE_1000XPAUSE; - if (ethadv & ADVERTISED_Asym_Pause) - result |= ADVERTISE_1000XPSE_ASYM; - - return result; -} - -#define mii_adv_to_ethtool_adv_x LINUX_BACKPORT(mii_adv_to_ethtool_adv_x) -static inline u32 mii_adv_to_ethtool_adv_x(u32 adv) -{ - u32 result = 0; - - if (adv & ADVERTISE_1000XHALF) - result |= ADVERTISED_1000baseT_Half; - if (adv & ADVERTISE_1000XFULL) - result |= ADVERTISED_1000baseT_Full; - if (adv & ADVERTISE_1000XPAUSE) - result |= ADVERTISED_Pause; - if (adv & ADVERTISE_1000XPSE_ASYM) - result |= ADVERTISED_Asym_Pause; - - return result; -} - -#define mii_lpa_to_ethtool_lpa_x LINUX_BACKPORT(mii_lpa_to_ethtool_lpa_x) -static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa) -{ - u32 result = 0; - - if (lpa & LPA_LPACK) - result |= ADVERTISED_Autoneg; - - return result | mii_adv_to_ethtool_adv_x(lpa); -} -#endif - -#if LINUX_VERSION_IN_RANGE(4,6,0, 4,11,0) -extern int mii_ethtool_get_link_ksettings( - struct mii_if_info *mii, struct ethtool_link_ksettings *cmd); -extern int mii_ethtool_set_link_ksettings( - struct mii_if_info *mii, const struct ethtool_link_ksettings *cmd); -#endif /* LINUX_VERSION_IN_RANGE(4,6,0, 4,11,0) */ - -#endif /* __BACKPORT_LINUX_MII_H */ diff --git a/backport/backport-include/linux/miscdevice.h b/backport/backport-include/linux/miscdevice.h deleted file mode 100644 index 9c273346..00000000 --- a/backport/backport-include/linux/miscdevice.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _BACKPORT_LINUX_MISCDEVICE_H -#define _BACKPORT_LINUX_MISCDEVICE_H -#include_next <linux/miscdevice.h> - -#ifndef VHCI_MINOR -#define VHCI_MINOR 137 -#endif - -#endif /* _BACKPORT_LINUX_MISCDEVICE_H */ diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h deleted file mode 100644 index 1b0672b5..00000000 --- a/backport/backport-include/linux/mm.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef __BACKPORT_MM_H -#define __BACKPORT_MM_H -#include_next <linux/mm.h> -#include <linux/page_ref.h> -#include <linux/sched.h> -#include <linux/overflow.h> -#include <linux/vmalloc.h> -#include <linux/slab.h> - -#if LINUX_VERSION_IS_LESS(3,15,0) -#define kvfree LINUX_BACKPORT(kvfree) -void kvfree(const void *addr); -#endif /* < 3.15 */ - -#if LINUX_VERSION_IS_LESS(3,20,0) -#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) -long get_user_pages_locked(unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages, int *locked); -#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) -long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages); -#elif LINUX_VERSION_IS_LESS(4,6,0) && !LINUX_VERSION_IN_RANGE(4,4,168, 4,5,0) -static inline -long backport_get_user_pages_locked(unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages, int *locked) -{ - return get_user_pages_locked(current, current->mm, start, nr_pages, - write, force, pages, locked); -} -#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) - -static inline -long backport_get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages) -{ - return get_user_pages_unlocked(current, current->mm, start, nr_pages, - write, force, pages); -} -#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) -#endif - -#if LINUX_VERSION_IS_LESS(4,6,0) && !LINUX_VERSION_IN_RANGE(4,4,168, 4,5,0) -static inline -long backport_get_user_pages(unsigned long start, unsigned long nr_pages, - int write, int force, struct page **pages, - struct vm_area_struct **vmas) -{ - return get_user_pages(current, current->mm, start, nr_pages, - write, force, pages, vmas); -} -#define get_user_pages LINUX_BACKPORT(get_user_pages) -#endif - -#ifndef FOLL_TRIED -#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ -#endif - -#ifdef CPTCFG_BPAUTO_BUILD_FRAME_VECTOR -/* Container for pinned pfns / pages */ -struct frame_vector { - unsigned int nr_allocated; /* Number of frames we have space for */ - unsigned int nr_frames; /* Number of frames stored in ptrs array */ - bool got_ref; /* Did we pin pages by getting page ref? */ - bool is_pfns; /* Does array contain pages or pfns? */ - void *ptrs[0]; /* Array of pinned pfns / pages. Use - * pfns_vector_pages() or pfns_vector_pfns() - * for access */ -}; - -struct frame_vector *frame_vector_create(unsigned int nr_frames); -void frame_vector_destroy(struct frame_vector *vec); -int get_vaddr_frames(unsigned long start, unsigned int nr_pfns, - bool write, bool force, struct frame_vector *vec); -void put_vaddr_frames(struct frame_vector *vec); -int frame_vector_to_pages(struct frame_vector *vec); -void frame_vector_to_pfns(struct frame_vector *vec); - -static inline unsigned int frame_vector_count(struct frame_vector *vec) -{ - return vec->nr_frames; -} - -static inline struct page **frame_vector_pages(struct frame_vector *vec) -{ - if (vec->is_pfns) { - int err = frame_vector_to_pages(vec); - - if (err) - return ERR_PTR(err); - } - return (struct page **)(vec->ptrs); -} - -static inline unsigned long *frame_vector_pfns(struct frame_vector *vec) -{ - if (!vec->is_pfns) - frame_vector_to_pfns(vec); - return (unsigned long *)(vec->ptrs); -} -#endif - -#if LINUX_VERSION_IS_LESS(4,1,9) && \ - LINUX_VERSION_IS_GEQ(3,6,0) -#define page_is_pfmemalloc LINUX_BACKPORT(page_is_pfmemalloc) -static inline bool page_is_pfmemalloc(struct page *page) -{ - return page->pfmemalloc; -} -#endif /* < 4.2 */ - -#if LINUX_VERSION_IS_LESS(4,12,0) -#define kvmalloc LINUX_BACKPORT(kvmalloc) -static inline void *kvmalloc(size_t size, gfp_t flags) -{ - gfp_t kmalloc_flags = flags; - void *ret; - - if ((flags & GFP_KERNEL) != GFP_KERNEL) - return kmalloc(size, flags); - - if (size > PAGE_SIZE) - kmalloc_flags |= __GFP_NOWARN | __GFP_NORETRY; - - ret = kmalloc(size, flags); - if (ret || size < PAGE_SIZE) - return ret; - - return vmalloc(size); -} - -#define kvmalloc_array LINUX_BACKPORT(kvmalloc_array) -static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags) -{ - size_t bytes; - - if (unlikely(check_mul_overflow(n, size, &bytes))) - return NULL; - - return kvmalloc(bytes, flags); -} - -#define kvzalloc LINUX_BACKPORT(kvzalloc) -static inline void *kvzalloc(size_t size, gfp_t flags) -{ - return kvmalloc(size, flags | __GFP_ZERO); -} -#endif - -#endif /* __BACKPORT_MM_H */ diff --git a/backport/backport-include/linux/mmc/host.h b/backport/backport-include/linux/mmc/host.h deleted file mode 100644 index 2a60cdec..00000000 --- a/backport/backport-include/linux/mmc/host.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _BACKPORTLINUX_MMC_HOST_H -#define _BACKPORTLINUX_MMC_HOST_H -#include_next <linux/mmc/host.h> -#include <linux/version.h> -#include <linux/mmc/card.h> - -#if LINUX_VERSION_IS_LESS(3,16,0) -#define mmc_card_hs LINUX_BACKPORT(mmc_card_hs) -static inline int mmc_card_hs(struct mmc_card *card) -{ - return card->host->ios.timing == MMC_TIMING_SD_HS || - card->host->ios.timing == MMC_TIMING_MMC_HS; -} -#endif /* LINUX_VERSION_IS_LESS(3,16,0) */ - -#endif /* _BACKPORTLINUX_MMC_HOST_H */ diff --git a/backport/backport-include/linux/mmc/sdio.h b/backport/backport-include/linux/mmc/sdio.h deleted file mode 100644 index 31d88330..00000000 --- a/backport/backport-include/linux/mmc/sdio.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __BACKPORT_MMC_SDIO_H -#define __BACKPORT_MMC_SDIO_H -#include <linux/version.h> -#include_next <linux/mmc/sdio.h> - -/* backports b4625dab */ -#ifndef SDIO_CCCR_REV_3_00 -#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */ -#endif -#ifndef SDIO_SDIO_REV_3_00 -#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */ -#endif - -#ifndef SDIO_BUS_ECSI -#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ -#endif -#ifndef SDIO_BUS_SCSI -#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ -#endif - -#endif /* __BACKPORT_MMC_SDIO_H */ diff --git a/backport/backport-include/linux/mmc/sdio_func.h b/backport/backport-include/linux/mmc/sdio_func.h deleted file mode 100644 index 2d3e92b6..00000000 --- a/backport/backport-include/linux/mmc/sdio_func.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_MMC_SDIO_FUNC_H -#define __BACKPORT_MMC_SDIO_FUNC_H -#include <linux/version.h> -#include_next <linux/mmc/sdio_func.h> - -#ifndef dev_to_sdio_func -#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) -#endif - -#endif /* __BACKPORT_MMC_SDIO_FUNC_H */ diff --git a/backport/backport-include/linux/mmc/sdio_ids.h b/backport/backport-include/linux/mmc/sdio_ids.h deleted file mode 100644 index 64fe8ec4..00000000 --- a/backport/backport-include/linux/mmc/sdio_ids.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BACKPORT_MMC_SDIO_IDS_H -#define __BACKPORT_MMC_SDIO_IDS_H -#include <linux/version.h> -#include_next <linux/mmc/sdio_ids.h> - -#ifndef SDIO_CLASS_BT_AMP -#define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */ -#endif - -#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN -#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 -#endif - -#endif /* __BACKPORT_MMC_SDIO_IDS_H */ diff --git a/backport/backport-include/linux/mod_devicetable.h b/backport/backport-include/linux/mod_devicetable.h deleted file mode 100644 index ec0a3e62..00000000 --- a/backport/backport-include/linux/mod_devicetable.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __BACKPORT_MOD_DEVICETABLE_H -#define __BACKPORT_MOD_DEVICETABLE_H -#include_next <linux/mod_devicetable.h> - -#ifndef HID_BUS_ANY -#define HID_BUS_ANY 0xffff -#endif - -#ifndef HID_GROUP_ANY -#define HID_GROUP_ANY 0x0000 -#endif - -#ifndef HID_ANY_ID -#define HID_ANY_ID (~0) -#endif - -#endif /* __BACKPORT_MOD_DEVICETABLE_H */ diff --git a/backport/backport-include/linux/module.h b/backport/backport-include/linux/module.h deleted file mode 100644 index 1a2c82f4..00000000 --- a/backport/backport-include/linux/module.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __BACKPORT_LINUX_MODULE_H -#define __BACKPORT_LINUX_MODULE_H -#include_next <linux/module.h> -#include <linux/rcupdate.h> - -/* - * The define overwriting module_init is based on the original module_init - * which looks like this: - * #define module_init(initfn) \ - * static inline initcall_t __inittest(void) \ - * { return initfn; } \ - * int init_module(void) __attribute__((alias(#initfn))); - * - * To the call to the initfn we added the symbol dependency on compat - * to make sure that compat.ko gets loaded for any compat modules. - */ -extern void backport_dependency_symbol(void); - -#ifdef BACKPORTS_GIT_TRACKED -#define BACKPORT_MOD_VERSIONS MODULE_VERSION(BACKPORTS_GIT_TRACKED); -#else -#define BACKPORT_MOD_VERSIONS \ - MODULE_VERSION("backported from " CPTCFG_KERNEL_NAME \ - " (" CPTCFG_KERNEL_VERSION ")" \ - " using backports " CPTCFG_VERSION); -#endif - -#ifdef MODULE -#undef module_init -#define module_init(initfn) \ - static int __init __init_backport(void) \ - { \ - backport_dependency_symbol(); \ - return initfn(); \ - } \ - int init_module(void) __attribute__((alias("__init_backport")));\ - BACKPORT_MOD_VERSIONS - -/* - * The define overwriting module_exit is based on the original module_exit - * which looks like this: - * #define module_exit(exitfn) \ - * static inline exitcall_t __exittest(void) \ - * { return exitfn; } \ - * void cleanup_module(void) __attribute__((alias(#exitfn))); - * - * We replaced the call to the actual function exitfn() with a call to our - * function which calls the original exitfn() and then rcu_barrier() - * - * As a module will not be unloaded that ofter it should not have a big - * performance impact when rcu_barrier() is called on every module exit, - * also when no kfree_rcu() backport is used in that module. - */ -#undef module_exit -#define module_exit(exitfn) \ - static void __exit __exit_compat(void) \ - { \ - exitfn(); \ - rcu_barrier(); \ - } \ - void cleanup_module(void) __attribute__((alias("__exit_compat"))); -#endif - -#if LINUX_VERSION_IS_LESS(3,3,0) -#undef param_check_bool -#define param_check_bool(name, p) __param_check(name, p, bool) -#endif - -#endif /* __BACKPORT_LINUX_MODULE_H */ diff --git a/backport/backport-include/linux/moduleparam.h b/backport/backport-include/linux/moduleparam.h deleted file mode 100644 index 914baadc..00000000 --- a/backport/backport-include/linux/moduleparam.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __BACKPORT_LINUX_MODULEPARAM_H -#define __BACKPORT_LINUX_MODULEPARAM_H -#include_next <linux/moduleparam.h> - -#if LINUX_VERSION_IS_LESS(4,2,0) -#define kernel_param_lock LINUX_BACKPORT(kernel_param_lock) -static inline void kernel_param_lock(struct module *mod) -{ - __kernel_param_lock(); -} -#define kernel_param_unlock LINUX_BACKPORT(kernel_param_unlock) -static inline void kernel_param_unlock(struct module *mod) -{ - __kernel_param_unlock(); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,8,0) -#undef __MODULE_INFO -#ifdef MODULE -#define __MODULE_INFO(tag, name, info) \ -static const char __UNIQUE_ID(name)[] \ - __used __attribute__((section(".modinfo"), unused, aligned(1))) \ - = __stringify(tag) "=" info -#else /* !MODULE */ -/* This struct is here for syntactic coherency, it is not used */ -#define __MODULE_INFO(tag, name, info) \ - struct __UNIQUE_ID(name) {} -#endif -#endif /* < 3.8 */ - -#if LINUX_VERSION_IS_LESS(3,17,0) -extern struct kernel_param_ops param_ops_ullong; -extern int param_set_ullong(const char *val, const struct kernel_param *kp); -extern int param_get_ullong(char *buffer, const struct kernel_param *kp); -#define param_check_ullong(name, p) __param_check(name, p, unsigned long long) -#endif - -#ifndef module_param_hw_array -#define module_param_hw_array(name, type, hwtype, nump, perm) \ - module_param_array(name, type, nump, perm) -#endif - -#endif /* __BACKPORT_LINUX_MODULEPARAM_H */ diff --git a/backport/backport-include/linux/net.h b/backport/backport-include/linux/net.h deleted file mode 100644 index 738ff8b1..00000000 --- a/backport/backport-include/linux/net.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef __BACKPORT_LINUX_NET_H -#define __BACKPORT_LINUX_NET_H -#include_next <linux/net.h> -#include <linux/static_key.h> - -/* This backports: - * - * commit 2033e9bf06f07e049bbc77e9452856df846714cc -- from v3.5 - * Author: Neil Horman <nhorman@tuxdriver.com> - * Date: Tue May 29 09:30:40 2012 +0000 - * - * net: add MODULE_ALIAS_NET_PF_PROTO_NAME - */ -#ifndef MODULE_ALIAS_NET_PF_PROTO_NAME -#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \ - MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \ - name) -#endif - -#ifndef net_ratelimited_function -#define net_ratelimited_function(function, ...) \ -do { \ - if (net_ratelimit()) \ - function(__VA_ARGS__); \ -} while (0) - -#define net_emerg_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__) -#define net_alert_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__) -#define net_crit_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__) -#define net_err_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__) -#define net_notice_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__) -#define net_warn_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) -#define net_info_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) -#define net_dbg_ratelimited(fmt, ...) \ - net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) -#endif - -#ifndef DECLARE_SOCKADDR -#define DECLARE_SOCKADDR(type, dst, src) \ - type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; }) -#endif - -/* - * Avoid backporting this if a distro did the work already, this - * takes the check a bit further than just using LINUX_BACKPORT() - * namespace, curious if any distro will hit a wall with this. - * Also curious if any distro will be daring enough to even try - * to backport this to a release older than 3.5. - */ -#ifndef ___NET_RANDOM_STATIC_KEY_INIT -/* - * Backporting this before 3.5 is extremely tricky -- I tried, due - * to the fact that it relies on static keys, which were refactored - * and optimized through a series of generation of patches from jump - * labels. These in turn have also been optimized through kernel revisions - * and have architecture specific code, which if you commit to backporting - * may affect tracing. My recommendation is that if you have a need for - * static keys you just require at least 3.5 to remain sane. - */ -#if LINUX_VERSION_IS_GEQ(3,5,0) && !defined(net_get_random_once) -#define __BACKPORT_NET_GET_RANDOM_ONCE 1 -#endif -#endif /* ___NET_RANDOM_STATIC_KEY_INIT */ - -#ifdef __BACKPORT_NET_GET_RANDOM_ONCE -#define __net_get_random_once LINUX_BACKPORT(__net_get_random_once) -bool __net_get_random_once(void *buf, int nbytes, bool *done, - struct static_key *done_key); - -#ifdef HAVE_JUMP_LABEL -#define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \ - { .enabled = ATOMIC_INIT(0), .entries = (void *)1 }) -#else /* !HAVE_JUMP_LABEL */ -#define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE -#endif /* HAVE_JUMP_LABEL */ - -#define net_get_random_once(buf, nbytes) \ - ({ \ - bool ___ret = false; \ - static bool ___done = false; \ - static struct static_key ___done_key = \ - ___NET_RANDOM_STATIC_KEY_INIT; \ - if (!static_key_true(&___done_key)) \ - ___ret = __net_get_random_once(buf, \ - nbytes, \ - &___done, \ - &___done_key); \ - ___ret; \ - }) - -#endif /* __BACKPORT_NET_GET_RANDOM_ONCE */ - -#if LINUX_VERSION_IS_LESS(4,2,0) -#define sock_create_kern(net, family, type, proto, res) \ - __sock_create(net, family, type, proto, res, 1) -#endif - -#ifndef SOCKWQ_ASYNC_NOSPACE -#define SOCKWQ_ASYNC_NOSPACE SOCK_ASYNC_NOSPACE -#endif -#ifndef SOCKWQ_ASYNC_WAITDATA -#define SOCKWQ_ASYNC_WAITDATA SOCK_ASYNC_WAITDATA -#endif - -#endif /* __BACKPORT_LINUX_NET_H */ diff --git a/backport/backport-include/linux/netdev_features.h b/backport/backport-include/linux/netdev_features.h deleted file mode 100644 index 09568ce4..00000000 --- a/backport/backport-include/linux/netdev_features.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __BACKPORT_NETDEV_FEATURES_H -#define __BACKPORT_NETDEV_FEATURES_H - -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,3,0) -#include <linux/netdevice.h> -#include <linux/types.h> - -/* added via 9356b8fc */ -#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX -#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX - -/* added via d314774c */ -#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER - -/* c8f44aff made this u32 but later a861a8b2 changed it to u64 both on v3.3 */ -typedef u32 netdev_features_t; - -#else -#include_next <linux/netdev_features.h> - -#if LINUX_VERSION_IS_LESS(3,10,0) -/* See commit f646968f8f on next-20130423 */ -#define NETIF_F_HW_VLAN_CTAG_TX_BIT NETIF_F_HW_VLAN_TX_BIT -#define NETIF_F_HW_VLAN_CTAG_RX_BIT NETIF_F_HW_VLAN_RX_BIT -#define NETIF_F_HW_VLAN_CTAG_FILTER_BIT NETIF_F_HW_VLAN_FILTER_BIT - -#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER -#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX -#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX -#endif - -#endif /* LINUX_VERSION_IS_LESS(3,3,0) */ - -#if !defined(NETIF_F_RXCSUM) -#define NETIF_F_RXCSUM 0 -#endif - -#if !defined(NETIF_F_RXALL) -#define NETIF_F_RXALL 0 -#endif - -#if !defined(NETIF_F_RXFCS) -#define NETIF_F_RXFCS 0 -#endif - -/* this was renamed in commit 53692b1de : sctp: Rename NETIF_F_SCTP_CSUM to NETIF_F_SCTP_CRC */ -#ifndef NETIF_F_SCTP_CRC -#define NETIF_F_SCTP_CRC __NETIF_F(SCTP_CSUM) -#endif - -#endif /* __BACKPORT_NETDEV_FEATURES_H */ diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h deleted file mode 100644 index 4b1fddff..00000000 --- a/backport/backport-include/linux/netdevice.h +++ /dev/null @@ -1,369 +0,0 @@ -#ifndef __BACKPORT_NETDEVICE_H -#define __BACKPORT_NETDEVICE_H -#include_next <linux/netdevice.h> -#include <linux/netdev_features.h> -#include <linux/version.h> -#include <backport/magic.h> - -/* - * This is declared implicitly in newer kernels by netdevice.h using - * this pointer in struct net_device, but declare it here anyway so - * pointers to it are accepted as function arguments without warning. - */ -struct inet6_dev; - -/* older kernels don't include this here, we need it */ -#include <linux/ethtool.h> -#include <linux/rculist.h> -/* - * new kernels include <net/netprio_cgroup.h> which - * has this ... and some drivers rely on it :-( - */ -#include <linux/hardirq.h> - -#if LINUX_VERSION_IS_LESS(3,14,0) -/* - * Backports note: if in-kernel support is provided we could then just - * take the kernel's implementation of __dev_kfree_skb_irq() as it requires - * raise_softirq_irqoff() which is not exported. For the backport case we - * just use slightly less optimized version and we don't get the ability - * to distinguish the two different reasons to free the skb -- whether it - * was consumed or dropped. - * - * The upstream documentation for this: - * - * It is not allowed to call kfree_skb() or consume_skb() from hardware - * interrupt context or with hardware interrupts being disabled. - * (in_irq() || irqs_disabled()) - * - * We provide four helpers that can be used in following contexts : - * - * dev_kfree_skb_irq(skb) when caller drops a packet from irq context, - * replacing kfree_skb(skb) - * - * dev_consume_skb_irq(skb) when caller consumes a packet from irq context. - * Typically used in place of consume_skb(skb) in TX completion path - * - * dev_kfree_skb_any(skb) when caller doesn't know its current irq context, - * replacing kfree_skb(skb) - * - * dev_consume_skb_any(skb) when caller doesn't know its current irq context, - * and consumed a packet. Used in place of consume_skb(skb) - */ -#define skb_free_reason LINUX_BACKPORT(skb_free_reason) -enum skb_free_reason { - SKB_REASON_CONSUMED, - SKB_REASON_DROPPED, -}; - -#define __dev_kfree_skb_irq LINUX_BACKPORT(__dev_kfree_skb_irq) -static inline void __dev_kfree_skb_irq(struct sk_buff *skb, - enum skb_free_reason reason) -{ - dev_kfree_skb_irq(skb); -} - -#define __dev_kfree_skb_any LINUX_BACKPORT(__dev_kfree_skb_any) -static inline void __dev_kfree_skb_any(struct sk_buff *skb, - enum skb_free_reason reason) -{ - dev_kfree_skb_any(skb); -} - -#define dev_consume_skb_irq LINUX_BACKPORT(dev_consume_skb_irq) -static inline void dev_consume_skb_irq(struct sk_buff *skb) -{ - dev_kfree_skb_irq(skb); -} - -#define dev_consume_skb_any LINUX_BACKPORT(dev_consume_skb_any) -static inline void dev_consume_skb_any(struct sk_buff *skb) -{ - dev_kfree_skb_any(skb); -} - -#if (LINUX_VERSION_CODE != KERNEL_VERSION(3,13,11) || UTS_UBUNTU_RELEASE_ABI < 24) -struct pcpu_sw_netstats { - u64 rx_packets; - u64 rx_bytes; - u64 tx_packets; - u64 tx_bytes; - struct u64_stats_sync syncp; -}; -#endif - -#define netdev_tstats(dev) ((struct pcpu_sw_netstats *)dev->ml_priv) -#define netdev_assign_tstats(dev, e) dev->ml_priv = (e); -#else -#define netdev_tstats(dev) dev->tstats -#define netdev_assign_tstats(dev, e) dev->tstats = (e); -#endif /* LINUX_VERSION_IS_LESS(3,14,0) */ - -#if LINUX_VERSION_IS_LESS(3,7,8) -#define netdev_set_default_ethtool_ops LINUX_BACKPORT(netdev_set_default_ethtool_ops) -extern void netdev_set_default_ethtool_ops(struct net_device *dev, - const struct ethtool_ops *ops); -#endif - -#if LINUX_VERSION_IS_LESS(3,3,0) -/* - * BQL was added as of v3.3 but some Linux distributions - * have backported BQL to their v3.2 kernels or older. To - * address this we assume that they also enabled CONFIG_BQL - * and test for that here and simply avoid adding the static - * inlines if it was defined - */ -#ifndef CONFIG_BQL -#define netdev_tx_sent_queue LINUX_BACKPORT(netdev_tx_sent_queue) -static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, - unsigned int bytes) -{ -} - -#define netdev_sent_queue LINUX_BACKPORT(netdev_sent_queue) -static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) -{ -} - -#define netdev_tx_completed_queue LINUX_BACKPORT(netdev_tx_completed_queue) -static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, - unsigned pkts, unsigned bytes) -{ -} - -#define netdev_completed_queue LINUX_BACKPORT(netdev_completed_queue) -static inline void netdev_completed_queue(struct net_device *dev, - unsigned pkts, unsigned bytes) -{ -} - -#define netdev_tx_reset_queue LINUX_BACKPORT(netdev_tx_reset_queue) -static inline void netdev_tx_reset_queue(struct netdev_queue *q) -{ -} - -#define netdev_reset_queue LINUX_BACKPORT(netdev_reset_queue) -static inline void netdev_reset_queue(struct net_device *dev_queue) -{ -} -#endif /* CONFIG_BQL */ -#endif /* < 3.3 */ - -#ifndef NETDEV_PRE_UP -#define NETDEV_PRE_UP 0x000D -#endif - -#if LINUX_VERSION_IS_LESS(3,11,0) -#define netdev_notifier_info_to_dev(ndev) ndev -#endif - -#if LINUX_VERSION_IS_LESS(3,7,0) -#define netdev_notify_peers(dev) netif_notify_peers(dev) -#define napi_gro_flush(napi, old) napi_gro_flush(napi) -#endif - -#ifndef IFF_LIVE_ADDR_CHANGE -#define IFF_LIVE_ADDR_CHANGE 0x100000 -#endif - -#ifndef IFF_SUPP_NOFCS -#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ -#endif - -#ifndef IFF_UNICAST_FLT -#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ -#endif - -#ifndef QUEUE_STATE_ANY_XOFF -#define __QUEUE_STATE_DRV_XOFF __QUEUE_STATE_XOFF -#define __QUEUE_STATE_STACK_XOFF __QUEUE_STATE_XOFF -#endif - -#if LINUX_VERSION_IS_LESS(3,17,0) -#ifndef NET_NAME_UNKNOWN -#define NET_NAME_UNKNOWN 0 -#endif -#ifndef NET_NAME_ENUM -#define NET_NAME_ENUM 1 -#endif -#ifndef NET_NAME_PREDICTABLE -#define NET_NAME_PREDICTABLE 2 -#endif -#ifndef NET_NAME_USER -#define NET_NAME_USER 3 -#endif -#ifndef NET_NAME_RENAMED -#define NET_NAME_RENAMED 4 -#endif - -#define alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, txqs, rxqs) \ - alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) - -#undef alloc_netdev -#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ - alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1) - -#undef alloc_netdev_mq -#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \ - alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \ - count) -#endif /* LINUX_VERSION_IS_LESS(3,17,0) */ - -/* - * This backports this commit from upstream: - * commit 87757a917b0b3c0787e0563c679762152be81312 - * net: force a list_del() in unregister_netdevice_many() - */ -#if (!(LINUX_VERSION_IS_GEQ(3,10,45) && \ - LINUX_VERSION_IS_LESS(3,11,0)) && \ - !(LINUX_VERSION_IS_GEQ(3,12,23) && \ - LINUX_VERSION_IS_LESS(3,13,0)) && \ - !(LINUX_VERSION_IS_GEQ(3,14,9) && \ - LINUX_VERSION_IS_LESS(3,15,0)) && \ - !(LINUX_VERSION_IS_GEQ(3,15,2) && \ - LINUX_VERSION_IS_LESS(3,16,0)) && \ - LINUX_VERSION_IS_LESS(3,16,0)) -static inline void backport_unregister_netdevice_many(struct list_head *head) -{ - unregister_netdevice_many(head); - - if (!(head->next == LIST_POISON1 && head->prev == LIST_POISON2)) - list_del(head); -} -#define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many) -#endif - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define napi_alloc_frag(fragsz) netdev_alloc_frag(fragsz) -#endif - -#if LINUX_VERSION_IS_LESS(3,19,0) -/* RSS keys are 40 or 52 bytes long */ -#define NETDEV_RSS_KEY_LEN 52 -#define netdev_rss_key_fill LINUX_BACKPORT(netdev_rss_key_fill) -void netdev_rss_key_fill(void *buffer, size_t len); -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define napi_alloc_skb LINUX_BACKPORT(napi_alloc_skb) -static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi, - unsigned int length) -{ - return netdev_alloc_skb_ip_align(napi->dev, length); -} -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#ifndef IFF_TX_SKB_SHARING -#define IFF_TX_SKB_SHARING 0 -#endif - -#if LINUX_VERSION_IS_LESS(4,1,0) -netdev_features_t passthru_features_check(struct sk_buff *skb, - struct net_device *dev, - netdev_features_t features); -#endif /* LINUX_VERSION_IS_LESS(4,1,0) */ - -#if LINUX_VERSION_IS_LESS(4,2,0) -#undef u64_stats_init -static inline void u64_stats_init(struct u64_stats_sync *syncp) -{ -#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) - seqcount_init(&syncp->seq); -#endif -} -#endif /* LINUX_VERSION_IS_LESS(4,2,0) */ - -#ifndef netdev_alloc_pcpu_stats -#define netdev_alloc_pcpu_stats(type) \ -({ \ - typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ - if (pcpu_stats) { \ - int i; \ - for_each_possible_cpu(i) { \ - typeof(type) *stat; \ - stat = per_cpu_ptr(pcpu_stats, i); \ - u64_stats_init(&stat->syncp); \ - } \ - } \ - pcpu_stats; \ -}) -#endif /* netdev_alloc_pcpu_stats */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define napi_complete_done LINUX_BACKPORT(napi_complete_done) -static inline void napi_complete_done(struct napi_struct *n, int work_done) -{ - napi_complete(n); -} -#endif /* < 3.19 */ - -#if LINUX_VERSION_IS_LESS(4,5,0) -#define netif_tx_napi_add LINUX_BACKPORT(netif_tx_napi_add) -/** - * netif_tx_napi_add - initialize a napi context - * @dev: network device - * @napi: napi context - * @poll: polling function - * @weight: default weight - * - * This variant of netif_napi_add() should be used from drivers using NAPI - * to exclusively poll a TX queue. - * This will avoid we add it into napi_hash[], thus polluting this hash table. - */ -static inline void netif_tx_napi_add(struct net_device *dev, - struct napi_struct *napi, - int (*poll)(struct napi_struct *, int), - int weight) -{ - netif_napi_add(dev, napi, poll, weight); -} -#endif /* < 4.5 */ - -#ifndef NETIF_F_CSUM_MASK -#define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM -#endif - -#if LINUX_VERSION_IS_LESS(4,7,0) -#define netif_trans_update LINUX_BACKPORT(netif_trans_update) -static inline void netif_trans_update(struct net_device *dev) -{ - dev->trans_start = jiffies; -} -#endif - -#if LINUX_VERSION_IS_LESS(4,11,9) -#define netdev_set_priv_destructor(_dev, _destructor) \ - (_dev)->destructor = __ ## _destructor -#define netdev_set_def_destructor(_dev) \ - (_dev)->destructor = free_netdev -#else -#define netdev_set_priv_destructor(_dev, _destructor) \ - (_dev)->needs_free_netdev = true; \ - (_dev)->priv_destructor = (_destructor); -#define netdev_set_def_destructor(_dev) \ - (_dev)->needs_free_netdev = true; -#endif - -#if LINUX_VERSION_IN_RANGE(3,10,0, 4,14,0) -static inline int _bp_netdev_upper_dev_link(struct net_device *dev, - struct net_device *upper_dev) -{ - return netdev_upper_dev_link(dev, upper_dev); -} -#define netdev_upper_dev_link3(dev, upper, extack) \ - netdev_upper_dev_link(dev, upper) -#define netdev_upper_dev_link2(dev, upper) \ - netdev_upper_dev_link(dev, upper) -#define netdev_upper_dev_link(...) \ - macro_dispatcher(netdev_upper_dev_link, __VA_ARGS__)(__VA_ARGS__) -#endif - -#if LINUX_VERSION_IS_LESS(5,0,0) -static inline int backport_dev_open(struct net_device *dev, struct netlink_ext_ack *extack) -{ - return dev_open(dev); -} -#define dev_open LINUX_BACKPORT(dev_open) -#endif - -#endif /* __BACKPORT_NETDEVICE_H */ diff --git a/backport/backport-include/linux/netlink.h b/backport/backport-include/linux/netlink.h deleted file mode 100644 index 0fb8e0f3..00000000 --- a/backport/backport-include/linux/netlink.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __BACKPORT_LINUX_NETLINK_H -#define __BACKPORT_LINUX_NETLINK_H -#include_next <linux/netlink.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(4,14,0) -struct nla_bitfield32 { - __u32 value; - __u32 selector; -}; -#endif - -#if LINUX_VERSION_IS_LESS(4,12,0) -#define NETLINK_MAX_COOKIE_LEN 20 - -struct netlink_ext_ack { - const char *_msg; - const struct nlattr *bad_attr; - u8 cookie[NETLINK_MAX_COOKIE_LEN]; - u8 cookie_len; - - /* backport only field */ - void *__bp_doit; -}; - -#define NL_SET_ERR_MSG(extack, msg) do { \ - static const char _msg[] = (msg); \ - \ - (extack)->_msg = _msg; \ -} while (0) -#endif - -#ifndef NL_SET_ERR_MSG_ATTR -#define NL_SET_ERR_MSG_ATTR(extack, attr, msg) do { \ - static const char __msg[] = msg; \ - struct netlink_ext_ack *__extack = (extack); \ - \ - if (__extack) { \ - __extack->_msg = __msg; \ - __extack->bad_attr = (attr); \ - } \ -} while (0) -#endif - -/* this is for patches we apply */ -#if LINUX_VERSION_IS_LESS(3,7,0) -#define netlink_notify_portid(__notify) (__notify->pid) -#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).pid -#else -#define netlink_notify_portid(__notify) (__notify->portid) -#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).portid -#endif - -#ifndef NL_SET_BAD_ATTR -#define NL_SET_BAD_ATTR(extack, attr) do { \ - if ((extack)) \ - (extack)->bad_attr = (attr); \ -} while (0) -#endif /* NL_SET_BAD_ATTR */ - -#if LINUX_VERSION_IS_LESS(5,0,0) -static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack, - u64 cookie) -{ - u64 __cookie = cookie; - - memcpy(extack->cookie, &__cookie, sizeof(__cookie)); - extack->cookie_len = sizeof(__cookie); -} -#endif - -#endif /* __BACKPORT_LINUX_NETLINK_H */ diff --git a/backport/backport-include/linux/nl80211.h b/backport/backport-include/linux/nl80211.h deleted file mode 100644 index d49057a6..00000000 --- a/backport/backport-include/linux/nl80211.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_LINUX_NL80211_H -#define __BACKPORT_LINUX_NL80211_H -#include_next <linux/nl80211.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,3,0) -#define NL80211_FEATURE_SK_TX_STATUS 0 -#endif - -#endif /* __BACKPORT_LINUX_NL80211_H */ diff --git a/backport/backport-include/linux/nospec.h b/backport/backport-include/linux/nospec.h deleted file mode 100644 index 50cf4673..00000000 --- a/backport/backport-include/linux/nospec.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _BACKPORT_LINUX_NOSPEC_H -#define _BACKPORT_LINUX_NOSPEC_H - -#if LINUX_VERSION_IS_GEQ(4,14,18) || \ - LINUX_VERSION_IN_RANGE(4,9,81, 4,10,0) || \ - LINUX_VERSION_IN_RANGE(4,4,118, 4,5,0) -#include_next <linux/nospec.h> -#else -#define array_index_nospec(index, size) (index) -#endif - -#endif /* _BACKPORT_LINUX_NOSPEC_H */ diff --git a/backport/backport-include/linux/of.h b/backport/backport-include/linux/of.h deleted file mode 100644 index bbb5acd2..00000000 --- a/backport/backport-include/linux/of.h +++ /dev/null @@ -1,259 +0,0 @@ -#ifndef _COMPAT_LINUX_OF_H -#define _COMPAT_LINUX_OF_H 1 - -#include <linux/version.h> -#include_next <linux/of.h> - -#if LINUX_VERSION_IS_LESS(3,7,0) -#ifdef CONFIG_OF -extern struct device_node *of_get_child_by_name(const struct device_node *node, - const char *name); -#else -static inline struct device_node *of_get_child_by_name( - const struct device_node *node, - const char *name) -{ - return NULL; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,7,0) */ - -#if LINUX_VERSION_IS_LESS(3,7,0) -#ifndef CONFIG_OF -static inline struct device_node *of_find_node_by_name(struct device_node *from, - const char *name) -{ - return NULL; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,7,0) */ - -#if LINUX_VERSION_IS_LESS(3,8,0) -#define of_property_read_u8_array LINUX_BACKPORT(of_property_read_u8_array) -#ifdef CONFIG_OF -extern int of_property_read_u8_array(const struct device_node *np, - const char *propname, u8 *out_values, size_t sz); -#else -static inline int of_property_read_u8_array(const struct device_node *np, - const char *propname, u8 *out_values, size_t sz) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,8,0) */ - -#if LINUX_VERSION_IS_LESS(3,1,0) -#define of_property_read_u32_array LINUX_BACKPORT(of_property_read_u32_array) -#ifdef CONFIG_OF -extern int of_property_read_u32_array(const struct device_node *np, - const char *propname, - u32 *out_values, - size_t sz); -#else -static inline int of_property_read_u32_array(const struct device_node *np, - const char *propname, - u32 *out_values, size_t sz) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF */ -#define of_property_read_u32 LINUX_BACKPORT(of_property_read_u32) -static inline int of_property_read_u32(const struct device_node *np, - const char *propname, - u32 *out_value) -{ - return of_property_read_u32_array(np, propname, out_value, 1); -} -#ifndef CONFIG_OF -#define of_get_property LINUX_BACKPORT(of_get_property) -static inline const void *of_get_property(const struct device_node *node, - const char *name, - int *lenp) -{ - return NULL; -} - -#endif -#endif /* LINUX_VERSION_IS_LESS(3,1,0) */ - -#if LINUX_VERSION_IS_LESS(3,10,0) -#define of_property_read_u32_index LINUX_BACKPORT(of_property_read_u32_index) -#ifdef CONFIG_OF -extern int of_property_read_u32_index(const struct device_node *np, - const char *propname, - u32 index, u32 *out_value); -#else -static inline int of_property_read_u32_index(const struct device_node *np, - const char *propname, u32 index, u32 *out_value) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,10,0) */ - -#if LINUX_VERSION_IS_LESS(3,15,0) -#define of_property_count_elems_of_size LINUX_BACKPORT(of_property_count_elems_of_size) -#ifdef CONFIG_OF -extern int of_property_count_elems_of_size(const struct device_node *np, - const char *propname, int elem_size); -#else -static inline int of_property_count_elems_of_size(const struct device_node *np, - const char *propname, int elem_size) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,15,0) */ - - -#if LINUX_VERSION_IS_LESS(3,15,0) -/** - * of_property_count_u32_elems - Count the number of u32 elements in a property - * - * @np: device node from which the property value is to be read. - * @propname: name of the property to be searched. - * - * Search for a property in a device node and count the number of u32 elements - * in it. Returns number of elements on sucess, -EINVAL if the property does - * not exist or its length does not match a multiple of u32 and -ENODATA if the - * property does not have a value. - */ -#define of_property_count_u32_elems LINUX_BACKPORT(of_property_count_u32_elems) -static inline int of_property_count_u32_elems(const struct device_node *np, - const char *propname) -{ - return of_property_count_elems_of_size(np, propname, sizeof(u32)); -} -#endif /* LINUX_VERSION_IS_LESS(3,15,0) */ - -#if LINUX_VERSION_IS_LESS(3,3,0) -#ifndef CONFIG_OF -#define of_node_get LINUX_BACKPORT(of_node_get) -/* Dummy ref counting routines - to be implemented later */ -static inline struct device_node *of_node_get(struct device_node *node) -{ - return node; -} -static inline void of_node_put(struct device_node *node) { } -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,3,0) */ - -#ifndef of_match_ptr -#ifdef CONFIG_OF -#define of_match_ptr(_ptr) (_ptr) -#else -#define of_match_ptr(_ptr) NULL -#endif /* CONFIG_OF */ -#endif /* of_match_ptr */ - -#ifndef for_each_compatible_node -#define for_each_compatible_node(dn, type, compatible) \ - for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ - dn = of_find_compatible_node(dn, type, compatible)) -#endif /* for_each_compatible_node */ - -#if LINUX_VERSION_IS_LESS(3,3,0) -#ifndef CONFIG_OF -static inline struct device_node *of_find_compatible_node( - struct device_node *from, - const char *type, - const char *compat) -{ - return NULL; -} -#endif -#endif - -#if LINUX_VERSION_IS_LESS(3,18,0) -#define of_property_read_u64_array LINUX_BACKPORT(of_property_read_u64_array) -#ifdef CONFIG_OF -/* This is static in the kernel, but we need it in multiple places */ -void *of_find_property_value_of_size(const struct device_node *np, - const char *propname, u32 len); -extern int of_property_read_u64_array(const struct device_node *np, - const char *propname, - u64 *out_values, - size_t sz); -#else -static inline int of_property_read_u64_array(const struct device_node *np, - const char *propname, - u64 *out_values, size_t sz) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF */ -#endif /* LINUX_VERSION_IS_LESS(3,15,0) */ - -#if LINUX_VERSION_IS_LESS(3,6,0) -#define of_node_full_name LINUX_BACKPORT(of_node_full_name) -#ifdef CONFIG_OF -static inline const char *of_node_full_name(const struct device_node *np) -{ - return np ? np->full_name : "<no-node>"; -} -#else -static inline const char* of_node_full_name(const struct device_node *np) -{ - return "<no-node>"; -} -#endif /* CONFIG_OF */ -#endif /* < 3.6 */ - -#ifndef for_each_child_of_node -#define for_each_child_of_node(parent, child) \ - while (0) -#endif - -#ifndef CONFIG_OF -#if LINUX_VERSION_IS_LESS(3,10,0) -static inline int of_device_is_available(const struct device_node *device) -{ - return 0; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,6,0) && !LINUX_VERSION_IN_RANGE(3,2,70, 3,3,0) -static inline int of_property_match_string(struct device_node *np, - const char *propname, - const char *string) -{ - return -ENOSYS; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,2,0) -static inline struct property *of_find_property(const struct device_node *np, - const char *name, int *lenp) -{ - return NULL; -} - -static inline int of_device_is_compatible(const struct device_node *device, - const char *name) -{ - return 0; -} - -static inline struct device_node *of_parse_phandle(struct device_node *np, - const char *phandle_name, - int index) -{ - return NULL; -} - -#define of_match_node(_matches, _node) NULL -#endif - -#endif /* CONFIG_OF */ - -#if LINUX_VERSION_IS_LESS(3,4,0) && !LINUX_VERSION_IN_RANGE(3,2,44, 3,3,0) -static inline bool of_property_read_bool(const struct device_node *np, - const char *propname) -{ - struct property *prop = of_find_property(np, propname, NULL); - - return prop ? true : false; -} -#endif - -#endif /* _COMPAT_LINUX_OF_H */ diff --git a/backport/backport-include/linux/of_address.h b/backport/backport-include/linux/of_address.h deleted file mode 100644 index e3a5167a..00000000 --- a/backport/backport-include/linux/of_address.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_OF_ADDRESS_H -#define __BACKPORT_OF_ADDRESS_H -#include_next <linux/of_address.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(4,4,0) && !defined(CONFIG_OF_ADDRESS) -#ifndef OF_BAD_ADDR -#define OF_BAD_ADDR ((u64)-1) -#endif -#define of_translate_address LINUX_BACKPORT(of_translate_addres) -static inline u64 of_translate_address(struct device_node *np, - const __be32 *addr) -{ - return OF_BAD_ADDR; -} -#endif /* LINUX_VERSION_IS_LESS(4,4,0) */ - -#endif /* __BACKPORT_OF_IRQ_H */ diff --git a/backport/backport-include/linux/of_device.h b/backport/backport-include/linux/of_device.h deleted file mode 100644 index 827c7fb1..00000000 --- a/backport/backport-include/linux/of_device.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __BP_OF_DEVICE_H -#define __BP_OF_DEVICE_H -#include_next <linux/of_device.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(4,18,0) -static inline int backport_of_dma_configure(struct device *dev, - struct device_node *np, - bool force_dma) -{ -#if LINUX_VERSION_IS_GEQ(4,15,0) - dev->bus->force_dma = force_dma; - return of_dma_configure(dev, np); -#elif LINUX_VERSION_IS_GEQ(4,12,0) - return of_dma_configure(dev, np); -#elif LINUX_VERSION_IS_GEQ(4,1,0) - of_dma_configure(dev, np); - return 0; -#else - return 0; -#endif -} -#define of_dma_configure LINUX_BACKPORT(of_dma_configure) -#endif /* < 4.18 */ - -#if LINUX_VERSION_IS_LESS(4,12,0) -#if LINUX_VERSION_IS_GEQ(4,4,0) -ssize_t bp_of_device_modalias(struct device *dev, char *str, ssize_t len); -#define of_device_modalias bp_of_device_modalias -#endif /* > 4.4.0 */ -#endif /* < 4.12 */ - -#endif /* __BP_OF_DEVICE_H */ diff --git a/backport/backport-include/linux/of_irq.h b/backport/backport-include/linux/of_irq.h deleted file mode 100644 index 58108e2c..00000000 --- a/backport/backport-include/linux/of_irq.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __BACKPORT_OF_IRQ_H -#define __BACKPORT_OF_IRQ_H -#include_next <linux/of_irq.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,5,0) && !defined(CONFIG_OF) -#define irq_of_parse_and_map LINUX_BACKPORT(irq_of_parse_and_map) -static inline unsigned int irq_of_parse_and_map(struct device_node *dev, - int index) -{ - return 0; -} -#endif /* LINUX_VERSION_IS_LESS(4,5,0) */ - -#endif /* __BACKPORT_OF_IRQ_H */ diff --git a/backport/backport-include/linux/of_net.h b/backport/backport-include/linux/of_net.h deleted file mode 100644 index 7f4b688f..00000000 --- a/backport/backport-include/linux/of_net.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _BP_OF_NET_H -#define _BP_OF_NET_H -#include_next <linux/of_net.h> -#include <linux/version.h> - -#ifndef CONFIG_OF -#if LINUX_VERSION_IS_LESS(3,10,0) -static inline const void *of_get_mac_address(struct device_node *np) -{ - return NULL; -} -#endif -#endif - -#endif /* _BP_OF_NET_H */ diff --git a/backport/backport-include/linux/of_platform.h b/backport/backport-include/linux/of_platform.h deleted file mode 100644 index 625ee9ed..00000000 --- a/backport/backport-include/linux/of_platform.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __BACKPORT_LINUX_OF_PLATFORM_H -#define __BACKPORT_LINUX_OF_PLATFORM_H -#include_next <linux/of_platform.h> -#include <linux/version.h> -#include <linux/of.h> -/* upstream now includes this here and some people rely on it */ -#include <linux/of_device.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) && !defined(CONFIG_OF_DEVICE) -struct of_dev_auxdata; -#define of_platform_populate LINUX_BACKPORT(of_platform_populate) -static inline int of_platform_populate(struct device_node *root, - const struct of_device_id *matches, - const struct of_dev_auxdata *lookup, - struct device *parent) -{ - return -ENODEV; -} -#endif /* LINUX_VERSION_IS_LESS(3,4,0) */ - -#if LINUX_VERSION_IS_LESS(3,11,0) && !defined(CONFIG_OF_DEVICE) -extern const struct of_device_id of_default_bus_match_table[]; -#endif /* LINUX_VERSION_IS_LESS(3,11,0) */ - -#if LINUX_VERSION_IS_LESS(4,3,0) && !defined(CONFIG_OF_DEVICE) -struct of_dev_auxdata; -#define of_platform_default_populate \ - LINUX_BACKPORT(of_platform_default_populate) -static inline int -of_platform_default_populate(struct device_node *root, - const struct of_dev_auxdata *lookup, - struct device *parent) -{ - return -ENODEV; -} -#endif /* LINUX_VERSION_IS_LESS(4,3,0) */ - -#endif /* __BACKPORT_LINUX_OF_PLATFORM_H */ diff --git a/backport/backport-include/linux/olpc-ec.h b/backport/backport-include/linux/olpc-ec.h deleted file mode 100644 index 353107f6..00000000 --- a/backport/backport-include/linux/olpc-ec.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _COMPAT_LINUX_OLPC_EC_H -#define _COMPAT_LINUX_OLPC_EC_H - -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,6,0) -#include_next <linux/olpc-ec.h> -#endif /* LINUX_VERSION_IS_GEQ(3,6,0) */ - -#endif /* _COMPAT_LINUX_OLPC_EC_H */ diff --git a/backport/backport-include/linux/page_ref.h b/backport/backport-include/linux/page_ref.h deleted file mode 100644 index e45734ec..00000000 --- a/backport/backport-include/linux/page_ref.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __BP_PAGE_REF_H -#define __BP_PAGE_REF_H -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,6,0) -#include_next <linux/page_ref.h> -#else -static inline void page_ref_inc(struct page *page) -{ - atomic_inc(&page->_count); -} - -static inline int page_ref_count(struct page *page) -{ - return atomic_read(&page->_count); -} - -static inline int page_ref_sub_and_test(struct page *page, int nr) -{ - return atomic_sub_and_test(nr, &page->_count); -} -#endif - -#endif /* __BP_PAGE_REF_H */ diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h deleted file mode 100644 index 42b3dc53..00000000 --- a/backport/backport-include/linux/pci.h +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef _BACKPORT_LINUX_PCI_H -#define _BACKPORT_LINUX_PCI_H -#include_next <linux/pci.h> -#include <linux/version.h> - -#ifndef module_pci_driver -/** - * module_pci_driver() - Helper macro for registering a PCI driver - * @__pci_driver: pci_driver struct - * - * Helper macro for PCI drivers which do not do anything special in module - * init/exit. This eliminates a lot of boilerplate. Each module may only - * use this macro once, and calling it replaces module_init() and module_exit() - */ -#define module_pci_driver(__pci_driver) \ - module_driver(__pci_driver, pci_register_driver, \ - pci_unregister_driver) -#endif - -#if LINUX_VERSION_IS_LESS(3,4,0) -void pci_stop_and_remove_bus_device(struct pci_dev *dev); -#endif -#if LINUX_VERSION_IS_LESS(3,7,0) -#define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word) -int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); -#define pcie_capability_read_dword LINUX_BACKPORT(pcie_capability_read_dword) -int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); -#define pcie_capability_write_word LINUX_BACKPORT(pcie_capability_write_word) -int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val); -#define pcie_capability_write_dword LINUX_BACKPORT(pcie_capability_write_dword) -int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val); -#define pcie_capability_clear_and_set_word LINUX_BACKPORT(pcie_capability_clear_and_set_word) -int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos, - u16 clear, u16 set); -#define pcie_capability_clear_and_set_dword LINUX_BACKPORT(pcie_capability_clear_and_set_dword) -int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos, - u32 clear, u32 set); - -#define pcie_capability_set_word LINUX_BACKPORT(pcie_capability_set_word) -static inline int pcie_capability_set_word(struct pci_dev *dev, int pos, - u16 set) -{ - return pcie_capability_clear_and_set_word(dev, pos, 0, set); -} - -#define pcie_capability_set_dword LINUX_BACKPORT(pcie_capability_set_dword) -static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos, - u32 set) -{ - return pcie_capability_clear_and_set_dword(dev, pos, 0, set); -} - -#define pcie_capability_clear_word LINUX_BACKPORT(pcie_capability_clear_word) -static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos, - u16 clear) -{ - return pcie_capability_clear_and_set_word(dev, pos, clear, 0); -} - -#define pcie_capability_clear_dword LINUX_BACKPORT(pcie_capability_clear_dword) -static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, - u32 clear) -{ - return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); -} - -int pci_pcie_type(struct pci_dev *dev); -#endif - -#ifndef PCI_DEVICE_SUB -/** - * PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem - * @vend: the 16 bit PCI Vendor ID - * @dev: the 16 bit PCI Device ID - * @subvend: the 16 bit PCI Subvendor ID - * @subdev: the 16 bit PCI Subdevice ID - * - * This macro is used to create a struct pci_device_id that matches a - * specific device with subsystem information. - */ -#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \ - .vendor = (vend), .device = (dev), \ - .subvendor = (subvend), .subdevice = (subdev) -#endif /* PCI_DEVICE_SUB */ - -#if LINUX_VERSION_IS_LESS(3,2,0) -#define pci_dev_flags LINUX_BACKPORT(pci_dev_flags) -#define PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG LINUX_BACKPORT(PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG) -#define PCI_DEV_FLAGS_NO_D3 LINUX_BACKPORT(PCI_DEV_FLAGS_NO_D3) -#define PCI_DEV_FLAGS_ASSIGNED LINUX_BACKPORT(PCI_DEV_FLAGS_ASSIGNED) -enum pci_dev_flags { - /* INTX_DISABLE in PCI_COMMAND register disables MSI - * generation too. - */ - PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, - /* Device configuration is irrevocably lost if disabled into D3 */ - PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, - /* Provide indication device is assigned by a Virtual Machine Manager */ - PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, -}; -#endif /* LINUX_VERSION_IS_LESS(3,2,0) */ - -#if LINUX_VERSION_IS_LESS(3,8,0) -#define pci_sriov_set_totalvfs LINUX_BACKPORT(pci_sriov_set_totalvfs) -int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); -#endif /* LINUX_VERSION_IS_LESS(3,8,0) */ - -#if LINUX_VERSION_IS_LESS(3,10,0) -/* Taken from drivers/pci/pci.h */ -struct pci_sriov { - int pos; /* capability position */ - int nres; /* number of resources */ - u32 cap; /* SR-IOV Capabilities */ - u16 ctrl; /* SR-IOV Control */ - u16 total_VFs; /* total VFs associated with the PF */ - u16 initial_VFs; /* initial VFs associated with the PF */ - u16 num_VFs; /* number of VFs available */ - u16 offset; /* first VF Routing ID offset */ - u16 stride; /* following VF stride */ - u32 pgsz; /* page size for BAR alignment */ - u8 link; /* Function Dependency Link */ - u16 driver_max_VFs; /* max num VFs driver supports */ - struct pci_dev *dev; /* lowest numbered PF */ - struct pci_dev *self; /* this PF */ - struct mutex lock; /* lock for VF bus */ - struct work_struct mtask; /* VF Migration task */ - u8 __iomem *mstate; /* VF Migration State Array */ -}; - -#define pci_vfs_assigned LINUX_BACKPORT(pci_vfs_assigned) -#ifdef CONFIG_PCI_IOV -int pci_vfs_assigned(struct pci_dev *dev); -#else -static inline int pci_vfs_assigned(struct pci_dev *dev) -{ - return 0; -} -#endif - -#endif /* LINUX_VERSION_IS_LESS(3,10,0) */ - -#if LINUX_VERSION_IS_LESS(4,8,0) -#define pci_alloc_irq_vectors LINUX_BACKPORT(pci_alloc_irq_vectors) -#ifdef CONFIG_PCI_MSI -int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, - unsigned int max_vecs, unsigned int flags); -#else -static inline int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, - unsigned int max_vecs, unsigned int flags) -{ return -ENOSYS; } -#endif -#endif - -#if LINUX_VERSION_IS_LESS(4,8,0) -#define pci_free_irq_vectors LINUX_BACKPORT(pci_free_irq_vectors) -static inline void pci_free_irq_vectors(struct pci_dev *dev) -{ -} -#endif - -#if LINUX_VERSION_IS_LESS(3,14,0) -#define pci_enable_msi_range LINUX_BACKPORT(pci_enable_msi_range) -#ifdef CONFIG_PCI_MSI -int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); -#else -static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, - int maxvec) -{ return -ENOSYS; } -#endif -#endif - -#ifdef CONFIG_PCI -#if LINUX_VERSION_IS_LESS(3,14,0) -#define pci_enable_msix_range LINUX_BACKPORT(pci_enable_msix_range) -#ifdef CONFIG_PCI_MSI -int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, - int minvec, int maxvec); -#else -static inline int pci_enable_msix_range(struct pci_dev *dev, - struct msix_entry *entries, int minvec, int maxvec) -{ return -ENOSYS; } -#endif -#endif -#endif - -#if LINUX_VERSION_IS_LESS(3,13,0) -#define pci_device_is_present LINUX_BACKPORT(pci_device_is_present) -bool pci_device_is_present(struct pci_dev *pdev); -#endif - -#ifdef CONFIG_PCI -#if LINUX_VERSION_IS_LESS(3,14,0) -#define pci_enable_msix_exact LINUX_BACKPORT(pci_enable_msix_exact) -#ifdef CONFIG_PCI_MSI -static inline int pci_enable_msix_exact(struct pci_dev *dev, - struct msix_entry *entries, int nvec) -{ - int rc = pci_enable_msix_range(dev, entries, nvec, nvec); - if (rc < 0) - return rc; - return 0; -} -#else -static inline int pci_enable_msix_exact(struct pci_dev *dev, - struct msix_entry *entries, int nvec) -{ return -ENOSYS; } -#endif /* CONFIG_PCI_MSI */ -#endif -#endif /* CONFIG_PCI */ - -#if LINUX_VERSION_IS_LESS(4,9,0) && \ - !LINUX_VERSION_IN_RANGE(3,12,69, 3,13,0) && \ - !LINUX_VERSION_IN_RANGE(4,4,37, 4,5,0) && \ - !LINUX_VERSION_IN_RANGE(4,8,13, 4,9,0) - -static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) -{ - while (1) { - if (!pci_is_pcie(dev)) - break; - if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) - return dev; - if (!dev->bus->self) - break; - dev = dev->bus->self; - } - return NULL; -} - -#endif/* <4.9.0 but not >= 3.12.69, 4.4.37, 4.8.13 */ - -#ifndef PCI_IRQ_LEGACY -#define PCI_IRQ_LEGACY (1 << 0) /* Allow legacy interrupts */ -#define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */ -#define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */ -#define PCI_IRQ_ALL_TYPES \ - (PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX) -#endif - -#endif /* _BACKPORT_LINUX_PCI_H */ diff --git a/backport/backport-include/linux/percpu-defs.h b/backport/backport-include/linux/percpu-defs.h deleted file mode 100644 index 87a92e07..00000000 --- a/backport/backport-include/linux/percpu-defs.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __BACKPORT_PERCPU_DEFS_H -#define __BACKPORT_PERCPU_DEFS_H -#include_next <linux/percpu-defs.h> - -/* override this with the array-safe version */ -#undef __verify_pcpu_ptr -#define __verify_pcpu_ptr(ptr) \ -do { \ - const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ - (void)__vpp_verify; \ -} while (0) - -#endif /* __BACKPORT_PERCPU_DEFS_H */ diff --git a/backport/backport-include/linux/percpu.h b/backport/backport-include/linux/percpu.h deleted file mode 100644 index 10be03cb..00000000 --- a/backport/backport-include/linux/percpu.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 */ diff --git a/backport/backport-include/linux/phy.h b/backport/backport-include/linux/phy.h deleted file mode 100644 index f331428b..00000000 --- a/backport/backport-include/linux/phy.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __BACKPORT_LINUX_PHY_H -#define __BACKPORT_LINUX_PHY_H -#include_next <linux/phy.h> -#include <linux/compiler.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define phy_connect(dev, bus_id, handler, interface) \ - phy_connect(dev, bus_id, handler, 0, interface) -#endif - -#if LINUX_VERSION_IS_LESS(4,5,0) -#define phydev_name LINUX_BACKPORT(phydev_name) -static inline const char *phydev_name(const struct phy_device *phydev) -{ - return dev_name(&phydev->dev); -} - -#define mdiobus_is_registered_device LINUX_BACKPORT(mdiobus_is_registered_device) -static inline bool mdiobus_is_registered_device(struct mii_bus *bus, int addr) -{ - return bus->phy_map[addr]; -} - -#define phy_attached_print LINUX_BACKPORT(phy_attached_print) -void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) - __printf(2, 3); -#define phy_attached_info LINUX_BACKPORT(phy_attached_info) -void phy_attached_info(struct phy_device *phydev); - -static inline int backport_mdiobus_register(struct mii_bus *bus) -{ - bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); - if (!bus->irq) { - pr_err("mii_bus irq allocation failed\n"); - return -ENOMEM; - } - - memset(bus->irq, PHY_POLL, sizeof(int) * PHY_MAX_ADDR); - -/* in kernel 4.3 a #define for mdiobus_register is added to the kernel. */ -#ifndef mdiobus_register - return mdiobus_register(bus); -#else - return __mdiobus_register(bus, THIS_MODULE); -#endif -} -#ifdef mdiobus_register -#undef mdiobus_register -#endif -#define mdiobus_register LINUX_BACKPORT(mdiobus_register) - -static inline void backport_mdiobus_unregister(struct mii_bus *bus) -{ - kfree(bus->irq); - mdiobus_unregister(bus); -} -#define mdiobus_unregister LINUX_BACKPORT(mdiobus_unregister) -#endif /* < 4.5 */ - -#if LINUX_VERSION_IS_LESS(4,5,0) -#define phydev_get_addr LINUX_BACKPORT(phydev_get_addr) -static inline int phydev_get_addr(struct phy_device *phydev) -{ - return phydev->addr; -} -#else -#define phydev_get_addr LINUX_BACKPORT(phydev_get_addr) -static inline int phydev_get_addr(struct phy_device *phydev) -{ - return phydev->mdio.addr; -} -#endif - -#endif /* __BACKPORT_LINUX_PHY_H */ diff --git a/backport/backport-include/linux/platform_data/media/si4713.h b/backport/backport-include/linux/platform_data/media/si4713.h deleted file mode 100644 index 3d49c32f..00000000 --- a/backport/backport-include/linux/platform_data/media/si4713.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_SI4713_H -#define __BACKPORT_SI4713_H -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,5,0) -#include_next <linux/platform_data/media/si4713.h> -#else -#include <media/si4713.h> -#endif /* < 4.5 */ - -#endif /* __BACKPORT_SI4713_H */ diff --git a/backport/backport-include/linux/platform_data/media/soc_camera_platform.h b/backport/backport-include/linux/platform_data/media/soc_camera_platform.h deleted file mode 100644 index 927bf8fa..00000000 --- a/backport/backport-include/linux/platform_data/media/soc_camera_platform.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_SOC_CAMERA_H__ -#define __BACKPORT_SOC_CAMERA_H__ -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,5,0) -#include_next <linux/platform_data/media/soc_camera_platform.h> -#else -#include <media/soc_camera_platform.h> -#endif /* < 4.5 */ - -#endif /* __BACKPORT_SOC_CAMERA_H__ */ diff --git a/backport/backport-include/linux/platform_data/media/timb_radio.h b/backport/backport-include/linux/platform_data/media/timb_radio.h deleted file mode 100644 index f1fb47a2..00000000 --- a/backport/backport-include/linux/platform_data/media/timb_radio.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_TIMB_RADIO_ -#define __BACKPORT_TIMB_RADIO_ -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,5,0) -#include_next <linux/platform_data/media/timb_radio.h> -#else -#include <media/timb_radio.h> -#endif /* < 4.5 */ - -#endif /* __BACKPORT_TIMB_RADIO_ */ diff --git a/backport/backport-include/linux/platform_data/media/timb_video.h b/backport/backport-include/linux/platform_data/media/timb_video.h deleted file mode 100644 index 82ff7887..00000000 --- a/backport/backport-include/linux/platform_data/media/timb_video.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BACKPORT_TIMB_VIDEO_ -#define __BACKPORT_TIMB_VIDEO_ -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,5,0) -#include_next <linux/platform_data/media/timb_video.h> -#else -#include <media/timb_video.h> -#endif /* < 4.5 */ - -#endif /* __BACKPORT_TIMB_VIDEO_ */ diff --git a/backport/backport-include/linux/platform_device.h b/backport/backport-include/linux/platform_device.h deleted file mode 100644 index 5b821ee4..00000000 --- a/backport/backport-include/linux/platform_device.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __BACKPORT_PLATFORM_DEVICE_H -#define __BACKPORT_PLATFORM_DEVICE_H - -#include_next <linux/platform_device.h> -#include <linux/version.h> - -#ifndef module_platform_driver_probe -#define module_platform_driver_probe(__platform_driver, __platform_probe) \ -static int __init __platform_driver##_init(void) \ -{ \ - return platform_driver_probe(&(__platform_driver), \ - __platform_probe); \ -} \ -module_init(__platform_driver##_init); \ -static void __exit __platform_driver##_exit(void) \ -{ \ - platform_driver_unregister(&(__platform_driver)); \ -} \ -module_exit(__platform_driver##_exit); -#endif - -#ifndef PLATFORM_DEVID_NONE -#define PLATFORM_DEVID_NONE (-1) -#endif - -#ifndef PLATFORM_DEVID_AUTO -#define PLATFORM_DEVID_AUTO (-1) -#endif - -#ifndef module_platform_driver -#define module_platform_driver(__platform_driver) \ - module_driver(__platform_driver, platform_driver_register, \ - platform_driver_unregister) -#endif - -#endif /* __BACKPORT_PLATFORM_DEVICE_H */ diff --git a/backport/backport-include/linux/pm.h b/backport/backport-include/linux/pm.h deleted file mode 100644 index 926b0bf1..00000000 --- a/backport/backport-include/linux/pm.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __BACKPORT_PM_H -#define __BACKPORT_PM_H -#include_next <linux/pm.h> - -#ifndef PM_EVENT_AUTO -#define PM_EVENT_AUTO 0x0400 -#endif - -#ifndef PM_EVENT_SLEEP -#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND) -#endif - -#ifndef PMSG_IS_AUTO -#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) -#endif - -#endif /* __BACKPORT_PM_H */ diff --git a/backport/backport-include/linux/pm_qos.h b/backport/backport-include/linux/pm_qos.h deleted file mode 100644 index d5bfc9bc..00000000 --- a/backport/backport-include/linux/pm_qos.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _COMPAT_LINUX_PM_QOS_H -#define _COMPAT_LINUX_PM_QOS_H 1 - -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,2,0) -#include_next <linux/pm_qos.h> -#else -#include <linux/pm_qos_params.h> -#endif /* LINUX_VERSION_IS_GEQ(3,2,0) */ - -#ifndef PM_QOS_DEFAULT_VALUE -#define PM_QOS_DEFAULT_VALUE -1 -#endif - -#endif /* _COMPAT_LINUX_PM_QOS_H */ diff --git a/backport/backport-include/linux/pm_runtime.h b/backport/backport-include/linux/pm_runtime.h deleted file mode 100644 index e16cd30b..00000000 --- a/backport/backport-include/linux/pm_runtime.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __BACKPORT_PM_RUNTIME_H -#define __BACKPORT_PM_RUNTIME_H -#include_next <linux/pm_runtime.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define pm_runtime_active LINUX_BACKPORT(pm_runtime_active) -#ifdef CONFIG_PM -static inline bool pm_runtime_active(struct device *dev) -{ - return dev->power.runtime_status == RPM_ACTIVE - || dev->power.disable_depth; -} -#else -static inline bool pm_runtime_active(struct device *dev) { return true; } -#endif /* CONFIG_PM */ - -#endif /* LINUX_VERSION_IS_LESS(3,9,0) */ - -#if LINUX_VERSION_IS_LESS(3,15,0) -static inline int pm_runtime_force_suspend(struct device *dev) -{ -#ifdef CONFIG_PM - /* cannot backport properly, I think */ - WARN_ON_ONCE(1); - return -EINVAL; -#endif - return 0; -} -static inline int pm_runtime_force_resume(struct device *dev) -{ -#ifdef CONFIG_PM - /* cannot backport properly, I think */ - WARN_ON_ONCE(1); - return -EINVAL; -#endif - return 0; -} -#endif - -#endif /* __BACKPORT_PM_RUNTIME_H */ diff --git a/backport/backport-include/linux/pnp.h b/backport/backport-include/linux/pnp.h deleted file mode 100644 index 0a88455b..00000000 --- a/backport/backport-include/linux/pnp.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __BACKPORT_LINUX_PNP_H -#define __BACKPORT_LINUX_PNP_H -#include_next <linux/pnp.h> - -#ifndef module_pnp_driver -/** - * module_pnp_driver() - Helper macro for registering a PnP driver - * @__pnp_driver: pnp_driver struct - * - * Helper macro for PnP drivers which do not do anything special in module - * init/exit. This eliminates a lot of boilerplate. Each module may only - * use this macro once, and calling it replaces module_init() and module_exit() - */ -#define module_pnp_driver(__pnp_driver) \ - module_driver(__pnp_driver, pnp_register_driver, \ - pnp_unregister_driver) -#endif - -#endif /* __BACKPORT_LINUX_PNP_H */ diff --git a/backport/backport-include/linux/poll.h b/backport/backport-include/linux/poll.h deleted file mode 100644 index aea64048..00000000 --- a/backport/backport-include/linux/poll.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __BACKPORT_LINUX_POLL_H -#define __BACKPORT_LINUX_POLL_H -#include_next <linux/poll.h> -#include <linux/version.h> -#include <linux/eventpoll.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) -#define poll_does_not_wait LINUX_BACKPORT(poll_does_not_wait) -static inline bool poll_does_not_wait(const poll_table *p) -{ - return p == NULL || p->qproc == NULL; -} - -#define poll_requested_events LINUX_BACKPORT(poll_requested_events) -static inline unsigned long poll_requested_events(const poll_table *p) -{ - return p ? p->key : ~0UL; -} -#endif /* < 3.4 */ - -#endif /* __BACKPORT_LINUX_POLL_H */ diff --git a/backport/backport-include/linux/printk.h b/backport/backport-include/linux/printk.h deleted file mode 100644 index 22851d7f..00000000 --- a/backport/backport-include/linux/printk.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef _COMPAT_LINUX_PRINTK_H -#define _COMPAT_LINUX_PRINTK_H 1 - -#include <linux/version.h> -#include_next <linux/printk.h> - -/* see pr_fmt at end of file */ - -#if LINUX_VERSION_IS_LESS(3,9,0) -/* backports 7a555613 */ -#if defined(CONFIG_DYNAMIC_DEBUG) -#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ -do { \ - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ - __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ - if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ - print_hex_dump(KERN_DEBUG, prefix_str, \ - prefix_type, rowsize, groupsize, \ - buf, len, ascii); \ -} while (0) -#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) -#else -#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) -#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ - -#endif /* LINUX_VERSION_IS_LESS(3,9,0) */ - -#ifndef pr_warn -#define pr_warn pr_warning -#endif - -#ifndef printk_once -#define printk_once(x...) ({ \ - static bool __print_once; \ - \ - if (!__print_once) { \ - __print_once = true; \ - printk(x); \ - } \ -}) -#endif - -#ifndef printk_ratelimited -/* - * ratelimited messages with local ratelimit_state, - * no local ratelimit_state used in the !PRINTK case - */ -#ifdef CONFIG_PRINTK -#define printk_ratelimited(fmt, ...) \ -({ \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - \ - if (__ratelimit(&_rs)) \ - printk(fmt, ##__VA_ARGS__); \ -}) -#else -#define printk_ratelimited(fmt, ...) \ - no_printk(fmt, ##__VA_ARGS__) -#endif -#endif /* printk_ratelimited */ - -#ifndef pr_emerg_ratelimited -#define pr_emerg_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_emerg_ratelimited */ - -#ifndef pr_alert_ratelimited -#define pr_alert_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_alert_ratelimited */ - -#ifndef pr_crit_ratelimited -#define pr_crit_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_crit_ratelimited */ - -#ifndef pr_err_ratelimited -#define pr_err_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_err_ratelimited */ - -#ifndef pr_warn_ratelimited -#define pr_warn_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_warn_ratelimited */ - -#ifndef pr_notice_ratelimited -#define pr_notice_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_notice_ratelimited */ - -#ifndef pr_info_ratelimited -#define pr_info_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) -#endif /* pr_info_ratelimited */ - -/* no pr_cont_ratelimited, don't do that... */ - -#ifndef pr_devel_ratelimited -#if defined(DEBUG) -#define pr_devel_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#else -#define pr_devel_ratelimited(fmt, ...) \ - no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#endif -#endif /* pr_devel_ratelimited */ - -#ifndef pr_debug_ratelimited -/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_DEBUG) -/* descriptor check is first to prevent flooding with "callbacks suppressed" */ -#define pr_debug_ratelimited(fmt, ...) \ -do { \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ - if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ - __ratelimit(&_rs)) \ - __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \ -} while (0) -#elif defined(DEBUG) -#define pr_debug_ratelimited(fmt, ...) \ - printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#else -#define pr_debug_ratelimited(fmt, ...) \ - no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#endif -#endif /* pr_debug_ratelimited */ - -/* replace hex_dump_to_buffer() with a version which returns the length */ -#if LINUX_VERSION_IS_LESS(4,0,0) -#define hex_dump_to_buffer LINUX_BACKPORT(hex_dump_to_buffer) -extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, - int groupsize, char *linebuf, size_t linebuflen, - bool ascii); -#endif - -#endif /* _COMPAT_LINUX_PRINTK_H */ - -/* This must be outside -- see also kernel.h */ -#ifndef pr_fmt -#define pr_fmt(fmt) fmt -#endif diff --git a/backport/backport-include/linux/proc_fs.h b/backport/backport-include/linux/proc_fs.h deleted file mode 100644 index be239bf8..00000000 --- a/backport/backport-include/linux/proc_fs.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __BACKPORT_PROC_FS_H -#define __BACKPORT_PROC_FS_H -#include_next <linux/proc_fs.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,10,0) - -#ifdef CONFIG_PROC_FS -/* - * backport of: - * procfs: new helper - PDE_DATA(inode) - */ -#define PDE_DATA LINUX_BACKPORT(PDE_DATA) -static inline void *PDE_DATA(const struct inode *inode) -{ - return PROC_I(inode)->pde->data; -} -extern void proc_set_size(struct proc_dir_entry *, loff_t); -extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); -#else -#define PDE_DATA LINUX_BACKPORT(PDE_DATA) -static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} -static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} -static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} -#endif /* CONFIG_PROC_FS */ - -#endif /* LINUX_VERSION_IS_LESS(3,10,0) */ - -#endif /* __BACKPORT_PROC_FS_H */ diff --git a/backport/backport-include/linux/property.h b/backport/backport-include/linux/property.h deleted file mode 100644 index a0d7bed1..00000000 --- a/backport/backport-include/linux/property.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __BACKPORT_LINUX_PROPERTY_H_ -#define __BACKPORT_LINUX_PROPERTY_H_ -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(3,18,17) -#include_next <linux/property.h> -#endif - -#if LINUX_VERSION_IS_LESS(4,3,0) - -#define device_get_mac_address LINUX_BACKPORT(device_get_mac_address) -void *device_get_mac_address(struct device *dev, char *addr, int alen); - -#endif /* < 4.3 */ - -#endif /* __BACKPORT_LINUX_PROPERTY_H_ */ diff --git a/backport/backport-include/linux/ptp_clock_kernel.h b/backport/backport-include/linux/ptp_clock_kernel.h deleted file mode 100644 index e4483c0e..00000000 --- a/backport/backport-include/linux/ptp_clock_kernel.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __BACKPORT_PTP_CLOCK_KERNEL_H -#define __BACKPORT_PTP_CLOCK_KERNEL_H - -#include <linux/version.h> -#include_next <linux/ptp_clock_kernel.h> - -#if LINUX_VERSION_IS_LESS(3,5,0) -#include <linux/posix-clock.h> - -#define PTP_MAX_TIMESTAMPS 128 -#define PTP_BUF_TIMESTAMPS 30 - -struct timestamp_event_queue { - struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS]; - int head; - int tail; - spinlock_t lock; -}; - -struct ptp_clock { - struct posix_clock clock; - struct device *dev; - struct ptp_clock_info *info; - dev_t devid; - int index; /* index into clocks.map */ - struct pps_device *pps_source; - struct timestamp_event_queue tsevq; /* simple fifo for time stamps */ - struct mutex tsevq_mux; /* one process at a time reading the fifo */ - wait_queue_head_t tsev_wq; - int defunct; /* tells readers to go away when clock is being removed */ -}; - -extern int ptp_clock_index(struct ptp_clock *ptp); -#endif /* LINUX_VERSION_IS_LESS(3,5,0) */ - -#if LINUX_VERSION_IS_LESS(3,7,0) && !defined(CONFIG_SUSE_KERNEL) -#define ptp_clock_register(info,parent) ptp_clock_register(info) -#endif /* LINUX_VERSION_IS_LESS(3,7,0) */ - -#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */ diff --git a/backport/backport-include/linux/random.h b/backport/backport-include/linux/random.h deleted file mode 100644 index fa016cce..00000000 --- a/backport/backport-include/linux/random.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __BACKPORT_RANDOM_H -#define __BACKPORT_RANDOM_H -#include_next <linux/random.h> -#include <linux/version.h> - -#if (LINUX_VERSION_IS_GEQ(3,3,0) && LINUX_VERSION_IS_LESS(3,4,10)) || \ - (LINUX_VERSION_IS_GEQ(3,1,0) && LINUX_VERSION_IS_LESS(3,2,27)) || \ - LINUX_VERSION_IS_LESS(3,0,41) -#define add_device_randomness LINUX_BACKPORT(add_device_randomness) -static inline void add_device_randomness(const void *buf, unsigned int size) -{ -} -#endif - -/* #if LINUX_VERSION_IS_LESS(3,8,0) */ -/* already backported in our kernels */ -#if 0 -/* backports 496f2f9 */ -#define prandom_seed(_seed) srandom32(_seed) -#define prandom_u32() random32() -#define prandom_u32_state(_state) prandom32(_state) -/* backport 6582c665d6b882dad8329e05749fbcf119f1ab88 */ -#define prandom_bytes LINUX_BACKPORT(prandom_bytes) -void prandom_bytes(void *buf, int bytes); -#endif - -#if LINUX_VERSION_IS_LESS(3,14,0) -/** - * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) - * @ep_ro: right open interval endpoint - * - * Returns a pseudo-random number that is in interval [0, ep_ro). Note - * that the result depends on PRNG being well distributed in [0, ~0U] - * u32 space. Here we use maximally equidistributed combined Tausworthe - * generator, that is, prandom_u32(). This is useful when requesting a - * random index of an array containing ep_ro elements, for example. - * - * Returns: pseudo-random number in interval [0, ep_ro) - */ -#define prandom_u32_max LINUX_BACKPORT(prandom_u32_max) -static inline u32 prandom_u32_max(u32 ep_ro) -{ - return (u32)(((u64) prandom_u32() * ep_ro) >> 32); -} -#endif /* LINUX_VERSION_IS_LESS(3,14,0) */ - -#if LINUX_VERSION_IS_LESS(4,11,0) -static inline u32 get_random_u32(void) -{ - return get_random_int(); -} -#endif - -#endif /* __BACKPORT_RANDOM_H */ diff --git a/backport/backport-include/linux/rculist.h b/backport/backport-include/linux/rculist.h deleted file mode 100644 index 9671e7c4..00000000 --- a/backport/backport-include/linux/rculist.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __BACKPORT_RCULIST_H -#define __BACKPORT_RCULIST_H -#include_next <linux/rculist.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -#include <backport/magic.h> -#define hlist_for_each_entry_rcu4(tpos, pos, head, member) \ - for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \ - pos && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });\ - pos = rcu_dereference_raw(hlist_next_rcu(pos))) - -#define hlist_for_each_entry_rcu3(pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ - typeof(*(pos)), member); \ - pos; \ - pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ - &(pos)->member)), typeof(*(pos)), member)) - -#undef hlist_for_each_entry_rcu -#define hlist_for_each_entry_rcu(...) \ - macro_dispatcher(hlist_for_each_entry_rcu, __VA_ARGS__)(__VA_ARGS__) -#endif /* < 3.9 */ - -#ifndef list_for_each_entry_continue_rcu -#define list_for_each_entry_continue_rcu(pos, head, member) \ - for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ - prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) -#endif - -#ifndef list_entry_rcu -#define list_entry_rcu(ptr, type, member) \ - container_of(rcu_dereference(ptr), type, member) -#endif - -#ifndef list_first_or_null_rcu -/** - * list_first_or_null_rcu - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note that if the list is empty, it returns NULL. - * - * This primitive may safely run concurrently with the _rcu list-mutation - * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). - */ -#define list_first_or_null_rcu(ptr, type, member) \ -({ \ - struct list_head *__ptr = (ptr); \ - struct list_head *__next = ACCESS_ONCE(__ptr->next); \ - likely(__ptr != __next) ? list_entry_rcu(__next, type, member) : NULL; \ -}) -#endif /* list_first_or_null_rcu */ - -#endif /* __BACKPORT_RCULIST_H */ diff --git a/backport/backport-include/linux/rcupdate.h b/backport/backport-include/linux/rcupdate.h deleted file mode 100644 index b96ef496..00000000 --- a/backport/backport-include/linux/rcupdate.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __BACKPORT_LINUX_RCUPDATE_H -#define __BACKPORT_LINUX_RCUPDATE_H -#include_next <linux/rcupdate.h> - -/* - * This adds a nested function everywhere kfree_rcu() was called. This - * function frees the memory and is given as a function to call_rcu(). - * The rcu callback could happen every time also after the module was - * unloaded and this will cause problems. To address that problem, we - * put rcu_barrier() into each module_exit() in module.h. - */ -#if !defined(kfree_rcu) -#define kfree_rcu(data, rcuhead) do { \ - void __kfree_rcu_fn(struct rcu_head *rcu_head) \ - { \ - void *___ptr; \ - ___ptr = container_of(rcu_head, typeof(*(data)), rcuhead);\ - kfree(___ptr); \ - } \ - call_rcu(&(data)->rcuhead, __kfree_rcu_fn); \ - } while (0) -#endif - -#ifndef RCU_INIT_POINTER -#define RCU_INIT_POINTER(p, v) \ - p = (typeof(*v) __force __rcu *)(v) -#endif - -#ifndef rcu_dereference_check -#define rcu_dereference_check(p, c) rcu_dereference(p) -#endif - -#ifndef rcu_dereference_protected -#define rcu_dereference_protected(p, c) (p) -#endif -#ifndef rcu_access_pointer -#define rcu_access_pointer(p) ACCESS_ONCE(p) -#endif - -#ifndef rcu_dereference_raw -#define rcu_dereference_raw(p) rcu_dereference(p) -#endif - -#endif /* __BACKPORT_LINUX_RCUPDATE_H */ diff --git a/backport/backport-include/linux/regmap.h b/backport/backport-include/linux/regmap.h deleted file mode 100644 index 4b73c46b..00000000 --- a/backport/backport-include/linux/regmap.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __BACKPORT_LINUX_REGMAP_H -#define __BACKPORT_LINUX_REGMAP_H -#include_next <linux/regmap.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,5,0) && \ - LINUX_VERSION_IS_GEQ(3,2,0) -#define dev_get_regmap LINUX_BACKPORT(dev_get_regmap) -static inline -struct regmap *dev_get_regmap(struct device *dev, const char *name) -{ - return NULL; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,4,0) && \ - LINUX_VERSION_IS_GEQ(3,2,0) -#if defined(CONFIG_REGMAP) -#define devm_regmap_init LINUX_BACKPORT(devm_regmap_init) -struct regmap *devm_regmap_init(struct device *dev, - const struct regmap_bus *bus, - const struct regmap_config *config); -#if defined(CONFIG_REGMAP_I2C) -#define devm_regmap_init_i2c LINUX_BACKPORT(devm_regmap_init_i2c) -struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, - const struct regmap_config *config); -#endif /* defined(CONFIG_REGMAP_I2C) */ - -/* - * We can't backport these unless we try to backport - * the full regmap into core so warn if used. - * No drivers are using this yet anyway. - */ -#define regmap_raw_write_async LINUX_BACKPORT(regmap_raw_write_async) -static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg, - const void *val, size_t val_len) -{ - WARN_ONCE(1, "regmap API is disabled"); - return -EINVAL; -} - -#define regmap_async_complete LINUX_BACKPORT(regmap_async_complete) -static inline void regmap_async_complete(struct regmap *map) -{ - WARN_ONCE(1, "regmap API is disabled"); -} - -#endif /* defined(CONFIG_REGMAP) */ -#endif /* 3.2 <= version < 3.4 */ - -#endif /* __BACKPORT_LINUX_REGMAP_H */ diff --git a/backport/backport-include/linux/regulator/driver.h b/backport/backport-include/linux/regulator/driver.h deleted file mode 100644 index f88d9bef..00000000 --- a/backport/backport-include/linux/regulator/driver.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * driver.h -- SoC Regulator driver support. - * - * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. - * - * Author: Liam Girdwood <lrg@slimlogic.co.uk> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Regulator Driver Interface. - */ - -#ifndef __BACKPORT_LINUX_REGULATOR_DRIVER_H_ -#define __BACKPORT_LINUX_REGULATOR_DRIVER_H_ - -#include <linux/version.h> -#include_next <linux/regulator/driver.h> - -#if LINUX_VERSION_IS_LESS(3,13,0) && \ - LINUX_VERSION_IS_GEQ(3,5,0) -#define devm_regulator_register LINUX_BACKPORT(devm_regulator_register) -struct regulator_dev * -devm_regulator_register(struct device *dev, - const struct regulator_desc *regulator_desc, - const struct regulator_config *config); -#define devm_regulator_unregister LINUX_BACKPORT(devm_regulator_unregister) -void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev); -#endif /* LINUX_VERSION_IS_LESS(3,13,0) && - LINUX_VERSION_IS_GEQ(3,5,0) */ - -#endif /* __BACKPORT_LINUX_REGULATOR_DRIVER_H_ */ diff --git a/backport/backport-include/linux/rfkill.h b/backport/backport-include/linux/rfkill.h deleted file mode 100644 index 99015af7..00000000 --- a/backport/backport-include/linux/rfkill.h +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef __COMPAT_RFKILL_H -#define __COMPAT_RFKILL_H -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,10,0) -#include_next <linux/rfkill.h> -#else -/* API only slightly changed since then */ -#define rfkill_type old_rfkill_type -#define RFKILL_TYPE_ALL OLD_RFKILL_TYPE_ALL -#define RFKILL_TYPE_WLAN OLD_RFKILL_TYPE_WLAN -#define RFKILL_TYPE_BLUETOOTH OLD_RFKILL_TYPE_BLUETOOTH -#define RFKILL_TYPE_UWB OLD_RFKILL_TYPE_UWB -#define RFKILL_TYPE_WIMAX OLD_RFKILL_TYPE_WIMAX -#define RFKILL_TYPE_WWAN OLD_RFKILL_TYPE_WWAN -#define RFKILL_TYPE_GPS OLD_RFKILL_TYPE_GPS -#define RFKILL_TYPE_FM OLD_RFKILL_TYPE_FM -#define RFKILL_TYPE_NFC OLD_RFKILL_TYPE_NFC -#define NUM_RFKILL_TYPES OLD_NUM_RFKILL_TYPES -#include_next <linux/rfkill.h> -#undef rfkill_type -#undef RFKILL_TYPE_ALL -#undef RFKILL_TYPE_WLAN -#undef RFKILL_TYPE_BLUETOOTH -#undef RFKILL_TYPE_UWB -#undef RFKILL_TYPE_WIMAX -#undef RFKILL_TYPE_WWAN -#undef RFKILL_TYPE_GPS -#undef RFKILL_TYPE_FM -#undef RFKILL_TYPE_NFC -#undef NUM_RFKILL_TYPES -#define HAVE_OLD_RFKILL - -/* this changes infrequently, backport manually */ -enum rfkill_type { - RFKILL_TYPE_ALL = 0, - RFKILL_TYPE_WLAN, - RFKILL_TYPE_BLUETOOTH, - RFKILL_TYPE_UWB, - RFKILL_TYPE_WIMAX, - RFKILL_TYPE_WWAN, - RFKILL_TYPE_GPS, - RFKILL_TYPE_FM, - RFKILL_TYPE_NFC, - NUM_RFKILL_TYPES, -}; - -static inline struct rfkill * __must_check -backport_rfkill_alloc(const char *name, - struct device *parent, - const enum rfkill_type type, - const struct rfkill_ops *ops, - void *ops_data) -{ -#ifdef HAVE_OLD_RFKILL - if ((unsigned int)type >= (unsigned int)OLD_NUM_RFKILL_TYPES) - return ERR_PTR(-ENODEV); - return rfkill_alloc(name, parent, (enum old_rfkill_type)type, - ops, ops_data); -#else - return ERR_PTR(-ENODEV); -#endif -} -#define rfkill_alloc backport_rfkill_alloc - -static inline int __must_check backport_rfkill_register(struct rfkill *rfkill) -{ - if (rfkill == ERR_PTR(-ENODEV)) - return 0; -#ifdef HAVE_OLD_RFKILL - return rfkill_register(rfkill); -#else - return -EINVAL; -#endif -} -#define rfkill_register backport_rfkill_register - -static inline void backport_rfkill_pause_polling(struct rfkill *rfkill) -{ -#ifdef HAVE_OLD_RFKILL - rfkill_pause_polling(rfkill); -#endif -} -#define rfkill_pause_polling backport_rfkill_pause_polling - -static inline void backport_rfkill_resume_polling(struct rfkill *rfkill) -{ -#ifdef HAVE_OLD_RFKILL - rfkill_resume_polling(rfkill); -#endif -} -#define rfkill_resume_polling backport_rfkill_resume_polling - -static inline void backport_rfkill_unregister(struct rfkill *rfkill) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill == ERR_PTR(-ENODEV)) - return; - rfkill_unregister(rfkill); -#endif -} -#define rfkill_unregister backport_rfkill_unregister - -static inline void backport_rfkill_destroy(struct rfkill *rfkill) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill == ERR_PTR(-ENODEV)) - return; - rfkill_destroy(rfkill); -#endif -} -#define rfkill_destroy backport_rfkill_destroy - -static inline bool backport_rfkill_set_hw_state(struct rfkill *rfkill, - bool blocked) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill != ERR_PTR(-ENODEV)) - return rfkill_set_hw_state(rfkill, blocked); -#endif - return blocked; -} -#define rfkill_set_hw_state backport_rfkill_set_hw_state - -static inline bool backport_rfkill_set_sw_state(struct rfkill *rfkill, - bool blocked) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill != ERR_PTR(-ENODEV)) - return rfkill_set_sw_state(rfkill, blocked); -#endif - return blocked; -} -#define rfkill_set_sw_state backport_rfkill_set_sw_state - -static inline void backport_rfkill_init_sw_state(struct rfkill *rfkill, - bool blocked) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill != ERR_PTR(-ENODEV)) - rfkill_init_sw_state(rfkill, blocked); -#endif -} -#define rfkill_init_sw_state backport_rfkill_init_sw_state - -static inline void backport_rfkill_set_states(struct rfkill *rfkill, - bool sw, bool hw) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill != ERR_PTR(-ENODEV)) - rfkill_set_states(rfkill, sw, hw); -#endif -} -#define rfkill_set_states backport_rfkill_set_states - -static inline bool backport_rfkill_blocked(struct rfkill *rfkill) -{ -#ifdef HAVE_OLD_RFKILL - if (rfkill != ERR_PTR(-ENODEV)) - return rfkill_blocked(rfkill); -#endif - return false; -} -#define rfkill_blocked backport_rfkill_blocked -#endif - -#endif diff --git a/backport/backport-include/linux/rtnetlink.h b/backport/backport-include/linux/rtnetlink.h deleted file mode 100644 index 59beffa8..00000000 --- a/backport/backport-include/linux/rtnetlink.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __BACKPORT_LINUX_RTNETLINK_H -#define __BACKPORT_LINUX_RTNETLINK_H -#include_next <linux/rtnetlink.h> - -#ifndef rtnl_dereference -#define rtnl_dereference(p) \ - rcu_dereference_protected(p, lockdep_rtnl_is_held()) -#endif - -#ifndef rcu_dereference_rtnl -#define rcu_dereference_rtnl(p) \ - rcu_dereference_check(p, rcu_read_lock_held() || \ - lockdep_rtnl_is_held()) -#endif - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, flags) \ - ndo_dflt_fdb_add(ndm, tb, dev, addr, flags) -#endif - -#if LINUX_VERSION_IS_LESS(3,13,0) && \ - !defined(CONFIG_PROVE_LOCKING) -static inline bool lockdep_rtnl_is_held(void) -{ - return true; -} -#endif - -#endif /* __BACKPORT_LINUX_RTNETLINK_H */ diff --git a/backport/backport-include/linux/scatterlist.h b/backport/backport-include/linux/scatterlist.h deleted file mode 100644 index 06934b6b..00000000 --- a/backport/backport-include/linux/scatterlist.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef __BACKPORT_SCATTERLIST_H -#define __BACKPORT_SCATTERLIST_H -#include_next <linux/scatterlist.h> - -#if LINUX_VERSION_IS_LESS(3,7,0) -int sg_nents(struct scatterlist *sg); -#endif - -#if LINUX_VERSION_IS_LESS(3, 9, 0) - -/* - * sg page iterator - * - * Iterates over sg entries page-by-page. On each successful iteration, - * @piter->page points to the current page, @piter->sg to the sg holding this - * page and @piter->sg_pgoffset to the page's page offset within the sg. The - * iteration will stop either when a maximum number of sg entries was reached - * or a terminating sg (sg_last(sg) == true) was reached. - */ -struct sg_page_iter { - struct page *page; /* current page */ - struct scatterlist *sg; /* sg holding the page */ - unsigned int sg_pgoffset; /* page offset within the sg */ - - /* these are internal states, keep away */ - unsigned int __nents; /* remaining sg entries */ - int __pg_advance; /* nr pages to advance at the - * next step */ -}; - -struct backport_sg_mapping_iter { - /* the following three fields can be accessed directly */ - struct page *page; /* currently mapped page */ - void *addr; /* pointer to the mapped area */ - size_t length; /* length of the mapped area */ - size_t consumed; /* number of consumed bytes */ - struct sg_page_iter piter; /* page iterator */ - - /* these are internal states, keep away */ - unsigned int __offset; /* offset within page */ - unsigned int __remaining; /* remaining bytes on page */ - unsigned int __flags; -}; -#define sg_mapping_iter LINUX_BACKPORT(sg_mapping_iter) - -/** - * sg_page_iter_page - get the current page held by the page iterator - * @piter: page iterator holding the page - */ -static inline struct page *sg_page_iter_page(struct sg_page_iter *piter) -{ - return nth_page(sg_page(piter->sg), piter->sg_pgoffset); -} - -bool __sg_page_iter_next(struct sg_page_iter *piter); -void __sg_page_iter_start(struct sg_page_iter *piter, - struct scatterlist *sglist, unsigned int nents, - unsigned long pgoffset); - -void backport_sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, - unsigned int nents, unsigned int flags); -bool backport_sg_miter_next(struct sg_mapping_iter *miter); -void backport_sg_miter_stop(struct sg_mapping_iter *miter); -#define sg_miter_start LINUX_BACKPORT(sg_miter_start) -#define sg_miter_next LINUX_BACKPORT(sg_miter_next) -#define sg_miter_stop LINUX_BACKPORT(sg_miter_stop) - -/** - * for_each_sg_page - iterate over the pages of the given sg list - * @sglist: sglist to iterate over - * @piter: page iterator to hold current page, sg, sg_pgoffset - * @nents: maximum number of sg entries to iterate over - * @pgoffset: starting page offset - */ -#define for_each_sg_page(sglist, piter, nents, pgoffset) \ - for (__sg_page_iter_start((piter), (sglist), (nents), (pgoffset)); \ - __sg_page_iter_next(piter);) - -#endif /* LINUX_VERSION_IS_LESS(3, 9, 0) */ - -#if LINUX_VERSION_IS_LESS(3, 11, 0) -size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, - size_t buflen, off_t skip, bool to_buffer); - -#define sg_pcopy_to_buffer LINUX_BACKPORT(sg_pcopy_to_buffer) - -static inline -size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents, - void *buf, size_t buflen, off_t skip) -{ - return sg_copy_buffer(sgl, nents, buf, buflen, skip, true); -} - -#define sg_pcopy_from_buffer LINUX_BACKPORT(sg_pcopy_from_buffer) - -static inline -size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, - void *buf, size_t buflen, off_t skip) -{ - return sg_copy_buffer(sgl, nents, buf, buflen, skip, false); -} - -#endif /* LINUX_VERSION_IS_LESS(3, 11, 0) */ - -#if LINUX_VERSION_IS_LESS(4, 17, 0) - -#define sg_init_marker LINUX_BACKPORT(sg_init_marker) -/** - * sg_init_marker - Initialize markers in sg table - * @sgl: The SG table - * @nents: Number of entries in table - * - **/ -static inline void sg_init_marker(struct scatterlist *sgl, - unsigned int nents) -{ -#ifdef CONFIG_DEBUG_SG - unsigned int i; - - for (i = 0; i < nents; i++) - sgl[i].sg_magic = SG_MAGIC; -#endif - sg_mark_end(&sgl[nents - 1]); -} - -#endif /* LINUX_VERSION_IS_LESS(4, 17, 0) */ - -#endif /* __BACKPORT_SCATTERLIST_H */ diff --git a/backport/backport-include/linux/sched/signal.h b/backport/backport-include/linux/sched/signal.h deleted file mode 100644 index ec89925d..00000000 --- a/backport/backport-include/linux/sched/signal.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _BACKPORT_LINUX_SCHED_SIGNAL_H -#define _BACKPORT_LINUX_SCHED_SIGNAL_H - -#if LINUX_VERSION_IS_LESS(4, 11, 0) -#include <linux/sched.h> -#else -#include_next <linux/sched/signal.h> -#endif - -#endif /* _BACKPORT_LINUX_SCHED_SIGNAL_H */ diff --git a/backport/backport-include/linux/security.h b/backport/backport-include/linux/security.h deleted file mode 100644 index 2dfb964b..00000000 --- a/backport/backport-include/linux/security.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_LINUX_SECURITY_H -#define __BACKPORT_LINUX_SECURITY_H -#include_next <linux/security.h> - -#if LINUX_VERSION_IS_LESS(3,1,0) -/* - * This has been defined in include/linux/security.h for some time, but was - * only given an EXPORT_SYMBOL for 3.1. Add a compat_* definition to avoid - * breaking the compile. - */ -#define security_sk_clone(a, b) compat_security_sk_clone(a, b) - -static inline void security_sk_clone(const struct sock *sk, struct sock *newsk) -{ -} -#endif - -#endif /* __BACKPORT_LINUX_SECURITY_H */ diff --git a/backport/backport-include/linux/seq_file.h b/backport/backport-include/linux/seq_file.h deleted file mode 100644 index 5b88f6f8..00000000 --- a/backport/backport-include/linux/seq_file.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __BACKPORT_SEQ_FILE_H -#define __BACKPORT_SEQ_FILE_H -#include_next <linux/seq_file.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,7,0) -#include <linux/user_namespace.h> -#include <linux/file.h> -#include <linux/fs.h> -#ifdef CONFIG_USER_NS -static inline struct user_namespace *seq_user_ns(struct seq_file *seq) -{ - struct file *f = container_of((void *) seq, struct file, private_data); - - return f->f_cred->user_ns; -} -#else -static inline struct user_namespace *seq_user_ns(struct seq_file *seq) -{ - extern struct user_namespace init_user_ns; - return &init_user_ns; -} -#endif /* CONFIG_USER_NS */ -#endif /* < 3.7 */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define seq_has_overflowed LINUX_BACKPORT(seq_has_overflowed) -/** - * seq_has_overflowed - check if the buffer has overflowed - * @m: the seq_file handle - * - * seq_files have a buffer which may overflow. When this happens a larger - * buffer is reallocated and all the data will be printed again. - * The overflow state is true when m->count == m->size. - * - * Returns true if the buffer received more than it can hold. - */ -static inline bool seq_has_overflowed(struct seq_file *m) -{ - return m->count == m->size; -} -#endif - -#if LINUX_VERSION_IS_LESS(4,3,0) -#define seq_hex_dump LINUX_BACKPORT(seq_hex_dump) -void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type, - int rowsize, int groupsize, const void *buf, size_t len, - bool ascii); -#endif - -#ifndef DEFINE_SHOW_ATTRIBUTE -#define DEFINE_SHOW_ATTRIBUTE(__name) \ -static int __name ## _open(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, __name ## _show, inode->i_private); \ -} \ - \ -static const struct file_operations __name ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __name ## _open, \ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release, \ -} -#endif /* DEFINE_SHOW_ATTRIBUTE */ - -#endif /* __BACKPORT_SEQ_FILE_H */ diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h deleted file mode 100644 index 7b1fe6ed..00000000 --- a/backport/backport-include/linux/skbuff.h +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef __BACKPORT_SKBUFF_H -#define __BACKPORT_SKBUFF_H -#include_next <linux/skbuff.h> -#include <linux/version.h> -#include <generated/utsrelease.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) && \ - (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,4)) && \ - !(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_IS_GEQ(3,0,0)) -#define skb_add_rx_frag(skb, i, page, off, size, truesize) \ - skb_add_rx_frag(skb, i, page, off, size) -#endif - -#if LINUX_VERSION_IS_LESS(3,3,0) -#define __pskb_copy LINUX_BACKPORT(__pskb_copy) -extern struct sk_buff *__pskb_copy(struct sk_buff *skb, - int headroom, gfp_t gfp_mask); - -#define skb_complete_wifi_ack LINUX_BACKPORT(skb_complete_wifi_ack) -static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked) -{ - WARN_ON(1); -} - -/* define to 0 so checks for it are always false */ -#define SKBTX_WIFI_STATUS 0 -#elif LINUX_VERSION_IS_LESS(3,18,0) -#define skb_complete_wifi_ack LINUX_BACKPORT(skb_complete_wifi_ack) -void skb_complete_wifi_ack(struct sk_buff *skb, bool acked); -#endif - -#if LINUX_VERSION_IS_LESS(3,2,0) -#include <linux/dma-mapping.h> - -/* mask skb_frag_page as RHEL6 backports this */ -#define skb_frag_page LINUX_BACKPORT(skb_frag_page) -static inline struct page *skb_frag_page(const skb_frag_t *frag) -{ - return frag->page; -} - -#define skb_frag_size LINUX_BACKPORT(skb_frag_size) -static inline unsigned int skb_frag_size(const skb_frag_t *frag) -{ - return frag->size; -} - -/* mask skb_frag_dma_map as RHEL6 backports this */ -#define skb_frag_dma_map LINUX_BACKPORT(skb_frag_dma_map) -static inline dma_addr_t skb_frag_dma_map(struct device *dev, - const skb_frag_t *frag, - size_t offset, size_t size, - enum dma_data_direction dir) -{ - return dma_map_page(dev, skb_frag_page(frag), - frag->page_offset + offset, size, dir); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,1,0) -/* mask __netdev_alloc_skb_ip_align as RHEL6 backports this */ -#define __netdev_alloc_skb_ip_align(a,b,c) compat__netdev_alloc_skb_ip_align(a,b,c) -static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length, gfp_t gfp) -{ - struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); - - if (NET_IP_ALIGN && skb) - skb_reserve(skb, NET_IP_ALIGN); - return skb; -} -#endif - -#ifndef skb_walk_frags -#define skb_walk_frags(skb, iter) \ - for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) -#endif - -#if LINUX_VERSION_IS_LESS(3,2,0) -#define skb_frag_size_sub LINUX_BACKPORT(skb_frag_size_sub) -static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) -{ - frag->size -= delta; -} - -/** - * skb_frag_address - gets the address of the data contained in a paged fragment - * @frag: the paged fragment buffer - * - * Returns the address of the data within @frag. The page must already - * be mapped. - */ -#define skb_frag_address LINUX_BACKPORT(skb_frag_address) -static inline void *skb_frag_address(const skb_frag_t *frag) -{ - return page_address(skb_frag_page(frag)) + frag->page_offset; -} -#endif /* LINUX_VERSION_IS_LESS(3,2,0) */ - -#if LINUX_VERSION_IS_LESS(3,9,0) -#ifndef NETDEV_FRAG_PAGE_MAX_ORDER -#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768) -#endif -#ifndef NETDEV_FRAG_PAGE_MAX_SIZE -#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER) -#endif -#endif /* LINUX_VERSION_IS_LESS(3,9,0) */ - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define skb_unclone LINUX_BACKPORT(skb_unclone) -static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) -{ - might_sleep_if(pri & __GFP_WAIT); - if (skb_cloned(skb)) - return pskb_expand_head(skb, 0, 0, pri); - return 0; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,2,0) - -#define skb_frag_address_safe LINUX_BACKPORT(skb_frag_address_safe) -/** - * skb_frag_address_safe - gets the address of the data contained in a paged fragment - * @frag: the paged fragment buffer - * - * Returns the address of the data within @frag. Checks that the page - * is mapped and returns %NULL otherwise. - */ -static inline void *skb_frag_address_safe(const skb_frag_t *frag) -{ - void *ptr = page_address(skb_frag_page(frag)); - if (unlikely(!ptr)) - return NULL; - - return ptr + frag->page_offset; -} -#endif /* LINUX_VERSION_IS_LESS(3,2,0) */ - -#if LINUX_VERSION_IS_LESS(3,14,0) && \ - RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0) && \ - !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) -/* - * Packet hash types specify the type of hash in skb_set_hash. - * - * Hash types refer to the protocol layer addresses which are used to - * construct a packet's hash. The hashes are used to differentiate or identify - * flows of the protocol layer for the hash type. Hash types are either - * layer-2 (L2), layer-3 (L3), or layer-4 (L4). - * - * Properties of hashes: - * - * 1) Two packets in different flows have different hash values - * 2) Two packets in the same flow should have the same hash value - * - * A hash at a higher layer is considered to be more specific. A driver should - * set the most specific hash possible. - * - * A driver cannot indicate a more specific hash than the layer at which a hash - * was computed. For instance an L3 hash cannot be set as an L4 hash. - * - * A driver may indicate a hash level which is less specific than the - * actual layer the hash was computed on. For instance, a hash computed - * at L4 may be considered an L3 hash. This should only be done if the - * driver can't unambiguously determine that the HW computed the hash at - * the higher layer. Note that the "should" in the second property above - * permits this. - */ -enum pkt_hash_types { - PKT_HASH_TYPE_NONE, /* Undefined type */ - PKT_HASH_TYPE_L2, /* Input: src_MAC, dest_MAC */ - PKT_HASH_TYPE_L3, /* Input: src_IP, dst_IP */ - PKT_HASH_TYPE_L4, /* Input: src_IP, dst_IP, src_port, dst_port */ -}; - -static inline void -skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) -{ -#if LINUX_VERSION_IS_GEQ(3,2,0) /* 4031ae6edb */ - skb->l4_rxhash = (type == PKT_HASH_TYPE_L4); -#endif -#if LINUX_VERSION_IS_GEQ(3,4,0) /* bdeab99191 */ - skb->rxhash = hash; -#endif -} -#endif /* LINUX_VERSION_IS_LESS(3,14,0) */ - -#if LINUX_VERSION_IS_LESS(3,16,0) -#define __pskb_copy_fclone LINUX_BACKPORT(__pskb_copy_fclone) -static inline struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, - int headroom, gfp_t gfp_mask, - bool fclone) -{ - return __pskb_copy(skb, headroom, gfp_mask); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,18,0) -#define skb_clone_sk LINUX_BACKPORT(skb_clone_sk) -struct sk_buff *skb_clone_sk(struct sk_buff *skb); -#endif - -static inline bool skb_xmit_more(struct sk_buff *skb) -{ -#if LINUX_VERSION_IS_LESS(3,18,0) - return false; -#else - return skb->xmit_more; -#endif -} - -#if LINUX_VERSION_IS_LESS(3,19,0) -/** - * __dev_alloc_pages - allocate page for network Rx - * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx - * @order: size of the allocation - * - * Allocate a new page. - * - * %NULL is returned if there is no free memory. -*/ -#define __dev_alloc_pages LINUX_BACKPORT(__dev_alloc_pages) -static inline struct page *__dev_alloc_pages(gfp_t gfp_mask, - unsigned int order) -{ - /* This piece of code contains several assumptions. - * 1. This is for device Rx, therefor a cold page is preferred. - * 2. The expectation is the user wants a compound page. - * 3. If requesting a order 0 page it will not be compound - * due to the check to see if order has a value in prep_new_page - * 4. __GFP_MEMALLOC is ignored if __GFP_NOMEMALLOC is set due to - * code in gfp_to_alloc_flags that should be enforcing this. - */ - gfp_mask |= __GFP_COLD | __GFP_COMP; -#if LINUX_VERSION_IS_GEQ(3,6,0) - gfp_mask |= __GFP_MEMALLOC; -#endif - - return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); -} - -#define dev_alloc_pages LINUX_BACKPORT(dev_alloc_pages) -static inline struct page *dev_alloc_pages(unsigned int order) -{ - return __dev_alloc_pages(GFP_ATOMIC, order); -} - -/** - * __dev_alloc_page - allocate a page for network Rx - * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx - * - * Allocate a new page. - * - * %NULL is returned if there is no free memory. - */ -#define __dev_alloc_page LINUX_BACKPORT(__dev_alloc_page) -static inline struct page *__dev_alloc_page(gfp_t gfp_mask) -{ - return __dev_alloc_pages(gfp_mask, 0); -} - -#define dev_alloc_page LINUX_BACKPORT(dev_alloc_page) -static inline struct page *dev_alloc_page(void) -{ - return __dev_alloc_page(GFP_ATOMIC); -} -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -#define skb_copy_datagram_msg LINUX_BACKPORT(skb_copy_datagram_msg) -static inline int skb_copy_datagram_msg(const struct sk_buff *from, int offset, - struct msghdr *msg, int size) -{ - return skb_copy_datagram_iovec(from, offset, msg->msg_iov, size); -} - -#define memcpy_from_msg LINUX_BACKPORT(memcpy_from_msg) -static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len) -{ - return memcpy_fromiovec(data, msg->msg_iov, len); -} - -/** - * skb_put_padto - increase size and pad an skbuff up to a minimal size - * @skb: buffer to pad - * @len: minimal length - * - * Pads up a buffer to ensure the trailing bytes exist and are - * blanked. If the buffer already contains sufficient data it - * is untouched. Otherwise it is extended. Returns zero on - * success. The skb is freed on error. - */ -#define skb_put_padto LINUX_BACKPORT(skb_put_padto) -static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) -{ - unsigned int size = skb->len; - - if (unlikely(size < len)) { - len -= size; - if (skb_pad(skb, len)) - return -ENOMEM; - __skb_put(skb, len); - } - return 0; -} - -#define skb_ensure_writable LINUX_BACKPORT(skb_ensure_writable) -int skb_ensure_writable(struct sk_buff *skb, int write_len); - -#endif /* LINUX_VERSION_IS_LESS(3,19,0) */ - -#if LINUX_VERSION_IS_LESS(4,2,0) -static inline void skb_free_frag(void *data) -{ - put_page(virt_to_head_page(data)); -} - -#if LINUX_VERSION_IS_LESS(3,3,0) - -static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key) -{ - return 0; -} - -#else -#include <net/flow_keys.h> -#include <linux/jhash.h> - -static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key) -{ - struct flow_keys keys; - - skb_flow_dissect(skb, &keys); - return jhash_3words((__force u32)keys.dst, - (__force u32)keys.src ^ keys.ip_proto, - (__force u32)keys.ports, key); -} -#endif /* LINUX_VERSION_IS_LESS(3,3,0) */ -#endif /* LINUX_VERSION_IS_LESS(4,2,0) */ - -#if LINUX_VERSION_IS_LESS(4,13,0) -static inline void *backport_skb_put(struct sk_buff *skb, unsigned int len) -{ - return skb_put(skb, len); -} -#define skb_put LINUX_BACKPORT(skb_put) - -static inline void *backport_skb_push(struct sk_buff *skb, unsigned int len) -{ - return skb_push(skb, len); -} -#define skb_push LINUX_BACKPORT(skb_push) - -static inline void *backport___skb_push(struct sk_buff *skb, unsigned int len) -{ - return __skb_push(skb, len); -} -#define __skb_push LINUX_BACKPORT(__skb_push) - -static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len) -{ - void *tmp = skb_put(skb, len); - - memset(tmp, 0, len); - - return tmp; -} - -static inline void *skb_put_data(struct sk_buff *skb, const void *data, - unsigned int len) -{ - void *tmp = skb_put(skb, len); - - memcpy(tmp, data, len); - - return tmp; -} - -static inline void skb_put_u8(struct sk_buff *skb, u8 val) -{ - *(u8 *)skb_put(skb, 1) = val; -} - -static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len) -{ - void *tmp = __skb_put(skb, len); - - memset(tmp, 0, len); - return tmp; -} - -static inline void *__skb_put_data(struct sk_buff *skb, const void *data, - unsigned int len) -{ - void *tmp = __skb_put(skb, len); - - memcpy(tmp, data, len); - return tmp; -} - -#endif - -#if LINUX_VERSION_IS_LESS(4,20,0) -static inline struct sk_buff *__skb_peek(const struct sk_buff_head *list_) -{ - return list_->next; -} -#endif - -#endif /* __BACKPORT_SKBUFF_H */ diff --git a/backport/backport-include/linux/slab.h b/backport/backport-include/linux/slab.h deleted file mode 100644 index 66f0cc0d..00000000 --- a/backport/backport-include/linux/slab.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __BACKPORT_SLAB_H -#define __BACKPORT_SLAB_H -#include_next <linux/slab.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,4,0) -/* This backports: - * - * commit a8203725dfded5c1f79dca3368a4a273e24b59bb - * Author: Xi Wang <xi.wang@gmail.com> - * Date: Mon Mar 5 15:14:41 2012 -0800 - * - * slab: introduce kmalloc_array() - */ - -#include <linux/kernel.h> /* for SIZE_MAX */ - -#define kmalloc_array LINUX_BACKPORT(kmalloc_array) -static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) - return NULL; - return __kmalloc(n * size, flags); -} -#endif - -#endif /* __BACKPORT_SLAB_H */ diff --git a/backport/backport-include/linux/socket.h b/backport/backport-include/linux/socket.h deleted file mode 100644 index 8b6453ec..00000000 --- a/backport/backport-include/linux/socket.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BACKPORT_SOCKET_H -#define __BACKPORT_SOCKET_H -#include_next <linux/socket.h> - -#ifndef SOL_NFC -/* - * backport SOL_NFC -- see commit: - * NFC: llcp: Implement socket options - */ -#define SOL_NFC 280 -#endif - -#ifndef __sockaddr_check_size -#define __sockaddr_check_size(size) \ - BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) -#endif - -#endif /* __BACKPORT_SOCKET_H */ diff --git a/backport/backport-include/linux/spi/spi.h b/backport/backport-include/linux/spi/spi.h deleted file mode 100644 index 6d2de15f..00000000 --- a/backport/backport-include/linux/spi/spi.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _BACKPORTS_LINUX_SPI_H -#define _BACKPORTS_LINUX_SPI_H 1 - -#include_next <linux/spi/spi.h> - -#ifndef module_spi_driver -/** - * module_spi_driver() - Helper macro for registering a SPI driver - * @__spi_driver: spi_driver struct - * - * Helper macro for SPI drivers which do not do anything special in module - * init/exit. This eliminates a lot of boilerplate. Each module may only - * use this macro once, and calling it replaces module_init() and module_exit() - */ -#define module_spi_driver(__spi_driver) \ - module_driver(__spi_driver, spi_register_driver, \ - spi_unregister_driver) -#endif - - -#if LINUX_VERSION_IS_LESS(3,9,0) -/** - * spi_message_init_with_transfers - Initialize spi_message and append transfers - * @m: spi_message to be initialized - * @xfers: An array of spi transfers - * @num_xfers: Number of items in the xfer array - * - * This function initializes the given spi_message and adds each spi_transfer in - * the given array to the message. - */ -#define spi_message_init_with_transfers LINUX_BACKPORT(spi_message_init_with_transfers) -static inline void -spi_message_init_with_transfers(struct spi_message *m, -struct spi_transfer *xfers, unsigned int num_xfers) -{ - unsigned int i; - - spi_message_init(m); - for (i = 0; i < num_xfers; ++i) - spi_message_add_tail(&xfers[i], m); -} - -/** - * spi_sync_transfer - synchronous SPI data transfer - * @spi: device with which data will be exchanged - * @xfers: An array of spi_transfers - * @num_xfers: Number of items in the xfer array - * Context: can sleep - * - * Does a synchronous SPI data transfer of the given spi_transfer array. - * - * For more specific semantics see spi_sync(). - * - * It returns zero on success, else a negative error code. - */ -#define spi_sync_transfer LINUX_BACKPORT(spi_sync_transfer) -static inline int -spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, - unsigned int num_xfers) -{ - struct spi_message msg; - - spi_message_init_with_transfers(&msg, xfers, num_xfers); - - return spi_sync(spi, &msg); -} -#endif /* < 3.9 */ - -#endif /* _BACKPORTS_LINUX_SPI_H */ diff --git a/backport/backport-include/linux/spinlock.h b/backport/backport-include/linux/spinlock.h deleted file mode 100644 index b27f9171..00000000 --- a/backport/backport-include/linux/spinlock.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef __BACKPORT_SPINLOCK_H -#define __BACKPORT_SPINLOCK_H -#include_next <linux/spinlock.h> - -#if LINUX_VERSION_IS_LESS(3,18,0) -#ifndef CONFIG_DEBUG_LOCK_ALLOC -#undef raw_spin_lock_nested -/* - * Always evaluate the 'subclass' argument to avoid that the compiler - * warns about set-but-not-used variables when building with - * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1. - */ -# define raw_spin_lock_nested(lock, subclass) \ - _raw_spin_lock(((void)(subclass), (lock))) -# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) -#endif -#endif /* LINUX_VERSION_IS_LESS(3,18,0) */ - - -#if LINUX_VERSION_IS_LESS(4,16,0) -int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask, - size_t max_size, unsigned int cpu_mult, - gfp_t gfp); - -void free_bucket_spinlocks(spinlock_t *locks); -#endif /* LINUX_VERSION_IS_LESS(4,16,0) */ - -#if LINUX_VERSION_IS_LESS(4,19,0) -int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask, - size_t max_size, unsigned int cpu_mult, - gfp_t gfp, const char *name, - struct lock_class_key *key); - -#define alloc_bucket_spinlocks(locks, lock_mask, max_size, cpu_mult, gfp) \ - ({ \ - static struct lock_class_key key; \ - int ret; \ - \ - ret = __alloc_bucket_spinlocks(locks, lock_mask, max_size, \ - cpu_mult, gfp, #locks, &key); \ - ret; \ - }) -#endif /* LINUX_VERSION_IS_LESS(4,19,0) */ - -#endif /* __BACKPORT_SPINLOCK_H */ diff --git a/backport/backport-include/linux/static_key.h b/backport/backport-include/linux/static_key.h deleted file mode 100644 index 4b82eec2..00000000 --- a/backport/backport-include/linux/static_key.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _BACKPORTS_LINUX_STATIC_KEY_H -#define _BACKPORTS_LINUX_STATIC_KEY_H 1 - -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(3,3,0) /* kernels >= 3.3 */ -/* - * XXX: NOTE! - * - * Some 3.3 kernels carry <linux/static.h> but some don't even though its - * its including <linux/jump_label.h>. What makes it more confusing is that - * later all this got shuffled. The safe thing to do then is to just assume - * kernels 3.3..3.4 don't have it and include <linux/jump_label.h> instead, - * and for newer kernels include <linux/static_key.h>. - */ -#if LINUX_VERSION_IS_GEQ(3,5,0) -#include_next <linux/static_key.h> -#else -#include <linux/jump_label.h> -#endif - -#else /* kernels < 3.3 */ -/* - * in between 2.6.37 - 3.5 there's a slew of changes that make - * it hard to backport this properly. If you are interested in - * trying you can use this as reference: - * - * http://drvbp1.linux-foundation.org/~mcgrof/examples/2014/04/01/backport-static-keys.patch - * - * And these notes: - * - * < v2.6.37 - No tracing support - * bf5438fc - v2.6.37 - Jump label support added primarily for tracing but - * tracing was broken, later kernels started sporting - * functional tracing. - * d430d3d7e - v3.0 - Static branch optimizations for jump labels - * c5905afb - v3.3 - Static keys split out, note on the below issue - * c5905afb - v3.5 - git describe --contains c5905afb claims but not true! - * c4b2c0c5f - v3.13 - Adds static_key_initialized(), STATIC_KEY_CHECK_USE() - * - * Because all of this we skip 2.6.37 - 3.3 but and adding support for older - * can be done by of carrying over the non-architecture optimized code. - * Carrying new changes into this file is a burden though so if we really - * find use for this we could just split the non optimized versions upstream - * and copy that through an automatic process. - */ -#endif /* kernels < 3.3 */ - -#endif /* _BACKPORTS_LINUX_STATIC_KEY_H */ diff --git a/backport/backport-include/linux/stddef.h b/backport/backport-include/linux/stddef.h deleted file mode 100644 index 2c836b00..00000000 --- a/backport/backport-include/linux/stddef.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __BACKPORT_LINUX_STDDEF_H -#define __BACKPORT_LINUX_STDDEF_H -#include_next <linux/stddef.h> - -#ifndef offsetofend -/** - * offsetofend(TYPE, MEMBER) - * - * @TYPE: The type of the structure - * @MEMBER: The member within the structure to get the end offset of - */ -#define offsetofend(TYPE, MEMBER) \ - (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) -#endif - -#endif /* __BACKPORT_LINUX_STDDEF_H */ diff --git a/backport/backport-include/linux/string.h b/backport/backport-include/linux/string.h deleted file mode 100644 index 2bfdf747..00000000 --- a/backport/backport-include/linux/string.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __BACKPORT_LINUX_STRING_H -#define __BACKPORT_LINUX_STRING_H -#include_next <linux/string.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(4,5,0) -#define memdup_user_nul LINUX_BACKPORT(memdup_user_nul) -extern void *memdup_user_nul(const void __user *, size_t); -#endif - -/* this was added in v3.2.65, v3.4.106, v3.10.60, v3.12.33, v3.14.24, - * v3.17.3 and v3.18 */ -#if !(LINUX_VERSION_IS_GEQ(3,17,3) || \ - (LINUX_VERSION_IS_GEQ(3,14,24) && \ - LINUX_VERSION_IS_LESS(3,15,0)) || \ - (LINUX_VERSION_IS_GEQ(3,12,33) && \ - LINUX_VERSION_IS_LESS(3,13,0)) || \ - (LINUX_VERSION_IS_GEQ(3,10,60) && \ - LINUX_VERSION_IS_LESS(3,11,0)) || \ - (LINUX_VERSION_IS_GEQ(3,4,106) && \ - LINUX_VERSION_IS_LESS(3,5,0)) || \ - (LINUX_VERSION_IS_GEQ(3,2,65) && \ - LINUX_VERSION_IS_LESS(3,3,0))) -#define memzero_explicit LINUX_BACKPORT(memzero_explicit) -void memzero_explicit(void *s, size_t count); -#endif - -#if LINUX_VERSION_IS_LESS(4,3,0) -ssize_t strscpy(char *dest, const char *src, size_t count); -#endif - -#if LINUX_VERSION_IS_LESS(4,2,0) -char *strreplace(char *s, char old, char new); -#endif - -#if LINUX_VERSION_IS_LESS(4,6,0) -int match_string(const char * const *array, size_t n, const char *string); -#endif /* LINUX_VERSION_IS_LESS(4,5,0) */ - -#endif /* __BACKPORT_LINUX_STRING_H */ diff --git a/backport/backport-include/linux/suspend.h b/backport/backport-include/linux/suspend.h deleted file mode 100644 index 60307182..00000000 --- a/backport/backport-include/linux/suspend.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BP_LINUX_SUSPEND_H -#define __BP_LINUX_SUSPEND_H -#include_next <linux/suspend.h> - -#if LINUX_VERSION_IS_LESS(3,18,0) -static inline void pm_system_wakeup(void) -{ -#if LINUX_VERSION_IS_GEQ(3,10,0) - freeze_wake(); -#endif -} -#endif - -#endif /* __BP_LINUX_SUSPEND_H */ diff --git a/backport/backport-include/linux/sysfs.h b/backport/backport-include/linux/sysfs.h deleted file mode 100644 index 0b71db54..00000000 --- a/backport/backport-include/linux/sysfs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __BACKPORT_LINUX_SYSFS_H -#define __BACKPORT_LINUX_SYSFS_H -#include_next <linux/sysfs.h> -#include <linux/version.h> - -#ifndef __ATTR_RW -#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ - _name##_show, _name##_store) -#endif - -#endif /* __BACKPORT_LINUX_SYSFS_H */ diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h deleted file mode 100644 index ad61a90a..00000000 --- a/backport/backport-include/linux/thermal.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef __BACKPORT_LINUX_THERMAL_H -#define __BACKPORT_LINUX_THERMAL_H -#include_next <linux/thermal.h> -#include <linux/version.h> - -#ifdef CONFIG_THERMAL -#if LINUX_VERSION_IS_LESS(3,8,0) -#include <linux/errno.h> -#include <linux/err.h> - -enum thermal_trend { - THERMAL_TREND_STABLE, /* temperature is stable */ - THERMAL_TREND_RAISING, /* temperature is raising */ - THERMAL_TREND_DROPPING, /* temperature is dropping */ - THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */ - THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */ -}; - -struct backport_thermal_zone_device_ops { - int (*bind) (struct thermal_zone_device *, - struct thermal_cooling_device *); - int (*unbind) (struct thermal_zone_device *, - struct thermal_cooling_device *); - int (*get_temp) (struct thermal_zone_device *, int *); - int (*get_mode) (struct thermal_zone_device *, - enum thermal_device_mode *); - int (*set_mode) (struct thermal_zone_device *, - enum thermal_device_mode); - int (*get_trip_type) (struct thermal_zone_device *, int, - enum thermal_trip_type *); - int (*get_trip_temp) (struct thermal_zone_device *, int, int *); - int (*set_trip_temp) (struct thermal_zone_device *, int, int); - int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); - int (*set_trip_hyst) (struct thermal_zone_device *, int, int); - int (*get_crit_temp) (struct thermal_zone_device *, int *); - int (*set_emul_temp) (struct thermal_zone_device *, int); - int (*get_trend) (struct thermal_zone_device *, int, - enum thermal_trend *); - int (*notify) (struct thermal_zone_device *, int, - enum thermal_trip_type); -}; -#define thermal_zone_device_ops LINUX_BACKPORT(thermal_zone_device_ops) - -struct thermal_bind_params { - struct thermal_cooling_device *cdev; - int weight; - int trip_mask; - int (*match)(struct thermal_zone_device *tz, - struct thermal_cooling_device *cdev); -}; - -struct thermal_zone_params { - int num_tbps; - struct thermal_bind_params *tbp; -}; - -static inline struct thermal_zone_device * -backport_thermal_zone_device_register(const char *type, int trips, int mask, - void *devdata, - struct thermal_zone_device_ops *ops, - const struct thermal_zone_params *tzp, - int passive_delay, int polling_delay) -{ - return ERR_PTR(-EOPNOTSUPP); -} -#define thermal_zone_device_register backport_thermal_zone_device_register - -static inline void thermal_notify_framework(struct thermal_zone_device *tz, - int trip) -{ } -#else /* < 3.8.0 */ - -#if LINUX_VERSION_IS_LESS(3,10,0) -#define thermal_notify_framework notify_thermal_framework -#endif /* LINUX_VERSION_IS_LESS(3,10,0) */ - -#if LINUX_VERSION_IS_LESS(4,3,0) - -typedef struct thermal_zone_device_ops old_thermal_zone_device_ops_t; - -/* also add a way to call the old register and unregister functions */ -static inline struct thermal_zone_device *old_thermal_zone_device_register( - const char *type, int trips, int mask, void *devdata, - old_thermal_zone_device_ops_t *_ops, - const struct thermal_zone_params *_tzp, - int passive_delay, int polling_delay) -{ - struct thermal_zone_device_ops *ops = - (struct thermal_zone_device_ops *) _ops; - - /* cast the const away */ - struct thermal_zone_params *tzp = - (struct thermal_zone_params *)_tzp; - - return thermal_zone_device_register(type, trips, mask, devdata, - ops, tzp, passive_delay, - polling_delay); -} - -static inline -void old_thermal_zone_device_unregister(struct thermal_zone_device *dev) -{ - thermal_zone_device_unregister(dev); -} - -struct backport_thermal_zone_device_ops { - int (*bind) (struct thermal_zone_device *, - struct thermal_cooling_device *); - int (*unbind) (struct thermal_zone_device *, - struct thermal_cooling_device *); - int (*get_temp) (struct thermal_zone_device *, int *); - int (*get_mode) (struct thermal_zone_device *, - enum thermal_device_mode *); - int (*set_mode) (struct thermal_zone_device *, - enum thermal_device_mode); - int (*get_trip_type) (struct thermal_zone_device *, int, - enum thermal_trip_type *); - int (*get_trip_temp) (struct thermal_zone_device *, int, int *); - int (*set_trip_temp) (struct thermal_zone_device *, int, int); - int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); - int (*set_trip_hyst) (struct thermal_zone_device *, int, int); - int (*get_crit_temp) (struct thermal_zone_device *, int *); - int (*set_emul_temp) (struct thermal_zone_device *, int); - int (*get_trend) (struct thermal_zone_device *, int, - enum thermal_trend *); - int (*notify) (struct thermal_zone_device *, int, - enum thermal_trip_type); -}; -#define thermal_zone_device_ops LINUX_BACKPORT(thermal_zone_device_ops) - -#undef thermal_zone_device_register -struct thermal_zone_device *backport_thermal_zone_device_register( - const char *type, int trips, int mask, void *devdata, - struct thermal_zone_device_ops *ops, - const struct thermal_zone_params *tzp, - int passive_delay, int polling_delay); - -#define thermal_zone_device_register \ - LINUX_BACKPORT(thermal_zone_device_register) - -#undef thermal_zone_device_unregister -void backport_thermal_zone_device_unregister(struct thermal_zone_device *); -#define thermal_zone_device_unregister \ - LINUX_BACKPORT(thermal_zone_device_unregister) - -#endif /* LINUX_VERSION_IS_LESS(4,3,0) */ -#endif /* ! < 3.8.0 */ -#endif /* CONFIG_THERMAL */ - -#endif /* __BACKPORT_LINUX_THERMAL_H */ diff --git a/backport/backport-include/linux/time.h b/backport/backport-include/linux/time.h deleted file mode 100644 index 3191047d..00000000 --- a/backport/backport-include/linux/time.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __BACKPORT_LINUX_TIME_H -#define __BACKPORT_LINUX_TIME_H -#include_next <linux/time.h> - -#include <linux/time64.h> - -#endif /* __BACKPORT_LINUX_TIME_H */ diff --git a/backport/backport-include/linux/time64.h b/backport/backport-include/linux/time64.h deleted file mode 100644 index 49805da9..00000000 --- a/backport/backport-include/linux/time64.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __BACKPORT_LINUX_TIME64_H -#define __BACKPORT_LINUX_TIME64_H -#if LINUX_VERSION_IS_GEQ(3,17,0) -#include_next <linux/time64.h> -#else -#include <linux/time.h> -#endif - -#if LINUX_VERSION_IS_LESS(3,17,0) -#define timespec64_equal timespec_equal -#define timespec64_compare timespec_compare -#define set_normalized_timespec64 set_normalized_timespec -#define timespec64_add_safe timespec_add_safe -#define timespec64_add timespec_add -#define timespec64_sub timespec_sub -#define timespec64_valid timespec_valid -#define timespec64_valid_strict timespec_valid_strict -#define timespec64_to_ns timespec_to_ns -#define ns_to_timespec64 ns_to_timespec -#define timespec64_add_ns timespec_add_ns -#define timespec64 timespec -#endif /* LINUX_VERSION_IS_LESS(3,17,0) */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -static inline time64_t mktime64(const unsigned int year0, const unsigned int mon0, - const unsigned int day, const unsigned int hour, - const unsigned int min, const unsigned int sec) -{ - unsigned int mon = mon0, year = year0; - - /* 1..12 -> 11,12,1..10 */ - if (0 >= (int) (mon -= 2)) { - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - - return ((((time64_t) - (year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours - midnight tomorrow handled here */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} -#endif - -#endif /* __BACKPORT_LINUX_TIME64_H */ diff --git a/backport/backport-include/linux/timecounter.h b/backport/backport-include/linux/timecounter.h deleted file mode 100644 index 596015b1..00000000 --- a/backport/backport-include/linux/timecounter.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __BACKPORT_LINUX_TIMECOUNTER_H -#define __BACKPORT_LINUX_TIMECOUNTER_H - -#if LINUX_VERSION_IS_GEQ(3,20,0) -#include_next <linux/timecounter.h> -#else -#include <linux/clocksource.h> - -/** - * timecounter_adjtime - Shifts the time of the clock. - * @delta: Desired change in nanoseconds. - */ -#define timecounter_adjtime LINUX_BACKPORT(timecounter_adjtime) -static inline void timecounter_adjtime(struct timecounter *tc, s64 delta) -{ - tc->nsec += delta; -} -#endif - -#ifndef CYCLECOUNTER_MASK -/* simplify initialization of mask field */ -#define CYCLECOUNTER_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) -#endif - -#endif /* __BACKPORT_LINUX_TIMECOUNTER_H */ diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h deleted file mode 100644 index a0d65fba..00000000 --- a/backport/backport-include/linux/timekeeping.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef __BACKPORT_TIMEKEEPING_H -#define __BACKPORT_TIMEKEEPING_H -#include <linux/version.h> -#include <linux/types.h> - -#if LINUX_VERSION_IS_GEQ(3,17,0) -#include_next <linux/timekeeping.h> -#endif - -#if LINUX_VERSION_IS_LESS(3,17,0) -#if BITS_PER_LONG < 64 -extern u64 ktime_divns(const ktime_t kt, s64 div); -#else /* BITS_PER_LONG < 64 */ -# define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) -#endif -#define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) -extern ktime_t ktime_get(void); -#define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) -static inline u64 ktime_get_ns(void) -{ - return ktime_to_ns(ktime_get()); -} - -extern ktime_t ktime_get_boottime(void); -#define ktime_get_boot_ns LINUX_BACKPORT(ktime_get_boot_ns) -static inline u64 ktime_get_boot_ns(void) -{ - return ktime_to_ns(ktime_get_boottime()); -} -#endif /* < 3.17 */ - -#if LINUX_VERSION_IS_LESS(4,18,0) -extern time64_t ktime_get_boottime_seconds(void); -#endif /* < 4.18 */ - -#if LINUX_VERSION_IS_LESS(3,19,0) -static inline time64_t ktime_get_seconds(void) -{ - struct timespec t; - - ktime_get_ts(&t); - - return t.tv_sec; -} - -static inline time64_t ktime_get_real_seconds(void) -{ - struct timeval tv; - - do_gettimeofday(&tv); - - return tv.tv_sec; -} -#endif - -#if LINUX_VERSION_IS_LESS(3,17,0) -static inline void ktime_get_ts64(struct timespec64 *ts) -{ - ktime_get_ts(ts); -} -#endif - -#if LINUX_VERSION_IS_LESS(3,17,0) -/* This was introduced in 4.15, but we only need it in the - * ktime_get_raw_ts64 backport() for < 3.17. - */ -#if __BITS_PER_LONG == 64 -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) -{ - return *(const struct timespec64 *)&ts; -} - -#else -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) -{ - struct timespec64 ret; - - ret.tv_sec = ts.tv_sec; - ret.tv_nsec = ts.tv_nsec; - return ret; -} -#endif -#endif /* < 3.17 */ - -#if LINUX_VERSION_IS_LESS(4,18,0) -#define ktime_get_raw_ts64 LINUX_BACKPORT(ktime_get_raw_ts64) -static inline void ktime_get_raw_ts64(struct timespec64 *ts) -{ -#if LINUX_VERSION_IS_LESS(3,19,0) - struct timespec64 ts64; - - getrawmonotonic(&ts64); - *ts = timespec_to_timespec64(ts64); -#else - return getrawmonotonic64(ts); -#endif /* < 3.19 */ -} -#endif - -#endif /* __BACKPORT_TIMEKEEPING_H */ diff --git a/backport/backport-include/linux/timer.h b/backport/backport-include/linux/timer.h deleted file mode 100644 index 69590bb7..00000000 --- a/backport/backport-include/linux/timer.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _BACKPORT_TIMER_H -#define _BACKPORT_TIMER_H - -#include_next <linux/timer.h> - -#ifndef setup_deferrable_timer -/* - * The TIMER_DEFERRABLE flag has not been around since 3.0 so - * two different backports are needed here. - */ -#ifdef TIMER_DEFERRABLE -#define setup_deferrable_timer(timer, fn, data) \ - __setup_timer((timer), (fn), (data), TIMER_DEFERRABLE) -#else -static inline void setup_deferrable_timer_key(struct timer_list *timer, - const char *name, - struct lock_class_key *key, - void (*func)(unsigned long), - unsigned long data) -{ - timer->function = func; - timer->data = data; - init_timer_deferrable_key(timer, name, key); -} -#define setup_deferrable_timer(timer, fn, data) \ - do { \ - static struct lock_class_key __key; \ - setup_deferrable_timer_key((timer), #timer, &__key, \ - (fn), (data)); \ - } while (0) -#endif -#endif - -#ifndef TIMER_DEFERRABLE -#define TIMER_DEFERRABLE 1 -#endif - -#ifndef from_timer -#define TIMER_DATA_TYPE unsigned long -#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE) - -static inline void timer_setup(struct timer_list *timer, - void (*callback) (struct timer_list *), - unsigned int flags) -{ -#ifdef __setup_timer - __setup_timer(timer, (TIMER_FUNC_TYPE) callback, - (TIMER_DATA_TYPE) timer, flags); -#else - if (flags & TIMER_DEFERRABLE) - setup_deferrable_timer(timer, (TIMER_FUNC_TYPE) callback, - (TIMER_DATA_TYPE) timer); - else - setup_timer(timer, (TIMER_FUNC_TYPE) callback, - (TIMER_DATA_TYPE) timer); -#endif -} - -#define from_timer(var, callback_timer, timer_fieldname) \ - container_of(callback_timer, typeof(*var), timer_fieldname) -#endif - -#if LINUX_VERSION_IS_LESS(4,15,0) -#undef DEFINE_TIMER -#define DEFINE_TIMER(_name, _function) \ - struct timer_list _name = \ - __TIMER_INITIALIZER(_function, 0, 0, 0) -#endif - -#endif /* _BACKPORT_TIMER_H */ diff --git a/backport/backport-include/linux/tracepoint.h b/backport/backport-include/linux/tracepoint.h deleted file mode 100644 index a695c6fc..00000000 --- a/backport/backport-include/linux/tracepoint.h +++ /dev/null @@ -1,10 +0,0 @@ -#include_next <linux/tracepoint.h> - -#ifndef __BACKPORT_LINUX_TRACEPOINT_H -#define __BACKPORT_LINUX_TRACEPOINT_H - -#ifndef TRACE_DEFINE_ENUM -#define TRACE_DEFINE_ENUM(a) -#endif - -#endif /* __BACKPORT_LINUX_TRACEPOINT_H */ diff --git a/backport/backport-include/linux/tty.h b/backport/backport-include/linux/tty.h deleted file mode 100644 index 987a1157..00000000 --- a/backport/backport-include/linux/tty.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __BACKPORT_LINUX_TTY_H -#define __BACKPORT_LINUX_TTY_H -#include_next <linux/tty.h> - -/* - * This really belongs into uapi/asm-generic/termbits.h but - * that doesn't usually get included directly. - */ -#ifndef EXTPROC -#define EXTPROC 0200000 -#endif - -#if LINUX_VERSION_IS_LESS(3,7,0) -/* Backports tty_lock: Localise the lock */ -#define tty_lock(__tty) tty_lock() -#define tty_unlock(__tty) tty_unlock() - -#define tty_port_register_device(port, driver, index, device) \ - tty_register_device(driver, index, device) -#endif - -#if LINUX_VERSION_IS_LESS(3,10,0) -extern void tty_port_tty_wakeup(struct tty_port *port); -extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal); -#endif /* LINUX_VERSION_IS_LESS(3,10,0) */ - -#if LINUX_VERSION_IS_LESS(4,1,0) && \ - LINUX_VERSION_IS_GEQ(4,0,0) -extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); -#endif /* LINUX_VERSION_IS_LESS(4,1,0) */ - -#ifndef N_NCI -#define N_NCI 25 /* NFC NCI UART */ -#endif - -#endif /* __BACKPORT_LINUX_TTY_H */ diff --git a/backport/backport-include/linux/tty_flip.h b/backport/backport-include/linux/tty_flip.h deleted file mode 100644 index e6c0684e..00000000 --- a/backport/backport-include/linux/tty_flip.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __BACKPORT_TTY_FLIP_H -#define __BACKPORT_TTY_FLIP_H -#include_next <linux/tty_flip.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,9,0) -#define tty_flip_buffer_push(port) tty_flip_buffer_push((port)->tty) -#define tty_insert_flip_string(port, chars, size) tty_insert_flip_string((port)->tty, chars, size) -#endif - -#endif /* __BACKPORT_TTY_FLIP_H */ diff --git a/backport/backport-include/linux/types.h b/backport/backport-include/linux/types.h deleted file mode 100644 index 0671e140..00000000 --- a/backport/backport-include/linux/types.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BACKPORT_TYPES -#define __BACKPORT_TYPES -#include <linux/version.h> -#include_next <linux/types.h> - -#if LINUX_VERSION_IS_LESS(3,17,0) -typedef __s64 time64_t; -#endif - -#if LINUX_VERSION_IS_LESS(4,16,0) -typedef unsigned __poll_t; -#endif - -#endif /* __BACKPORT_TYPES */ diff --git a/backport/backport-include/linux/u64_stats_sync.h b/backport/backport-include/linux/u64_stats_sync.h deleted file mode 100644 index 251373a7..00000000 --- a/backport/backport-include/linux/u64_stats_sync.h +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef __BACKPORT_LINUX_U64_STATS_SYNC_H -#define __BACKPORT_LINUX_U64_STATS_SYNC_H - -#include <linux/version.h> -#include <generated/utsrelease.h> -#if LINUX_VERSION_IS_GEQ(3,6,0) -#include_next <linux/u64_stats_sync.h> -#else - -/* - * To properly implement 64bits network statistics on 32bit and 64bit hosts, - * we provide a synchronization point, that is a noop on 64bit or UP kernels. - * - * Key points : - * 1) Use a seqcount on SMP 32bits, with low overhead. - * 2) Whole thing is a noop on 64bit arches or UP kernels. - * 3) Write side must ensure mutual exclusion or one seqcount update could - * be lost, thus blocking readers forever. - * If this synchronization point is not a mutex, but a spinlock or - * spinlock_bh() or disable_bh() : - * 3.1) Write side should not sleep. - * 3.2) Write side should not allow preemption. - * 3.3) If applicable, interrupts should be disabled. - * - * 4) If reader fetches several counters, there is no guarantee the whole values - * are consistent (remember point 1) : this is a noop on 64bit arches anyway) - * - * 5) readers are allowed to sleep or be preempted/interrupted : They perform - * pure reads. But if they have to fetch many values, it's better to not allow - * preemptions/interruptions to avoid many retries. - * - * 6) If counter might be written by an interrupt, readers should block interrupts. - * (On UP, there is no seqcount_t protection, a reader allowing interrupts could - * read partial values) - * - * 7) For softirq uses, readers can use u64_stats_fetch_begin_irq() and - * u64_stats_fetch_retry_irq() helpers - * - * Usage : - * - * Stats producer (writer) should use following template granted it already got - * an exclusive access to counters (a lock is already taken, or per cpu - * data is used [in a non preemptable context]) - * - * spin_lock_bh(...) or other synchronization to get exclusive access - * ... - * u64_stats_update_begin(&stats->syncp); - * stats->bytes64 += len; // non atomic operation - * stats->packets64++; // non atomic operation - * u64_stats_update_end(&stats->syncp); - * - * While a consumer (reader) should use following template to get consistent - * snapshot for each variable (but no guarantee on several ones) - * - * u64 tbytes, tpackets; - * unsigned int start; - * - * do { - * start = u64_stats_fetch_begin(&stats->syncp); - * tbytes = stats->bytes64; // non atomic operation - * tpackets = stats->packets64; // non atomic operation - * } while (u64_stats_fetch_retry(&stats->syncp, start)); - * - * - * Example of use in drivers/net/loopback.c, using per_cpu containers, - * in BH disabled context. - */ -#include <linux/seqlock.h> - -struct u64_stats_sync { -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - seqcount_t seq; -#endif -}; - -static inline void u64_stats_update_begin(struct u64_stats_sync *syncp) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - write_seqcount_begin(&syncp->seq); -#endif -} - -static inline void u64_stats_update_end(struct u64_stats_sync *syncp) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - write_seqcount_end(&syncp->seq); -#endif -} - -static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - return read_seqcount_begin(&syncp->seq); -#else -#if BITS_PER_LONG==32 - preempt_disable(); -#endif - return 0; -#endif -} - -static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp, - unsigned int start) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - return read_seqcount_retry(&syncp->seq, start); -#else -#if BITS_PER_LONG==32 - preempt_enable(); -#endif - return false; -#endif -} - -#endif /* LINUX_VERSION_IS_GEQ(3,6,0) */ - -#if LINUX_VERSION_IS_LESS(3,15,0) && \ - !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) -static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - return read_seqcount_begin(&syncp->seq); -#else -#if BITS_PER_LONG==32 - local_irq_disable(); -#endif - return 0; -#endif -} - -static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp, - unsigned int start) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - return read_seqcount_retry(&syncp->seq, start); -#else -#if BITS_PER_LONG==32 - local_irq_enable(); -#endif - return false; -#endif -} - -#endif /* LINUX_VERSION_IS_GEQ(3,15,0) */ - -#if LINUX_VERSION_IS_LESS(3,13,0) -#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) -# define u64_stats_init(syncp) seqcount_init(syncp.seq) -#else -# define u64_stats_init(syncp) do { } while (0) -#endif -#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ - -#if LINUX_VERSION_IS_LESS(4,16,0) && \ - !LINUX_VERSION_IN_RANGE(4,14,44, 4,15,0) && \ - !(LINUX_VERSION_IS_GEQ(4,15,18) && UTS_UBUNTU_RELEASE_ABI >= 33) -static inline unsigned long -u64_stats_update_begin_irqsave(struct u64_stats_sync *syncp) -{ - unsigned long flags = 0; - -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - local_irq_save(flags); - write_seqcount_begin(&syncp->seq); -#endif - return flags; -} - -static inline void -u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, - unsigned long flags) -{ -#if BITS_PER_LONG==32 && defined(CONFIG_SMP) - write_seqcount_end(&syncp->seq); - local_irq_restore(flags); -#endif -} -#endif /* < 4.16 */ - -#endif /* __BACKPORT_LINUX_U64_STATS_SYNC_H */ diff --git a/backport/backport-include/linux/uidgid.h b/backport/backport-include/linux/uidgid.h deleted file mode 100644 index c2f3faa0..00000000 --- a/backport/backport-include/linux/uidgid.h +++ /dev/null @@ -1,221 +0,0 @@ -#if LINUX_VERSION_IS_GEQ(3,5,0) -#include_next <linux/uidgid.h> -#else - -#ifndef _LINUX_UIDGID_H -#define _LINUX_UIDGID_H - -/* - * A set of types for the internal kernel types representing uids and gids. - * - * The types defined in this header allow distinguishing which uids and gids in - * the kernel are values used by userspace and which uid and gid values are - * the internal kernel values. With the addition of user namespaces the values - * can be different. Using the type system makes it possible for the compiler - * to detect when we overlook these differences. - * - */ -#include <linux/types.h> -#include <linux/highuid.h> - -struct user_namespace; -extern struct user_namespace init_user_ns; - -#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS - -typedef struct { - uid_t val; -} kuid_t; - - -typedef struct { - gid_t val; -} kgid_t; - -#define KUIDT_INIT(value) (kuid_t){ value } -#define KGIDT_INIT(value) (kgid_t){ value } - -static inline uid_t __kuid_val(kuid_t uid) -{ - return uid.val; -} - -static inline gid_t __kgid_val(kgid_t gid) -{ - return gid.val; -} - -#else - -typedef uid_t kuid_t; -typedef gid_t kgid_t; - -static inline uid_t __kuid_val(kuid_t uid) -{ - return uid; -} - -static inline gid_t __kgid_val(kgid_t gid) -{ - return gid; -} - -#define KUIDT_INIT(value) ((kuid_t) value ) -#define KGIDT_INIT(value) ((kgid_t) value ) - -#endif - -#define GLOBAL_ROOT_UID KUIDT_INIT(0) -#define GLOBAL_ROOT_GID KGIDT_INIT(0) - -#define INVALID_UID KUIDT_INIT(-1) -#define INVALID_GID KGIDT_INIT(-1) - -static inline bool uid_eq(kuid_t left, kuid_t right) -{ - return __kuid_val(left) == __kuid_val(right); -} - -static inline bool gid_eq(kgid_t left, kgid_t right) -{ - return __kgid_val(left) == __kgid_val(right); -} - -static inline bool uid_gt(kuid_t left, kuid_t right) -{ - return __kuid_val(left) > __kuid_val(right); -} - -static inline bool gid_gt(kgid_t left, kgid_t right) -{ - return __kgid_val(left) > __kgid_val(right); -} - -static inline bool uid_gte(kuid_t left, kuid_t right) -{ - return __kuid_val(left) >= __kuid_val(right); -} - -static inline bool gid_gte(kgid_t left, kgid_t right) -{ - return __kgid_val(left) >= __kgid_val(right); -} - -static inline bool uid_lt(kuid_t left, kuid_t right) -{ - return __kuid_val(left) < __kuid_val(right); -} - -static inline bool gid_lt(kgid_t left, kgid_t right) -{ - return __kgid_val(left) < __kgid_val(right); -} - -static inline bool uid_lte(kuid_t left, kuid_t right) -{ - return __kuid_val(left) <= __kuid_val(right); -} - -static inline bool gid_lte(kgid_t left, kgid_t right) -{ - return __kgid_val(left) <= __kgid_val(right); -} - -static inline bool uid_valid(kuid_t uid) -{ - return !uid_eq(uid, INVALID_UID); -} - -static inline bool gid_valid(kgid_t gid) -{ - return !gid_eq(gid, INVALID_GID); -} - -#ifdef CONFIG_USER_NS - -#define make_kuid LINUX_BACKPORT(make_kuid) -extern kuid_t make_kuid(struct user_namespace *from, uid_t uid); -#define make_kgid LINUX_BACKPORT(make_kgid) -extern kgid_t make_kgid(struct user_namespace *from, gid_t gid); - -#define from_kuid LINUX_BACKPORT(from_kuid) -extern uid_t from_kuid(struct user_namespace *to, kuid_t uid); -#define from_kgid LINUX_BACKPORT(from_kgid) -extern gid_t from_kgid(struct user_namespace *to, kgid_t gid); -#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged) -extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid); -#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged) -extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid); - -#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping) -static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) -{ - return from_kuid(ns, uid) != (uid_t) -1; -} - -#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping) -static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) -{ - return from_kgid(ns, gid) != (gid_t) -1; -} - -#else - -#define make_kuid LINUX_BACKPORT(make_kuid) -static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid) -{ - return KUIDT_INIT(uid); -} - -#define make_kgid LINUX_BACKPORT(make_kgid) -static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid) -{ - return KGIDT_INIT(gid); -} - -#define from_kuid LINUX_BACKPORT(from_kuid) -static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid) -{ - return __kuid_val(kuid); -} - -#define from_kgid LINUX_BACKPORT(from_kgid) -static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid) -{ - return __kgid_val(kgid); -} - -#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged) -static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid) -{ - uid_t uid = from_kuid(to, kuid); - if (uid == (uid_t)-1) - uid = overflowuid; - return uid; -} - -#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged) -static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid) -{ - gid_t gid = from_kgid(to, kgid); - if (gid == (gid_t)-1) - gid = overflowgid; - return gid; -} - -#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping) -static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) -{ - return true; -} - -#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping) -static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) -{ - return true; -} - -#endif /* CONFIG_USER_NS */ - -#endif /* _LINUX_UIDGID_H */ -#endif /* LINUX_VERSION_IS_GEQ(3,5,0) */ diff --git a/backport/backport-include/linux/usb.h b/backport/backport-include/linux/usb.h deleted file mode 100644 index 1873a336..00000000 --- a/backport/backport-include/linux/usb.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef __BACKPORT_USB_H -#define __BACKPORT_USB_H - -#include_next <linux/usb.h> -#include <linux/version.h> - -#ifndef module_usb_driver -/** - * module_usb_driver() - Helper macro for registering a USB driver - * @__usb_driver: usb_driver struct - * - * Helper macro for USB drivers which do not do anything special in module - * init/exit. This eliminates a lot of boilerplate. Each module may only - * use this macro once, and calling it replaces module_init() and module_exit() - */ -#define module_usb_driver(__usb_driver) \ - module_driver(__usb_driver, usb_register, \ - usb_deregister) -#endif - -#ifndef USB_VENDOR_AND_INTERFACE_INFO -/** - * Backports - * - * commit d81a5d1956731c453b85c141458d4ff5d6cc5366 - * Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk> - * Date: Tue Jul 10 19:10:06 2012 -0300 - * - * USB: add USB_VENDOR_AND_INTERFACE_INFO() macro - */ -#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \ - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ - | USB_DEVICE_ID_MATCH_VENDOR, \ - .idVendor = (vend), \ - .bInterfaceClass = (cl), \ - .bInterfaceSubClass = (sc), \ - .bInterfaceProtocol = (pr) -#endif /* USB_VENDOR_AND_INTERFACE_INFO */ - -#ifndef USB_DEVICE_INTERFACE_NUMBER -/** - * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number - * @vend: the 16 bit USB Vendor ID - * @prod: the 16 bit USB Product ID - * @num: bInterfaceNumber value - * - * This macro is used to create a struct usb_device_id that matches a - * specific interface number of devices. - */ -#define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \ - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ - .idVendor = (vend), \ - .idProduct = (prod) -#endif /* USB_DEVICE_INTERFACE_NUMBER */ - -#ifndef USB_DEVICE_INTERFACE_CLASS -/** - * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class - * @vend: the 16 bit USB Vendor ID - * @prod: the 16 bit USB Product ID - * @cl: bInterfaceClass value - * - * This macro is used to create a struct usb_device_id that matches a - * specific interface class of devices. - */ -#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \ - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ - USB_DEVICE_ID_MATCH_INT_CLASS, \ - .idVendor = (vend), \ - .idProduct = (prod), \ - .bInterfaceClass = (cl) -#endif /* USB_DEVICE_INTERFACE_CLASS */ - -#ifndef USB_SUBCLASS_VENDOR_SPEC -/* this is defined in usb/ch9.h, but we only need it through here */ -#define USB_SUBCLASS_VENDOR_SPEC 0xff -#endif - -#if LINUX_VERSION_IS_LESS(3,2,0) -#define usb_translate_errors LINUX_BACKPORT(usb_translate_errors) -static inline int usb_translate_errors(int error_code) -{ - switch (error_code) { - case 0: - case -ENOMEM: - case -ENODEV: - case -EOPNOTSUPP: - return error_code; - default: - return -EIO; - } -} -#endif /* LINUX_VERSION_IS_LESS(3,2,0) */ - -#endif /* __BACKPORT_USB_H */ diff --git a/backport/backport-include/linux/usb/cdc.h b/backport/backport-include/linux/usb/cdc.h deleted file mode 100644 index 5ad31bf1..00000000 --- a/backport/backport-include/linux/usb/cdc.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __BP_USB_CDC_H -#define __BP_USB_CDC_H -#include <linux/version.h> - -#if LINUX_VERSION_IS_GEQ(4,8,0) -#include_next <linux/usb/cdc.h> -#else -#include <uapi/linux/usb/cdc.h> - -/* - * inofficial magic numbers - */ - -#define CDC_PHONET_MAGIC_NUMBER 0xAB - -#ifndef USB_CDC_MBIM_EXTENDED_TYPE -#define USB_CDC_MBIM_EXTENDED_TYPE 0x1c - -/* "MBIM Extended Functional Descriptor" from CDC MBIM spec 1.0 errata-1 */ -struct usb_cdc_mbim_extended_desc { - __u8 bLength; - __u8 bDescriptorType; - __u8 bDescriptorSubType; - - __le16 bcdMBIMExtendedVersion; - __u8 bMaxOutstandingCommandMessages; - __le16 wMTU; -} __attribute__ ((packed)); -#endif - -/* - * parsing CDC headers - */ - -struct usb_cdc_parsed_header { - struct usb_cdc_union_desc *usb_cdc_union_desc; - struct usb_cdc_header_desc *usb_cdc_header_desc; - - struct usb_cdc_call_mgmt_descriptor *usb_cdc_call_mgmt_descriptor; - struct usb_cdc_acm_descriptor *usb_cdc_acm_descriptor; - struct usb_cdc_country_functional_desc *usb_cdc_country_functional_desc; - struct usb_cdc_network_terminal_desc *usb_cdc_network_terminal_desc; - struct usb_cdc_ether_desc *usb_cdc_ether_desc; - struct usb_cdc_dmm_desc *usb_cdc_dmm_desc; - struct usb_cdc_mdlm_desc *usb_cdc_mdlm_desc; - struct usb_cdc_mdlm_detail_desc *usb_cdc_mdlm_detail_desc; - struct usb_cdc_obex_desc *usb_cdc_obex_desc; - struct usb_cdc_ncm_desc *usb_cdc_ncm_desc; - struct usb_cdc_mbim_desc *usb_cdc_mbim_desc; - struct usb_cdc_mbim_extended_desc *usb_cdc_mbim_extended_desc; - - bool phonet_magic_present; -}; - -#define cdc_parse_cdc_header LINUX_BACKPORT(cdc_parse_cdc_header) -int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr, - struct usb_interface *intf, - u8 *buffer, int buflen); -#endif - -#endif /* __BP_USB_CDC_H */ diff --git a/backport/backport-include/linux/usb/ch9.h b/backport/backport-include/linux/usb/ch9.h deleted file mode 100644 index c2f0120c..00000000 --- a/backport/backport-include/linux/usb/ch9.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __BACKPORT__LINUX_USB_CH9_H -#define __BACKPORT__LINUX_USB_CH9_H - -#include <linux/version.h> -#include_next <linux/usb/ch9.h> - -#if LINUX_VERSION_IS_LESS(3,2,0) -#include <linux/types.h> /* __u8 etc */ -#include <asm/byteorder.h> /* le16_to_cpu */ - -/** - * usb_endpoint_maxp - get endpoint's max packet size - * @epd: endpoint to be checked - * - * Returns @epd's max packet - */ -#define usb_endpoint_maxp LINUX_BACKPORT(usb_endpoint_maxp) -static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) -{ - return __le16_to_cpu(epd->wMaxPacketSize); -} -#endif /* < 3.2 */ - -#if LINUX_VERSION_IS_LESS(4,6,0) -#define USB_SPEED_SUPER_PLUS 6 -#endif - -#endif /* __BACKPORT__LINUX_USB_CH9_H */ diff --git a/backport/backport-include/linux/uuid.h b/backport/backport-include/linux/uuid.h deleted file mode 100644 index bc6fbe17..00000000 --- a/backport/backport-include/linux/uuid.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __BACKPORT_LINUX_UUID_H_ -#define __BACKPORT_LINUX_UUID_H_ -#include <linux/version.h> -#include_next <linux/uuid.h> - -#ifndef UUID_STRING_LEN -/* - * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") - * not including trailing NUL. - */ -#define UUID_STRING_LEN 36 -#endif - -#if LINUX_VERSION_IS_LESS(4,13,0) -#define guid_t uuid_le -#define uuid_t uuid_be - -static inline void guid_gen(guid_t *u) -{ - return uuid_le_gen(u); -} -static inline void uuid_gen(uuid_t *u) -{ - return uuid_be_gen(u); -} - -static inline void guid_copy(guid_t *dst, const guid_t *src) -{ - memcpy(dst, src, sizeof(guid_t)); -} -#endif - -#endif /* __BACKPORT_LINUX_UUID_H_ */ diff --git a/backport/backport-include/linux/verification.h b/backport/backport-include/linux/verification.h deleted file mode 100644 index 5fd0a2d3..00000000 --- a/backport/backport-include/linux/verification.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __BP_VERIFICATION_H -#define __BP_VERIFICATION_H -#include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(4,7,0) && !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) -#include_next <linux/verification.h> -#else -#include <linux/key.h> - -enum key_being_used_for { - VERIFYING_MODULE_SIGNATURE, - VERIFYING_FIRMWARE_SIGNATURE, - VERIFYING_KEXEC_PE_SIGNATURE, - VERIFYING_KEY_SIGNATURE, - VERIFYING_KEY_SELF_SIGNATURE, - VERIFYING_UNSPECIFIED_SIGNATURE, - NR__KEY_BEING_USED_FOR -}; - -extern int verify_pkcs7_signature(const void *data, size_t len, - const void *raw_pkcs7, size_t pkcs7_len, - struct key *trusted_keys, - enum key_being_used_for usage, - int (*view_content)(void *ctx, - const void *data, size_t len, - size_t asn1hdrlen), - void *ctx); -#endif /* LINUX_VERSION_IS_GEQ(4,7,0) && !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) */ -#endif /* __BP_VERIFICATION_H */ diff --git a/backport/backport-include/linux/version.h b/backport/backport-include/linux/version.h deleted file mode 100644 index 2cb601ad..00000000 --- a/backport/backport-include/linux/version.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _BP_LINUX_VERSION_H -#define _BP_LINUX_VERSION_H -#include_next <linux/version.h> - -#ifndef RHEL_RELEASE_VERSION -#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b)) -#endif - -#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_IS_GEQ(x1,x2,x3) && LINUX_VERSION_IS_LESS(y1,y2,y3)) -#endif /* _BP_LINUX_VERSION_H */ diff --git a/backport/backport-include/linux/wait.h b/backport/backport-include/linux/wait.h deleted file mode 100644 index 15a674cf..00000000 --- a/backport/backport-include/linux/wait.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __BACKPORT_LINUX_WAIT_H -#define __BACKPORT_LINUX_WAIT_H -#include_next <linux/wait.h> - -#if LINUX_VERSION_IS_LESS(3,17,0) -extern int bit_wait(void *); -extern int bit_wait_io(void *); - -static inline int -backport_wait_on_bit(void *word, int bit, unsigned mode) -{ - return wait_on_bit(word, bit, bit_wait, mode); -} - -static inline int -backport_wait_on_bit_io(void *word, int bit, unsigned mode) -{ - return wait_on_bit(word, bit, bit_wait_io, mode); -} - -#define wait_on_bit LINUX_BACKPORT(wait_on_bit) -#define wait_on_bit_io LINUX_BACKPORT(wait_on_bit_io) - -#endif - -#if LINUX_VERSION_IS_LESS(3,18,12) -#define WQ_FLAG_WOKEN 0x02 - -#define wait_woken LINUX_BACKPORT(wait_woken) -long wait_woken(wait_queue_t *wait, unsigned mode, long timeout); -#define wait_woken LINUX_BACKPORT(wait_woken) -int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); -#endif - -/** - * For wait_on_bit_timeout() an extra member in struct wait_bit_key is needed. - * This was introuced in kernel 3.17 and we are only able to backport this - * function on these kernel versions. - */ -#if LINUX_VERSION_IS_GEQ(3,17,0) -#if LINUX_VERSION_IS_LESS(3,18,0) -#define out_of_line_wait_on_bit_timeout LINUX_BACKPORT(out_of_line_wait_on_bit_timeout) -int out_of_line_wait_on_bit_timeout(void *, int, wait_bit_action_f *, unsigned, unsigned long); - -#define bit_wait_timeout LINUX_BACKPORT(bit_wait_timeout) -extern int bit_wait_timeout(struct wait_bit_key *); -#endif - -#if LINUX_VERSION_IS_LESS(3,20,0) -#define wait_on_bit_timeout LINUX_BACKPORT(wait_on_bit_timeout) -/** - * wait_on_bit_timeout - wait for a bit to be cleared or a timeout elapses - * @word: the word being waited on, a kernel virtual address - * @bit: the bit of the word being waited on - * @mode: the task state to sleep in - * @timeout: timeout, in jiffies - * - * Use the standard hashed waitqueue table to wait for a bit - * to be cleared. This is similar to wait_on_bit(), except also takes a - * timeout parameter. - * - * Returned value will be zero if the bit was cleared before the - * @timeout elapsed, or non-zero if the @timeout elapsed or process - * received a signal and the mode permitted wakeup on that signal. - */ -static inline int -wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout) -{ - might_sleep(); - if (!test_bit(bit, word)) - return 0; - return out_of_line_wait_on_bit_timeout(word, bit, - bit_wait_timeout, - mode, timeout); -} -#endif -#endif - -#if LINUX_VERSION_IS_LESS(4,13,0) -#define wait_queue_entry_t wait_queue_t - -#define wait_event_killable_timeout(wq_head, condition, timeout) \ -({ \ - long __ret = timeout; \ - might_sleep(); \ - if (!___wait_cond_timeout(condition)) \ - __ret = __wait_event_killable_timeout(wq_head, \ - condition, timeout); \ - __ret; \ -}) - -#define __wait_event_killable_timeout(wq_head, condition, timeout) \ - ___wait_event(wq_head, ___wait_cond_timeout(condition), \ - TASK_KILLABLE, 0, timeout, \ - __ret = schedule_timeout(__ret)) -#endif - -#endif /* __BACKPORT_LINUX_WAIT_H */ diff --git a/backport/backport-include/linux/watchdog.h b/backport/backport-include/linux/watchdog.h deleted file mode 100644 index 598c8c48..00000000 --- a/backport/backport-include/linux/watchdog.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __BACKPORT_WATCHDOG_H -#define __BACKPORT_WATCHDOG_H -#include_next <linux/watchdog.h> - -#if LINUX_VERSION_IS_LESS(3,1,0) -#define watchdog_device LINUX_BACKPORT(watchdog_device) -struct watchdog_device { -}; -#endif - -#endif /* __BACKPORT_WATCHDOG_H */ diff --git a/backport/backport-include/linux/workqueue.h b/backport/backport-include/linux/workqueue.h deleted file mode 100644 index ab68d217..00000000 --- a/backport/backport-include/linux/workqueue.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __BACKPORT_LINUX_WORKQUEUE_H -#define __BACKPORT_LINUX_WORKQUEUE_H -#include_next <linux/workqueue.h> -#include <linux/version.h> - -#if LINUX_VERSION_IS_LESS(3,7,0) -#define mod_delayed_work LINUX_BACKPORT(mod_delayed_work) -bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, - unsigned long delay); -#endif - -#ifndef create_freezable_workqueue -/* note freez_a_ble -> freez_ea_able */ -#define create_freezable_workqueue create_freezeable_workqueue -#endif - -#if LINUX_VERSION_IS_LESS(3,3,0) -#define __WQ_ORDERED 0 -/* - * commit b196be89cdc14a88cc637cdad845a75c5886c82d - * Author: Tejun Heo <tj@kernel.org> - * Date: Tue Jan 10 15:11:35 2012 -0800 - * - * workqueue: make alloc_workqueue() take printf fmt and args for name - */ -struct workqueue_struct * -backport_alloc_workqueue(const char *fmt, unsigned int flags, - int max_active, struct lock_class_key *key, - const char *lock_name, ...); -#undef alloc_workqueue -#ifdef CONFIG_LOCKDEP -#define alloc_workqueue(fmt, flags, max_active, args...) \ -({ \ - static struct lock_class_key __key; \ - const char *__lock_name; \ - \ - if (__builtin_constant_p(fmt)) \ - __lock_name = (fmt); \ - else \ - __lock_name = #fmt; \ - \ - backport_alloc_workqueue((fmt), (flags), (max_active), \ - &__key, __lock_name, ##args); \ -}) -#else -#define alloc_workqueue(fmt, flags, max_active, args...) \ - backport_alloc_workqueue((fmt), (flags), (max_active), \ - NULL, NULL, ##args) -#endif -#undef alloc_ordered_workqueue -#define alloc_ordered_workqueue(fmt, flags, args...) \ - alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) -#define destroy_workqueue backport_destroy_workqueue -void backport_destroy_workqueue(struct workqueue_struct *wq); -#endif - -#if LINUX_VERSION_IS_LESS(3,11,0) -/* power efficient workqueues were added in commit 0668106ca386. */ -#define system_power_efficient_wq system_wq -#define system_freezable_power_efficient_wq system_freezable_wq -#endif - -#if LINUX_VERSION_IS_LESS(3,1,0) -#define drain_workqueue(wq) flush_workqueue(wq) -#endif - -#endif /* __BACKPORT_LINUX_WORKQUEUE_H */ |