kernel: bump 4.14 to 4.14.178
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.14 / 950-0280-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch
1 From aeb94070e992a60cf33f0300c8317b39e3ae16db Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 24 Apr 2018 14:42:27 +0100
4 Subject: [PATCH 280/454] gpiolib: Don't prevent IRQ usage of output GPIOs
5
6 Upstream Linux deems using output GPIOs to generate IRQs as a bogus
7 use case, even though the BCM2835 GPIO controller is capable of doing
8 so. A number of users would like to make use of this facility, so
9 disable the checks.
10
11 See: https://github.com/raspberrypi/linux/issues/2527
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
15 drivers/gpio/gpiolib.c | 6 ++++--
16 1 file changed, 4 insertions(+), 2 deletions(-)
17
18 --- a/drivers/gpio/gpiolib.c
19 +++ b/drivers/gpio/gpiolib.c
20 @@ -53,6 +53,8 @@
21 #define extra_checks 0
22 #endif
23
24 +#define dont_test_bit(b,d) (0)
25 +
26 /* Device and char device-related information */
27 static DEFINE_IDA(gpio_ida);
28 static dev_t gpio_devt;
29 @@ -2306,7 +2308,7 @@ static int _gpiod_direction_output_raw(s
30 int ret;
31
32 /* GPIOs used for IRQs shall not be set as output */
33 - if (test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
34 + if (dont_test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
35 gpiod_err(desc,
36 "%s: tried to set a GPIO tied to an IRQ as output\n",
37 __func__);
38 @@ -2832,7 +2834,7 @@ int gpiochip_lock_as_irq(struct gpio_chi
39 set_bit(FLAG_IS_OUT, &desc->flags);
40 }
41
42 - if (test_bit(FLAG_IS_OUT, &desc->flags)) {
43 + if (dont_test_bit(FLAG_IS_OUT, &desc->flags)) {
44 chip_err(chip,
45 "%s: tried to flag a GPIO set as output for IRQ\n",
46 __func__);