Skip to contentSkip to conversation

Patch "gpio: Move freeing of GPIO hogs before numbing of the device" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 17, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

gpio: Move freeing of GPIO hogs before numbing of the device

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
gpio-move-freeing-of-gpio-hogs-before-numbing-of-the-device.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 5018ada69a04c8ac21d74bd682fceb8e42dc0f96 Mon Sep 17 00:00:00 2001

From: Geert Uytterhoeven <[email protected]>
Date: Mon, 19 Dec 2016 18:29:23 +0100
Subject: gpio: Move freeing of GPIO hogs before numbing of the device

From: Geert Uytterhoeven <[email protected]>

commit 5018ada69a04c8ac21d74bd682fceb8e42dc0f96 upstream.

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.

Fixes ff2b135922992756 ("gpio: make the gpiochip a real device")
---
 drivers/gpio/gpiolib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
@@ -1317,12 +1317,12 @@ void gpiochip_remove(struct gpio_chip *c
 
 	/* FIXME: should the legacy sysfs handling be moved to gpio_device? */
 	gpiochip_sysfs_unregister(gdev);
+	gpiochip_free_hogs(chip);
 	/* Numb the device, cancelling all outstanding operations */
 	gdev->chip = NULL;
 	gpiochip_irqchip_remove(chip);
 	acpi_gpiochip_remove(chip);
 	gpiochip_remove_pin_ranges(chip);
-	gpiochip_free_hogs(chip);
 	of_gpiochip_remove(chip);
 	/*
 	 * We accept no more calls into the driver from this point, so

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/gpio-move-freeing-of-gpio-hogs-before-numbing-of-the-device.patch