aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorSai Kumar Cholleti <[email protected]>2024-11-05 07:15:23 +0000
committerBartosz Golaszewski <[email protected]>2024-11-21 08:08:47 +0000
commit72cef64180de04a7b055b4773c138d78f4ebdb77 (patch)
tree73b992b281932e461b5e0608bc0de761f6c6a356 /security/selinux/hooks.c
parentgpio: altera: Add missed base and label initialisations (diff)
downloadkernel-72cef64180de04a7b055b4773c138d78f4ebdb77.tar.gz
kernel-72cef64180de04a7b055b4773c138d78f4ebdb77.zip
gpio: exar: set value when external pull-up or pull-down is present
Setting GPIO direction = high, sometimes results in GPIO value = 0. If a GPIO is pulled high, the following construction results in the value being 0 when the desired value is 1: $ echo "high" > /sys/class/gpio/gpio336/direction $ cat /sys/class/gpio/gpio336/value 0 Before the GPIO direction is changed from an input to an output, exar_set_value() is called with value = 1, but since the GPIO is an input when exar_set_value() is called, _regmap_update_bits() reads a 1 due to an external pull-up. regmap_set_bits() sets force_write = false, so the value (1) is not written. When the direction is then changed, the GPIO becomes an output with the value of 0 (the hardware default). regmap_write_bits() sets force_write = true, so the value is always written by exar_set_value() and an external pull-up doesn't affect the outcome of setting direction = high. The same can happen when a GPIO is pulled low, but the scenario is a little more complicated. $ echo high > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 1 $ echo in > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 0 $ echo low > /sys/class/gpio/gpio351/direction $ cat /sys/class/gpio/gpio351/value 1 Fixes: 36fb7218e878 ("gpio: exar: switch to using regmap") Co-developed-by: Matthew McClain <[email protected]> Signed-off-by: Matthew McClain <[email protected]> Signed-off-by: Sai Kumar Cholleti <[email protected]> Cc: [email protected] Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
Diffstat (limited to 'security/selinux/hooks.c')
0 files changed, 0 insertions, 0 deletions