* [PATCH] gpio: sim: lock hog configfs items if present
@ 2025-02-03 11:01 Bartosz Golaszewski
2025-02-03 12:52 ` Koichiro Den
2025-02-05 13:39 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-02-03 11:01 UTC (permalink / raw)
To: Linus Walleij, Koichiro Den; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Depending on the user config, the leaf entry may be the hog directory,
not line. Check it and lock the correct item.
Fixes: 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-sim.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index a086087ada17..b843682b47e9 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -1028,6 +1028,7 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)
struct configfs_subsystem *subsys = dev->group.cg_subsys;
struct gpio_sim_bank *bank;
struct gpio_sim_line *line;
+ struct config_item *item;
/*
* The device only needs to depend on leaf line entries. This is
@@ -1036,12 +1037,14 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)
*/
list_for_each_entry(bank, &dev->bank_list, siblings) {
list_for_each_entry(line, &bank->line_list, siblings) {
+ item = line->hog ? &line->hog->item
+ : &line->group.cg_item;
+
if (lock)
- WARN_ON(configfs_depend_item_unlocked(
- subsys, &line->group.cg_item));
+ WARN_ON(configfs_depend_item_unlocked(subsys,
+ item));
else
- configfs_undepend_item_unlocked(
- &line->group.cg_item);
+ configfs_undepend_item_unlocked(item);
}
}
}
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] gpio: sim: lock hog configfs items if present
2025-02-03 11:01 [PATCH] gpio: sim: lock hog configfs items if present Bartosz Golaszewski
@ 2025-02-03 12:52 ` Koichiro Den
2025-02-05 13:39 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Koichiro Den @ 2025-02-03 12:52 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
On Mon, Feb 03, 2025 at 12:01:23PM GMT, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Depending on the user config, the leaf entry may be the hog directory,
> not line. Check it and lock the correct item.
>
> Fixes: 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/gpio/gpio-sim.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index a086087ada17..b843682b47e9 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -1028,6 +1028,7 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)
> struct configfs_subsystem *subsys = dev->group.cg_subsys;
> struct gpio_sim_bank *bank;
> struct gpio_sim_line *line;
> + struct config_item *item;
>
> /*
> * The device only needs to depend on leaf line entries. This is
> @@ -1036,12 +1037,14 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)
> */
> list_for_each_entry(bank, &dev->bank_list, siblings) {
> list_for_each_entry(line, &bank->line_list, siblings) {
> + item = line->hog ? &line->hog->item
> + : &line->group.cg_item;
> +
> if (lock)
> - WARN_ON(configfs_depend_item_unlocked(
> - subsys, &line->group.cg_item));
> + WARN_ON(configfs_depend_item_unlocked(subsys,
> + item));
> else
> - configfs_undepend_item_unlocked(
> - &line->group.cg_item);
> + configfs_undepend_item_unlocked(item);
> }
> }
> }
> --
> 2.45.2
>
Thanks for spotting this and the fix.
Tested-by: Koichiro Den <koichiro.den@canonical.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] gpio: sim: lock hog configfs items if present
2025-02-03 11:01 [PATCH] gpio: sim: lock hog configfs items if present Bartosz Golaszewski
2025-02-03 12:52 ` Koichiro Den
@ 2025-02-05 13:39 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-02-05 13:39 UTC (permalink / raw)
To: Linus Walleij, Koichiro Den, Bartosz Golaszewski
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Mon, 03 Feb 2025 12:01:23 +0100, Bartosz Golaszewski wrote:
> Depending on the user config, the leaf entry may be the hog directory,
> not line. Check it and lock the correct item.
>
>
Applied, thanks!
[1/1] gpio: sim: lock hog configfs items if present
commit: 015b7dae084fa95465ff89f6cbf15fe49906a370
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-05 13:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 11:01 [PATCH] gpio: sim: lock hog configfs items if present Bartosz Golaszewski
2025-02-03 12:52 ` Koichiro Den
2025-02-05 13:39 ` Bartosz Golaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.