gpio: pca953x: use the correct register address when regcache sync during init
[ Upstream commitb8c768ccdd] For regcache_sync_region, we need to use pca953x_recalc_addr() to get the real register address. Fixes:ec82d1eba3("gpio: pca953x: Zap ad-hoc reg_output cache") Fixes:0f25fda840("gpio: pca953x: Zap ad-hoc reg_direction cache") Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a941e6d5ba
commit
4752392855
@@ -896,15 +896,18 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
|
|||||||
static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
|
static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
|
||||||
{
|
{
|
||||||
DECLARE_BITMAP(val, MAX_LINE);
|
DECLARE_BITMAP(val, MAX_LINE);
|
||||||
|
u8 regaddr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = regcache_sync_region(chip->regmap, chip->regs->output,
|
regaddr = pca953x_recalc_addr(chip, chip->regs->output, 0);
|
||||||
chip->regs->output + NBANK(chip) - 1);
|
ret = regcache_sync_region(chip->regmap, regaddr,
|
||||||
|
regaddr + NBANK(chip) - 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = regcache_sync_region(chip->regmap, chip->regs->direction,
|
regaddr = pca953x_recalc_addr(chip, chip->regs->direction, 0);
|
||||||
chip->regs->direction + NBANK(chip) - 1);
|
ret = regcache_sync_region(chip->regmap, regaddr,
|
||||||
|
regaddr + NBANK(chip) - 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user