From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f65.google.com ([209.85.128.65]:39114 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbeLBTgZ (ORCPT ); Sun, 2 Dec 2018 14:36:25 -0500 From: Marek Vasut To: linux-gpio@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Linus Walleij , Bartosz Golaszewski Subject: [PATCH 08/14] gpio: pca953x: Zap ad-hoc I2C block write in multi GPIO set Date: Sun, 2 Dec 2018 20:35:47 +0100 Message-Id: <20181202193553.29704-8-marek.vasut+renesas@gmail.com> In-Reply-To: <20181202193553.29704-1-marek.vasut+renesas@gmail.com> References: <20181202193553.29704-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org List-ID: The ad-hoc i2c block write can be replaced by standard register accessor function, which correctly handles all the chip details and differences. Do so to simplify the code. Signed-off-by: Marek Vasut Cc: Linus Walleij Cc: Bartosz Golaszewski --- drivers/gpio/gpio-pca953x.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index dc691bd52a79..b3386819c550 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -364,8 +364,6 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, unsigned long *bits) { struct pca953x_chip *chip = gpiochip_get_data(gc); - int bank_shift = pca953x_bank_shift(chip); - u32 regaddr = chip->regs->output << bank_shift; unsigned int bank_mask, bank_val; int bank; u8 reg_val[MAX_BANK]; @@ -384,14 +382,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, } } - /* PCA9575 needs address-increment on multi-byte writes */ - if ((PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) && - (NBANK(chip) > 1)) { - regaddr |= REG_ADDR_AI; - } - - ret = i2c_smbus_write_i2c_block_data(chip->client, regaddr, - NBANK(chip), reg_val); + ret = pca953x_write_regs(chip, chip->regs->output, reg_val); if (ret) goto exit; -- 2.18.0