gpio: reinforce desc->flags handling
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 23 Jan 2024 13:26:09 +0000 (14:26 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 12 Feb 2024 09:50:49 +0000 (10:50 +0100)
commit2559f2e09211dd4a5fde5bc5749ef4714fe38f7f
treeb07eed30136fa34cf596e9c5783c0ecaeb83d78b
parent35b545332b809a439aa1bf3fde5305e6eb243cf0
gpio: reinforce desc->flags handling

We now removed the gpio_lock spinlock and modified the places
previously protected by it to handle desc->flags access in a consistent
way. Let's improve other places that were previously unprotected by
reading the flags field of gpio_desc once and using the stored value for
logic consistency. If we need to modify the field, let's also write it
back once with a consistent value resulting from the function's logic.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpiolib.c