From patchwork Sun Dec 2 19:35:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10708177 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 723F113AD for ; Sun, 2 Dec 2018 19:36:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6467F2A565 for ; Sun, 2 Dec 2018 19:36:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58D012A7D2; Sun, 2 Dec 2018 19:36:29 +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 F2B692A565 for ; Sun, 2 Dec 2018 19:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725782AbeLBTgc (ORCPT ); Sun, 2 Dec 2018 14:36:32 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:33520 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbeLBTgb (ORCPT ); Sun, 2 Dec 2018 14:36:31 -0500 Received: by mail-wm1-f68.google.com with SMTP id r24so5446003wmh.0; Sun, 02 Dec 2018 11:36:27 -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=DtsjrG9yANleneNTtSwf6E0TwSfYMC9PLG2YS+3l1vo=; b=jyuwbB68i0TjXT4O+QjZ3qmeqbHXoPBpNEPk6vDYySwz34w3E8G9GjMHShZQRQRdTQ nHH9tJW/ZCknfljeG1JP+d72BSErmRuaFFpnsfo7/xF4gsN94bwV33kUk5EdHTEyakKR XBzCZzawpwWpjh4sNeitDFjk7QuTzsjSt/adaHApPaQwVT/0fUnN/fvHsFOjLAuUg2u+ i52HuavEns4psRWnSOX4mbqPzCyZ4DRA0cSC8W35Inodvb5pS2jhRiiIci4f6WsPC6Hk RGRT1aiIYb0tsyJM6mSf5Q9cyS4DmSeuvqbXQbfRZavtYuQcSW8sPW1H9k/qyyPNXg0Y 4dRA== 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=DtsjrG9yANleneNTtSwf6E0TwSfYMC9PLG2YS+3l1vo=; b=THZMg4rlL+HzMhMY2iAwnHhpbL3cHxUwWh7zuIWRHPAIOEk1W7nS/ReOAiLtCCEIP/ CX2rUB4KU0iljxQtYm2b463ISOz28Gvt2dIr1H1tLCWCIjmyBaqoi+FzLS6yYGDgJQRs ympmDI1z24fRucXAnaOLrE9EULjH9hm55KWC9FSJ3UdgHDGwGcyZqs2L1CeiLzCAw0lS Ok0+vHujuEqeLIrnCR+3O2sf+KixUwcAyztYBn0mgawL50FGWVfgiA1ga4og7f4TsNxk Mya0z2SWI/K2YkWtetcuTM+Gj0P5F1dsDK0Mp3/WaBIDZ0WC+l/oiv+wN1IGthPFqhOk siDw== X-Gm-Message-State: AA+aEWZgp2oyhWVMfbymDjZh+rbGX8yg7T6qDNT0hHtnoZn8/W3sXEvm o5qj28oKNvkF1dAGlqv3XkMrmu7Y X-Google-Smtp-Source: AFSGD/V27onsOpmWUdadPjoCMJeXF4HpVXjBHac0XnkoonftHfqF9/WiGqFGJ+vhUpIg6qOYjRM7nQ== X-Received: by 2002:a1c:ad45:: with SMTP id w66mr5745369wme.60.1543779386240; Sun, 02 Dec 2018 11:36:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 11:36:25 -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 13/14] gpio: pca953x: Zap single use of pca953x_read_single() Date: Sun, 2 Dec 2018 20:35:52 +0100 Message-Id: <20181202193553.29704-13-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 Drop pca953x_write_single() which is used in one place. Signed-off-by: Marek Vasut Cc: Linus Walleij Cc: Bartosz Golaszewski --- drivers/gpio/gpio-pca953x.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 8155f1dd667b..7c0122fac383 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -324,21 +324,6 @@ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off, return regaddr; } -static int pca953x_read_single(struct pca953x_chip *chip, int reg, u32 *val, - int off) -{ - u8 regaddr = pca953x_recalc_addr(chip, reg, off, false, false); - int ret; - - ret = regmap_read(chip->regmap, regaddr, val); - if (ret < 0) { - dev_err(&chip->client->dev, "failed reading register\n"); - return ret; - } - - return 0; -} - static int pca953x_write_regs(struct pca953x_chip *chip, int reg, u8 *val) { u8 regaddr = pca953x_recalc_addr(chip, reg, 0, true, true); @@ -408,11 +393,14 @@ static int pca953x_gpio_direction_output(struct gpio_chip *gc, static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) { struct pca953x_chip *chip = gpiochip_get_data(gc); + u8 inreg = pca953x_recalc_addr(chip, chip->regs->input, off, + true, false); + u8 bit = BIT(off % BANK_SZ); u32 reg_val; int ret; mutex_lock(&chip->i2c_lock); - ret = pca953x_read_single(chip, chip->regs->input, ®_val, off); + ret = regmap_read(chip->regmap, inreg, ®_val); mutex_unlock(&chip->i2c_lock); if (ret < 0) { /* NOTE: diagnostic already emitted; that's all we should @@ -422,7 +410,7 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) return 0; } - return (reg_val & (1u << (off % BANK_SZ))) ? 1 : 0; + return !!(reg_val & bit); } static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)