From patchwork Sun Dec 2 19:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10708167 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4DDD1057 for ; Sun, 2 Dec 2018 19:36:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C29422A565 for ; Sun, 2 Dec 2018 19:36:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B23732A7D2; Sun, 2 Dec 2018 19:36:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DB422A565 for ; Sun, 2 Dec 2018 19:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725710AbeLBTgZ (ORCPT ); Sun, 2 Dec 2018 14:36:25 -0500 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 Received: by mail-wm1-f65.google.com with SMTP id f81so1198353wmd.4; Sun, 02 Dec 2018 11:36:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nkuB02GkiM4jxxfXBnaipNvn1+Km/8PH+sFIn91MA3A=; b=RHCkSeIedhvEpfQSbi+sWd8okqwHWHZPJMIPyoyle2xJ6MoxxNh45B2MyBKuLRdH0c XadqANndADFH1gXpTxBdKmWgkCMVx6J5rmNhHLAt/enXyHfoFfIEYYw5e2O/uVDnIw3/ j5beZrTPvT5WZyhIQgv4WEDWqjfYfpKMFHLbwa6Ivg01uZYThvdEkLOQC4SopBUIIw+p /A5QekugVU+0Wjbj0oY75+Mr4zCoPFkIIvBVCVcMt/ae9m9PQmmoOdtCQELg4dJkRBJ+ QUjboix/E2QAfbKYdH14BsLv44KXeAWw0wQGe2b9/Dzjll1JwN85FQVx4BIFuF2F5hlm qEoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nkuB02GkiM4jxxfXBnaipNvn1+Km/8PH+sFIn91MA3A=; b=bEqqDmBUkI30KG97GDTujnJZi2Qjrf6cNzh4H8+cQ2eOtcU85ctaQe67gsl7mIrBQ7 NQAyzzV+4nQrw/rcOvxlT3AMYyfsjoZnyaqnMQB7C50OGHTD4i+ztPX36Mx+VNY/SJbQ VPsdUatK9g+yR35c/sWaEz+aJBPy+aU2NZympin+FbSC6vFzDnNuE/jfQ5IblgX0R8y5 9NVVuSWyl+z/D3FbB/JUpZ1jndavRr2t7H+/LHGY/CifSbQ+JnhwGmZm9BIqMedb/g1n 3Srq4pJSgj0dww/f5Prd2EUfb7Bw+76uVzwRfIJV/FoTwYN5pOwT87HvSdw7TCc++zYD lBvw== X-Gm-Message-State: AA+aEWbbB1v+5qcLA+jv1vxtf6J4O6kd5y1boXdEP0yv2krFdLO4adgZ BTKoitIvJAe/znh9fdDvYOiKZzwM X-Google-Smtp-Source: AFSGD/XKdS/68xMFNPAHCwBUE7kxSyDybQ1XWyCFo6oXyEQ1H6rg8l9GSCZpCARzZafSqXak5BXfSA== X-Received: by 2002:a1c:5dd1:: with SMTP id r200mr6020098wmb.93.1543779379769; Sun, 02 Dec 2018 11:36:19 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id y185sm4016628wmg.34.2018.12.02.11.36.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 11:36:19 -0800 (PST) From: Marek Vasut X-Google-Original-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> X-Mailer: git-send-email 2.18.0 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 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;