]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: Move freeing of GPIO hogs before numbing of the device
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 19 Dec 2016 17:29:23 +0000 (18:29 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 30 Dec 2016 08:11:21 +0000 (09:11 +0100)
commit1e40b6ed0187adf5de93951c3d5102e9258c12ec
tree24980a445854a503bc22cdd753e5ed295b81dfef
parent66b459e5f9d4e2dda1394d084ce701240f149421
gpio: Move freeing of GPIO hogs before numbing of the device

When removing a gpiochip that uses GPIO hogging (e.g. by unloading the
chip's DT overlay), a warning is printed:

    gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED

This happens because gpiochip_free_hogs() is called after the gdev->chip
pointer is reset to NULL. Hence __gpiod_free() cannot determine the
chip in use, and cannot clear flags nor call the optional chip-specific
.free() callback.

Move the call to gpiochip_free_hogs() up to fix this.

Cc: stable@vger.kernel.org
Fixes: 69f44c88a7243157 ("gpio: make the gpiochip a real device")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c