Skip to content

Commit 015b7da

Browse files
author
Bartosz Golaszewski
committed
gpio: sim: lock hog configfs items if present
Depending on the user config, the leaf entry may be the hog directory, not line. Check it and lock the correct item. Fixes: 8bd76b3 ("gpio: sim: lock up configfs that an instantiated device depends on") Tested-by: Koichiro Den <koichiro.den@canonical.com> Link: https://lore.kernel.org/r/20250203110123.87701-1-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent d6179f6 commit 015b7da

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/gpio/gpio-sim.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,20 +1028,23 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)
10281028
struct configfs_subsystem *subsys = dev->group.cg_subsys;
10291029
struct gpio_sim_bank *bank;
10301030
struct gpio_sim_line *line;
1031+
struct config_item *item;
10311032

10321033
/*
1033-
* The device only needs to depend on leaf line entries. This is
1034+
* The device only needs to depend on leaf entries. This is
10341035
* sufficient to lock up all the configfs entries that the
10351036
* instantiated, alive device depends on.
10361037
*/
10371038
list_for_each_entry(bank, &dev->bank_list, siblings) {
10381039
list_for_each_entry(line, &bank->line_list, siblings) {
1040+
item = line->hog ? &line->hog->item
1041+
: &line->group.cg_item;
1042+
10391043
if (lock)
1040-
WARN_ON(configfs_depend_item_unlocked(
1041-
subsys, &line->group.cg_item));
1044+
WARN_ON(configfs_depend_item_unlocked(subsys,
1045+
item));
10421046
else
1043-
configfs_undepend_item_unlocked(
1044-
&line->group.cg_item);
1047+
configfs_undepend_item_unlocked(item);
10451048
}
10461049
}
10471050
}

0 commit comments

Comments
 (0)