diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-01-05 13:12:45 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-12 10:50:24 +0100 |
commit | 8ce6fd81a452d554889874e50cd34e92cf4547d6 (patch) | |
tree | d9c67f4a4f4f6471450bc7777cb26ad722926547 /drivers/gpio/gpiolib.c | |
parent | e348544f7994d252427ed3ae637c7081cbb90f66 (diff) | |
download | lwn-8ce6fd81a452d554889874e50cd34e92cf4547d6.tar.gz lwn-8ce6fd81a452d554889874e50cd34e92cf4547d6.zip |
gpio: of: assign and read the hog pointer atomically
The device nodes representing GPIO hogs cannot be deleted without
unregistering the GPIO chip so there's no need to serialize their access.
However we must ensure that users can get the right address so write and
read it atomically.
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>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a5598c3299ff..03d7c3f92f5e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2330,7 +2330,7 @@ static bool gpiod_free_commit(struct gpio_desc *desc) clear_bit(FLAG_EDGE_FALLING, &desc->flags); clear_bit(FLAG_IS_HOGGED, &desc->flags); #ifdef CONFIG_OF_DYNAMIC - desc->hog = NULL; + WRITE_ONCE(desc->hog, NULL); #endif ret = true; } |