]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.10.79/gpio-unregister-gpiochip-device-before-removing-it.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.10.79 / gpio-unregister-gpiochip-device-before-removing-it.patch
1 From 01cca93a9491ed95992523ff7e79dd9bfcdea8e0 Mon Sep 17 00:00:00 2001
2 From: Johan Hovold <johan@kernel.org>
3 Date: Mon, 12 Jan 2015 17:12:29 +0100
4 Subject: gpio: unregister gpiochip device before removing it
5
6 From: Johan Hovold <johan@kernel.org>
7
8 commit 01cca93a9491ed95992523ff7e79dd9bfcdea8e0 upstream.
9
10 Unregister gpiochip device (used to export information through sysfs)
11 before removing it internally. This way removal will reverse addition.
12
13 Signed-off-by: Johan Hovold <johan@kernel.org>
14 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17
18 ---
19 drivers/gpio/gpiolib.c | 5 ++---
20 1 file changed, 2 insertions(+), 3 deletions(-)
21
22 --- a/drivers/gpio/gpiolib.c
23 +++ b/drivers/gpio/gpiolib.c
24 @@ -1265,6 +1265,8 @@ int gpiochip_remove(struct gpio_chip *ch
25 int status = 0;
26 unsigned id;
27
28 + gpiochip_unexport(chip);
29 +
30 spin_lock_irqsave(&gpio_lock, flags);
31
32 gpiochip_remove_pin_ranges(chip);
33 @@ -1285,9 +1287,6 @@ int gpiochip_remove(struct gpio_chip *ch
34
35 spin_unlock_irqrestore(&gpio_lock, flags);
36
37 - if (status == 0)
38 - gpiochip_unexport(chip);
39 -
40 return status;
41 }
42 EXPORT_SYMBOL_GPL(gpiochip_remove);