linux/drivers/gpio
Linus Walleij 07c7b6a525 gpio: mmio: Also read bits that are zero
The code for .get_multiple() has bugs:

1. The simple .get_multiple() just reads a register, masks it
and sets the return value. This is not correct: we only want to
assign values (whether 0 or 1) to the bits that are set in the
mask. Fix this by using &= ~mask to clear all bits in the mask
and then |= val & mask to set the corresponding bits from the
read.

2. The bgpio_get_multiple_be() call has a similar problem: it
uses the |= operator to set the bits, so only the bits in the
mask are affected, but it misses to clear all returned bits
from the mask initially, so some bits will be returned
erroneously set to 1.

3. The bgpio_get_set_multiple() again fails to clear the bits
from the mask.

4. find_next_bit() wasn't handled correctly, use a totally
different approach for one function and change the other
function to follow the design pattern of assigning the first
bit to -1, then use bit + 1 in the for loop and < num_iterations
as break condition.

Fixes: 80057cb417 ("gpio-mmio: Use the new .get_multiple() callback")
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Reported-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Tested-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reported-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-01-16 23:42:36 +01:00
..
devres.c
gpio-74x164.c gpio: 74x164: Fix crash during .remove() 2017-11-30 15:31:14 +01:00
gpio-74xx-mmio.c
gpio-104-dio-48e.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-104-idi-48.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-104-idio-16.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-adnp.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-adp5520.c
gpio-adp5588.c
gpio-altera-a10sr.c
gpio-altera.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-amd8111.c
gpio-amdpt.c
gpio-arizona.c
gpio-aspeed.c Merge branch 'gpio-irqchip-rework' of /home/linus/linux-gpio into devel 2017-11-09 09:38:42 +01:00
gpio-ath79.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-axp209.c
gpio-bcm-kona.c kernel/irq: Extend lockdep class for request mutex 2017-12-28 12:26:35 +01:00
gpio-bd9571mwv.c
gpio-brcmstb.c gpio: brcmstb: Make really use of the new lockdep class 2017-12-29 16:37:09 +01:00
gpio-bt8xx.c
gpio-clps711x.c
gpio-crystalcove.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-cs5535.c
gpio-da9052.c
gpio-da9055.c
gpio-davinci.c gpio: davinci: Assign first bank regs for unbanked case 2017-11-30 15:40:01 +01:00
gpio-dln2.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-dwapb.c
gpio-em.c
gpio-ep93xx.c
gpio-etraxfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gpio-exar.c
gpio-f7188x.c
gpio-ftgpio010.c This is the bulk of GPIO changes for the v4.15 kernel cycle: 2017-11-14 17:23:44 -08:00
gpio-ge.c
gpio-gpio-mm.c
gpio-grgpio.c
gpio-htc-egpio.c
gpio-ich.c
gpio-ingenic.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-intel-mid.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-iop.c
gpio-it87.c
gpio-janz-ttl.c
gpio-kempld.c
gpio-ks8695.c
gpio-loongson.c
gpio-loongson1.c
gpio-lp873x.c
gpio-lp3943.c
gpio-lp87565.c
gpio-lpc18xx.c
gpio-lpc32xx.c
gpio-lynxpoint.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-max730x.c
gpio-max732x.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-max3191x.c
gpio-max7300.c
gpio-max7301.c
gpio-max77620.c
gpio-mb86s7x.c gpio: mb86s70: Revert "Return error if requesting an already assigned gpio" 2017-10-31 13:13:34 +01:00
gpio-mc9s08dz60.c
gpio-mc33880.c
gpio-menz127.c
gpio-merrifield.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-ml-ioh.c
gpio-mm-lantiq.c
gpio-mmio.c gpio: mmio: Also read bits that are zero 2018-01-16 23:42:36 +01:00
gpio-mockup.c
gpio-mpc8xxx.c
gpio-mpc5200.c
gpio-msic.c
gpio-mvebu.c
gpio-mxc.c
gpio-mxs.c
gpio-octeon.c
gpio-omap.c This is the bulk of GPIO changes for the v4.15 kernel cycle: 2017-11-14 17:23:44 -08:00
gpio-palmas.c
gpio-pca953x.c gpio: pca953x: fix vendor prefix for PCA9654 2017-12-02 22:41:43 +01:00
gpio-pcf857x.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-pch.c
gpio-pci-idio-16.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-pisosr.c
gpio-pl061.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-pxa.c
gpio-rc5t583.c
gpio-rcar.c Merge branch 'gpio-irqchip-rework' of /home/linus/linux-gpio into devel 2017-11-09 09:38:42 +01:00
gpio-rdc321x.c
gpio-reg.c gpio: gpio-reg: fix build 2017-12-22 15:24:31 +01:00
gpio-sa1100.c
gpio-sch.c
gpio-sch311x.c
gpio-sodaville.c
gpio-spear-spics.c
gpio-sta2x11.c
gpio-stmpe.c gpio: Move irq_valid_mask into struct gpio_irq_chip 2017-11-08 14:10:18 +01:00
gpio-stp-xway.c
gpio-syscon.c
gpio-tb10x.c
gpio-tc3589x.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-tegra.c kernel/irq: Extend lockdep class for request mutex 2017-12-28 12:26:35 +01:00
gpio-tegra186.c gpio: tegra186: Remove tegra186_gpio_lock_class 2017-11-13 11:43:10 +01:00
gpio-thunderx.c
gpio-timberdale.c
gpio-tpic2810.c
gpio-tps6586x.c
gpio-tps65086.c
gpio-tps65218.c
gpio-tps65910.c
gpio-tps65912.c
gpio-tps68470.c
gpio-ts4800.c
gpio-ts4900.c
gpio-ts5500.c
gpio-twl4030.c
gpio-twl6040.c
gpio-tz1090-pdc.c
gpio-tz1090.c
gpio-ucb1400.c
gpio-uniphier.c This is the bulk of GPIO changes for the v4.15 kernel cycle: 2017-11-14 17:23:44 -08:00
gpio-vf610.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-viperboard.c
gpio-vr41xx.c
gpio-vx855.c
gpio-wcove.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-wm831x.c
gpio-wm8350.c
gpio-wm8994.c
gpio-ws16c48.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-xgene-sb.c genirq/irqdomain: Rename early argument of irq_domain_activate_irq() 2017-12-29 21:13:04 +01:00
gpio-xgene.c
gpio-xilinx.c
gpio-xlp.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-xra1403.c
gpio-xtensa.c
gpio-zevio.c
gpio-zx.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-zynq.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpiolib-acpi.c gpio: fix "gpio-line-names" property retrieval 2017-12-22 15:24:31 +01:00
gpiolib-devprop.c gpio: fix "gpio-line-names" property retrieval 2017-12-22 15:24:31 +01:00
gpiolib-legacy.c
gpiolib-of.c gpio: fix "gpio-line-names" property retrieval 2017-12-22 15:24:31 +01:00
gpiolib-sysfs.c
gpiolib.c gpio: Add missing open drain/source handling to gpiod_set_value_cansleep() 2018-01-10 14:17:17 +01:00
gpiolib.h gpio: fix "gpio-line-names" property retrieval 2017-12-22 15:24:31 +01:00
Kconfig This is the bulk of pin control changes for the v4.15 2017-11-16 10:57:11 -08:00
Makefile This is the bulk of GPIO changes for the v4.15 kernel cycle: 2017-11-14 17:23:44 -08:00