Commit 5d60c1e6 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: don't warn about removing GPIO chips with active users anymore

With SRCU we can now correctly handle the situation when a GPIO provider
is removed while having users still holding references to GPIO
descriptors. Remove all warnings emitted in this situation.
Suggested-by: default avatarKent Gibson <warthog618@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarHerve Codina <herve.codina@bootlin.com>
parent 840a97e2
...@@ -1106,7 +1106,6 @@ EXPORT_SYMBOL_GPL(gpiochip_add_data_with_key); ...@@ -1106,7 +1106,6 @@ EXPORT_SYMBOL_GPL(gpiochip_add_data_with_key);
void gpiochip_remove(struct gpio_chip *gc) void gpiochip_remove(struct gpio_chip *gc)
{ {
struct gpio_device *gdev = gc->gpiodev; struct gpio_device *gdev = gc->gpiodev;
unsigned int i;
/* FIXME: should the legacy sysfs handling be moved to gpio_device? */ /* FIXME: should the legacy sysfs handling be moved to gpio_device? */
gpiochip_sysfs_unregister(gdev); gpiochip_sysfs_unregister(gdev);
...@@ -1130,15 +1129,6 @@ void gpiochip_remove(struct gpio_chip *gc) ...@@ -1130,15 +1129,6 @@ void gpiochip_remove(struct gpio_chip *gc)
*/ */
gpiochip_set_data(gc, NULL); gpiochip_set_data(gc, NULL);
for (i = 0; i < gdev->ngpio; i++) {
if (test_bit(FLAG_REQUESTED, &gdev->descs[i].flags))
break;
}
if (i != gdev->ngpio)
dev_crit(&gdev->dev,
"REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
/* /*
* The gpiochip side puts its use of the device to rest here: * The gpiochip side puts its use of the device to rest here:
* if there are no userspace clients, the chardev and device will * if there are no userspace clients, the chardev and device will
...@@ -2329,10 +2319,9 @@ int gpiod_request(struct gpio_desc *desc, const char *label) ...@@ -2329,10 +2319,9 @@ int gpiod_request(struct gpio_desc *desc, const char *label)
return ret; return ret;
} }
static bool gpiod_free_commit(struct gpio_desc *desc) static void gpiod_free_commit(struct gpio_desc *desc)
{ {
unsigned long flags; unsigned long flags;
bool ret = false;
might_sleep(); might_sleep();
...@@ -2357,23 +2346,18 @@ static bool gpiod_free_commit(struct gpio_desc *desc) ...@@ -2357,23 +2346,18 @@ static bool gpiod_free_commit(struct gpio_desc *desc)
#ifdef CONFIG_OF_DYNAMIC #ifdef CONFIG_OF_DYNAMIC
WRITE_ONCE(desc->hog, NULL); WRITE_ONCE(desc->hog, NULL);
#endif #endif
ret = true;
desc_set_label(desc, NULL); desc_set_label(desc, NULL);
WRITE_ONCE(desc->flags, flags); WRITE_ONCE(desc->flags, flags);
gpiod_line_state_notify(desc, GPIOLINE_CHANGED_RELEASED); gpiod_line_state_notify(desc, GPIOLINE_CHANGED_RELEASED);
} }
return ret;
} }
void gpiod_free(struct gpio_desc *desc) void gpiod_free(struct gpio_desc *desc)
{ {
VALIDATE_DESC_VOID(desc); VALIDATE_DESC_VOID(desc);
if (!gpiod_free_commit(desc)) gpiod_free_commit(desc);
WARN_ON(1);
module_put(desc->gdev->owner); module_put(desc->gdev->owner);
gpio_device_put(desc->gdev); gpio_device_put(desc->gdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment