From: Hauke Mehrtens Date: Sat, 26 Jul 2014 19:37:03 +0000 (+0200) Subject: backports: fix bit_wait() and bit_wait_io() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4194956a6c8a36cfccc53207470412d7fa12bb36;p=openwrt%2Fstaging%2Fblogic.git backports: fix bit_wait() and bit_wait_io() In kernel version < 3.17 wait_on_bit() takes an action as a parameter, which contains a schedule() or io_schedule() call in most cases. For such calls wait_on_bit() was changed to not take an action but execute schedule() action. This patch backports the new behavior to old kernel versions. Signed-off-by: Hauke Mehrtens --- diff --git a/backport/backport-include/linux/wait.h b/backport/backport-include/linux/wait.h new file mode 100644 index 000000000000..dfb111dbab8a --- /dev/null +++ b/backport/backport-include/linux/wait.h @@ -0,0 +1,26 @@ +#ifndef __BACKPORT_LINUX_WAIT_H +#define __BACKPORT_LINUX_WAIT_H +#include_next + +#if LINUX_VERSION_CODE < KERNEL_VERSION(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 + +#endif /* __BACKPORT_LINUX_WAIT_H */ diff --git a/backport/compat/Makefile b/backport/compat/Makefile index 353a71dc9fa0..d648982983b1 100644 --- a/backport/compat/Makefile +++ b/backport/compat/Makefile @@ -18,6 +18,7 @@ compat-$(CPTCFG_BACKPORT_KERNEL_3_12) += backport-3.12.o compat-$(CPTCFG_BACKPORT_KERNEL_3_13) += backport-3.13.o compat-$(CPTCFG_BACKPORT_KERNEL_3_14) += backport-3.14.o compat-$(CPTCFG_BACKPORT_KERNEL_3_15) += backport-3.15.o +compat-$(CPTCFG_BACKPORT_KERNEL_3_17) += backport-3.17.o compat-$(CPTCFG_BACKPORT_BUILD_CRYPTO_CCM) += crypto-ccm.o compat-$(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS) += dma-shared-helpers.o diff --git a/backport/compat/backport-3.17.c b/backport/compat/backport-3.17.c new file mode 100644 index 000000000000..9cc0a82fe6e0 --- /dev/null +++ b/backport/compat/backport-3.17.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014 Hauke Mehrtens + * + * Backport functionality introduced in Linux 3.17. + * + * 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. + */ +#include +#include +#include + +int bit_wait(void *word) +{ + schedule(); + return 0; +} +EXPORT_SYMBOL_GPL(bit_wait); + +int bit_wait_io(void *word) +{ + io_schedule(); + return 0; +} +EXPORT_SYMBOL_GPL(bit_wait_io); +