bindings: python: fix line request by name with multiple entries
authorChuang Zhu <git@chuang.cz>
Wed, 10 Jul 2024 12:57:18 +0000 (14:57 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 11 Jul 2024 11:25:00 +0000 (13:25 +0200)
commit237fd2c0597e720980023975250497d30aad1c12
tree3d17c898df406cc1a3d78d3b3c49a13c28727182
parent2515fae57d88e0f4e916e66e358912b9f98914dd
bindings: python: fix line request by name with multiple entries

When multiple entries are requested using line names in
Chip.request_lines(), only the the last entry is added to
LineRequest._name_map, causing a ValueError when trying to use functions
like LineRequest.set_value() on any former entries.

Move the required variables to the correct scope.

Signed-off-by: Chuang Zhu <git@chuang.cz>
[Bartosz: tweak the commit message]
Co-developed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240710125719.33655-2-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/gpiod/chip.py