gpio: sim: quietly ignore configured lines outside the bank
authorKent Gibson <warthog618@gmail.com>
Wed, 7 Jun 2023 06:50:04 +0000 (14:50 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 7 Jun 2023 12:49:35 +0000 (14:49 +0200)
commitd7459efc9276a715fe9def401bc30045aeb9668a
tree73c43df469d6a3c197245ee04d93c1fac86915b7
parent95ae9979bfe3174c2ee8d64409c44532f2881907
gpio: sim: quietly ignore configured lines outside the bank

The user-space policy of the gpio-sim is that configuration for lines
with offsets outside the bounds of the corresponding bank is ignored,
but gpio-sim is still using that configuration when constructing the
sim.  In the case of named lines this results in temporarily allocating
space for names that are not used, and for hogs results in errors being
logged when the gpio-sim attempts to register the out of range hog with
gpiolib:

gpiochip_machine_hog: unable to get GPIO desc: -22

Add checks to filter out any line configuration outside the bounds
of the bank when constructing the sim.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-sim.c