forked from Minki/linux
GPIO fixes for the v4.4 series:
- 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWdUHfAAoJEEEQszewGV1zN3IP/1t/w6sOIugibcyLTq5EpL1X 0fndqaqoRunZdFpeauTujq4hXXhRDtZdqzcSNWMg5Xelq0ROHIRLeEcX1GEQlROM t9IfNmsxbso0N02ii4NC5F+jaKitnqeV+ZSzGekQjvTxvF3zJ0EaL/I0dNoImXEl K6gX36R31DEoxSabRXJrwfUfJFEfDjtriP4m8GTxt/Nd51QcE1WRpDusXK8smuga UaiZsnb0VzuM4QzZ1BvSFafBk6UpYU0245H1pYlPPcQRIkabZTuBQsEWrcLHAtDX AjuSqBy/PNYXGEzOVVnv2LETYAhC9KR+t2xXpT9QOXIiAD1XSk1n+UV0doJY22ZW x02ZTZiurllby/uuTOH7s3ZZ/NNmwoZK16d4F65qrU74fRvuc/9NeODKiizHXn3a +Z9s1dmRedHe8Q2eN/GLUCOHWZBHGj8kJVEgh1Oi1kaFVnP3GXBAeEEEnmZyrRJR BRKCQa8LWpXusJPhMsIrPK1M4FyAMFG1EFdq10cvag7UOamIpbK6q3/CIsSD8e1N FYcBGAOBMhdtyjAd3DXJXUsDqQ8aRL/LZ8hH1epsATiIvrkzHC10/erxSzA2cWtB URe+oatMGXgS8fQCaqyXZiA7gzxUNePXV3QBPvwWEo/OysnO49280owndACYnCMT de1R0SvltXC9GzXYVT5t =bPar -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
d525c13e9e
@ -113,7 +113,7 @@ static int ar934x_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
|
||||
__raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR);
|
||||
|
||||
__raw_writel(
|
||||
__raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & BIT(offset),
|
||||
__raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & ~BIT(offset),
|
||||
ctrl->base + AR71XX_GPIO_REG_OE);
|
||||
|
||||
spin_unlock_irqrestore(&ctrl->lock, flags);
|
||||
|
@ -141,9 +141,9 @@ static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio)
|
||||
unsigned long pinmask = bgc->pin2mask(bgc, gpio);
|
||||
|
||||
if (bgc->dir & pinmask)
|
||||
return bgc->read_reg(bgc->reg_set) & pinmask;
|
||||
return !!(bgc->read_reg(bgc->reg_set) & pinmask);
|
||||
else
|
||||
return bgc->read_reg(bgc->reg_dat) & pinmask;
|
||||
return !!(bgc->read_reg(bgc->reg_dat) & pinmask);
|
||||
}
|
||||
|
||||
static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
|
||||
|
@ -1279,7 +1279,13 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc)
|
||||
chip = desc->chip;
|
||||
offset = gpio_chip_hwgpio(desc);
|
||||
value = chip->get ? chip->get(chip, offset) : -EIO;
|
||||
value = value < 0 ? value : !!value;
|
||||
/*
|
||||
* FIXME: fix all drivers to clamp to [0,1] or return negative,
|
||||
* then change this to:
|
||||
* value = value < 0 ? value : !!value;
|
||||
* so we can properly propagate error codes.
|
||||
*/
|
||||
value = !!value;
|
||||
trace_gpio_value(desc_to_gpio(desc), 1, value);
|
||||
return value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user