Dan Callaghan 207270dd0b gpiolib: hold gpio devices lock until ->descs array is initialised
If a driver consuming the GPIO chip is being probed at the same time as
the GPIO driver is registering the chip, it is possible for the
consuming driver to see the ->descs array in an uninitialised state.
For example, the gpio-keys-polled driver can fail like this:

    kernel: gpiod_request: invalid GPIO (no device)
    kernel: gpio-keys-polled PRP0001:07: failed to get gpio: -22
    kernel: gpio-keys-polled: probe of PRP0001:07 failed with error -22

This patch makes gpiochip_add() hold the lock protecting gpio_devices
until it has finished setting desc->gdev on the newly inserted list
entry.

Signed-off-by: Dan Callaghan <dan.callaghan@opengear.com>
Link: https://lore.kernel.org/r/20200121001216.15964-1-dan.callaghan@opengear.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-23 16:25:03 +01:00
..
2020-01-23 16:16:05 +01:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2018-05-16 14:35:24 +02:00
2020-01-15 11:24:19 +01:00
2019-11-07 09:27:48 +01:00
2019-09-03 16:04:19 +02:00
2020-01-17 08:59:29 +01:00
2020-01-17 08:59:29 +01:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2020-01-17 08:59:29 +01:00
2019-07-23 18:59:05 +03:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2019-11-07 09:27:48 +01:00
2020-01-15 13:45:01 +01:00
2019-11-07 09:27:48 +01:00
2018-01-09 14:51:00 +01:00
2019-11-07 09:27:48 +01:00
2019-12-09 10:40:18 +01:00
2019-12-17 13:06:31 -08:00
2020-01-07 13:53:39 +01:00
2020-01-17 08:59:29 +01:00
2020-01-09 03:01:33 +01:00