* [PATCH] gpio: don't warn about removing GPIO chips with active users anymore
@ 2024-02-21 10:21 Bartosz Golaszewski
2024-02-21 10:36 ` Herve Codina
2024-02-23 8:58 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-02-21 10:21 UTC (permalink / raw)
To: Bartosz Golaszewski, Kent Gibson, Linus Walleij, Herve Codina
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpiolib.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3c22920bd201..63e793a410e3 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1106,7 +1106,6 @@ EXPORT_SYMBOL_GPL(gpiochip_add_data_with_key);
void gpiochip_remove(struct gpio_chip *gc)
{
struct gpio_device *gdev = gc->gpiodev;
- unsigned int i;
/* FIXME: should the legacy sysfs handling be moved to gpio_device? */
gpiochip_sysfs_unregister(gdev);
@@ -1130,15 +1129,6 @@ void gpiochip_remove(struct gpio_chip *gc)
*/
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:
* 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)
return ret;
}
-static bool gpiod_free_commit(struct gpio_desc *desc)
+static void gpiod_free_commit(struct gpio_desc *desc)
{
unsigned long flags;
- bool ret = false;
might_sleep();
@@ -2357,23 +2346,18 @@ static bool gpiod_free_commit(struct gpio_desc *desc)
#ifdef CONFIG_OF_DYNAMIC
WRITE_ONCE(desc->hog, NULL);
#endif
- ret = true;
desc_set_label(desc, NULL);
WRITE_ONCE(desc->flags, flags);
gpiod_line_state_notify(desc, GPIOLINE_CHANGED_RELEASED);
}
-
- return ret;
}
void gpiod_free(struct gpio_desc *desc)
{
VALIDATE_DESC_VOID(desc);
- if (!gpiod_free_commit(desc))
- WARN_ON(1);
-
+ gpiod_free_commit(desc);
module_put(desc->gdev->owner);
gpio_device_put(desc->gdev);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: don't warn about removing GPIO chips with active users anymore
2024-02-21 10:21 [PATCH] gpio: don't warn about removing GPIO chips with active users anymore Bartosz Golaszewski
@ 2024-02-21 10:36 ` Herve Codina
2024-02-23 8:58 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Herve Codina @ 2024-02-21 10:36 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Kent Gibson, Linus Walleij, linux-gpio, linux-kernel,
Bartosz Golaszewski
Hi Bartosz,
On Wed, 21 Feb 2024 11:21:03 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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: Kent Gibson <warthog618@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/gpio/gpiolib.c | 20 ++------------------
> 1 file changed, 2 insertions(+), 18 deletions(-)
>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: don't warn about removing GPIO chips with active users anymore
2024-02-21 10:21 [PATCH] gpio: don't warn about removing GPIO chips with active users anymore Bartosz Golaszewski
2024-02-21 10:36 ` Herve Codina
@ 2024-02-23 8:58 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-02-23 8:58 UTC (permalink / raw)
To: Bartosz Golaszewski, Kent Gibson, Linus Walleij, Herve Codina
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
On Wed, Feb 21, 2024 at 11:21 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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: Kent Gibson <warthog618@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
Patch applied.
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-23 8:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 10:21 [PATCH] gpio: don't warn about removing GPIO chips with active users anymore Bartosz Golaszewski
2024-02-21 10:36 ` Herve Codina
2024-02-23 8:58 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).