kernel_samsung_a53x/drivers/gpio
Kent Gibson 4dff4c7e40 gpiolib: cdev: Disallow reconfiguration without direction (uAPI v1)
[ Upstream commit 9919cce62f68e6ab68dc2a975b5dc670f8ca7d40 ]

linehandle_set_config() behaves badly when direction is not set.
The configuration validation is borrowed from linehandle_create(), where,
to verify the intent of the user, the direction must be set to in order
to effect a change to the electrical configuration of a line. But, when
applied to reconfiguration, that validation does not allow for the unset
direction case, making it possible to clear flags set previously without
specifying the line direction.

Adding to the inconsistency, those changes are not immediately applied by
linehandle_set_config(), but will take effect when the line value is next
get or set.

For example, by requesting a configuration with no flags set, an output
line with GPIOHANDLE_REQUEST_ACTIVE_LOW and GPIOHANDLE_REQUEST_OPEN_DRAIN
requested could have those flags cleared, inverting the sense of the line
and changing the line drive to push-pull on the next line value set.

Ensure the intent of the user by disallowing configurations which do not
have direction set, returning an error to userspace to indicate that the
configuration is invalid.

And, for clarity, use lflags, a local copy of gcnf.flags, throughout when
dealing with the requested flags, rather than a mixture of both.

Fixes: e588bb1eae31 ("gpio: add new SET_CONFIG ioctl() to gpio chardev")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240626052925.174272-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 14:19:33 +01:00
..
gpio-74x164.c gpio: 74x164: Enable output pins after registers are reset 2024-11-18 23:18:30 +01:00
gpio-74xx-mmio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-104-dio-48e.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-104-idi-48.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-104-idio-16.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-adnp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-adp5520.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-adp5588.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-aggregator.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-altera-a10sr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-altera.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-amd-fch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-amd8111.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-amdpt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-arizona.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-aspeed-sgpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-aspeed.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ath79.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-bcm-kona.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-bd9571mwv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-bd70528.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-bd71828.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-brcmstb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-bt8xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-cadence.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-clps711x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-creg-snps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-crystalcove.c gpio: crystalcove: Use -ENOTSUPP consistently 2024-11-19 11:32:45 +01:00
gpio-cs5535.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-da9052.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-da9055.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-davinci.c gpio: davinci: Validate the obtained number of IRQs 2024-11-19 14:19:33 +01:00
gpio-dln2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-dwapb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-eic-sprd.c gpio: eic-sprd: Clear interrupt after set the interrupt type 2024-11-18 12:13:07 +01:00
gpio-em.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ep93xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-exar.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-f7188x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ftgpio010.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ge.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-gpio-mm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-grgpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-gw-pld.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-hlwd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-htc-egpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ich.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-intel-mid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-iop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-it87.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ixp4xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-janz-ttl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-kempld.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-logicvc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-loongson.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-loongson1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-lp873x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-lp3943.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-lp87565.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-lpc18xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-lpc32xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-madera.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max730x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max732x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max3191x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max7300.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max7301.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max77620.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-max77650.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mb86s7x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mc9s08dz60.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mc33880.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-menz127.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-merrifield.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ml-ioh.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mlxbf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mlxbf2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mm-lantiq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mmio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mockup.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-moxtet.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mpc8xxx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mpc5200.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-msic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mt7621.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mvebu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mxc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-mxs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-octeon.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-omap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-palmas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pca953x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pca9570.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pcf857x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pci-idio-16.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pcie-idio-24.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pisosr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pl061.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pmic-eic-sprd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-pxa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-raspberrypi-exp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-rc5t583.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-rcar.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-rda.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-rdc321x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-reg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-regmap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sa1100.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sama5d2-piobu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sch311x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sifive.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-siox.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sl28cpld.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sodaville.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-spear-spics.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sprd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-sta2x11.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-stmpe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-stp-xway.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-syscon.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tb10x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tc3589x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tegra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tegra186.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-thunderx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-timberdale.c gpio: timberdale: Fix potential deadlock on &tgpio->lock 2024-11-08 11:26:16 +01:00
gpio-tpic2810.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps6586x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps65086.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps65218.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps65910.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps65912.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tps68470.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-tqmx86.c gpio: tqmx86: store IRQ trigger type and unmask status separately 2024-11-19 14:19:03 +01:00
gpio-ts4800.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ts4900.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ts5500.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-twl4030.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-twl6040.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ucb1400.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-uniphier.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-vf610.c gpio: vf610: set value before the direction to avoid a glitch 2024-11-08 11:26:20 +01:00
gpio-viperboard.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-vr41xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-vx855.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-wcd934x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-wcove.c gpio: wcove: Use -ENOTSUPP consistently 2024-11-19 11:32:45 +01:00
gpio-winbond.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-wm831x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-wm8350.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-wm8994.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-ws16c48.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xgene-sb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xgene.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xgs-iproc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xilinx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xlp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xra1403.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-xtensa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-zevio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-zx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpio-zynq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-acpi.c gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04 2024-11-18 12:13:02 +01:00
gpiolib-acpi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-cdev.c gpiolib: cdev: Disallow reconfiguration without direction (uAPI v1) 2024-11-19 14:19:33 +01:00
gpiolib-cdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-devres.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-legacy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-of.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib-sysfs.c gpiolib: sysfs: Fix error handling on failed export 2024-11-18 12:11:45 +01:00
gpiolib-sysfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gpiolib.c gpio: fix resource unwinding order in error path 2024-11-18 23:18:30 +01:00
gpiolib.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig gpio: tqmx86: fix typo in Kconfig label 2024-11-19 14:19:02 +01:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
TODO Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00