Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
"Some GPIO fixes for the v4.4 series. Most prominent: I revert the
error propagation from the .get() function until we can fix up all the
drivers properly for v4.5.

- Revert the error number propagation from the .get() vtable entry
temporarily, until we make the proper fixes to all drivers.
- Fix the clamping behaviour in the generic GPIO driver.
- Driver fix for the ath79 driver"

* tag 'gpio-v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: revert get() to non-errorprogating behaviour
gpio: generic: clamp values from bgpio_get_set()
gpio: ath79: Fix the logic to clear offset bit of AR71XX_GPIO_REG_OE register

+10 -4
+1 -1
drivers/gpio/gpio-ath79.c
··· 113 113 __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR); 114 114 115 115 __raw_writel( 116 - __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & BIT(offset), 116 + __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & ~BIT(offset), 117 117 ctrl->base + AR71XX_GPIO_REG_OE); 118 118 119 119 spin_unlock_irqrestore(&ctrl->lock, flags);
+2 -2
drivers/gpio/gpio-generic.c
··· 141 141 unsigned long pinmask = bgc->pin2mask(bgc, gpio); 142 142 143 143 if (bgc->dir & pinmask) 144 - return bgc->read_reg(bgc->reg_set) & pinmask; 144 + return !!(bgc->read_reg(bgc->reg_set) & pinmask); 145 145 else 146 - return bgc->read_reg(bgc->reg_dat) & pinmask; 146 + return !!(bgc->read_reg(bgc->reg_dat) & pinmask); 147 147 } 148 148 149 149 static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
+7 -1
drivers/gpio/gpiolib.c
··· 1279 1279 chip = desc->chip; 1280 1280 offset = gpio_chip_hwgpio(desc); 1281 1281 value = chip->get ? chip->get(chip, offset) : -EIO; 1282 - value = value < 0 ? value : !!value; 1282 + /* 1283 + * FIXME: fix all drivers to clamp to [0,1] or return negative, 1284 + * then change this to: 1285 + * value = value < 0 ? value : !!value; 1286 + * so we can properly propagate error codes. 1287 + */ 1288 + value = !!value; 1283 1289 trace_gpio_value(desc_to_gpio(desc), 1, value); 1284 1290 return value; 1285 1291 }