From patchwork Mon Jun 10 17:10:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166343 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272811ilk; Mon, 10 Jun 2019 10:12:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvzdbRlhOg/xqRcYwXAFvDHynedTyYurhO2wzZKbHJHx9tEWF+tMIGhiPbSJWV2c1eloRW X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr21748432pju.81.1560186745700; Mon, 10 Jun 2019 10:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186745; cv=none; d=google.com; s=arc-20160816; b=fC9g/s0Sx6aVc6sd9/qKVds2LMtECoQMq++jFMknJ0SXHWCNK4S+vs74Cavp6N/Sb4 3/+NvTAbq/VBi+FaV7SsNydD7sjhSE4v77rAhIyAEa7Qe9i5seyr1cp5TDXNBdINfZwI s+oCj8931asq2TAd2kk6rTCPKP5AOW41M8L/LLfLNKtBEovk9I5lURbVdhuJ8QBzhvC8 JgKX+v8MP2/Vd2fwYulDl475eB9UaxZYRO5WRFlpgGIx/K7Ys+8rSMmKN0p1Omko7UGg 57llbj1cPVj4z63KtAXbcjRwHahcOoenS6cfFX9z9bufRKRZ96G6z3RC6Nd3jMiyb2Wk 9YDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8miiJXRQL/O8gcf1AHy/TV7t/sY9raPUDixdUMYIf9g=; b=PCw0VQarVTCNTdQcqJJEb3RJVXDI27LNe4RZn8A+Y2CWRDSKzS4CRUlFDUKqYjDgWT XxZWOu2xvIyto5MwhXtJOeApZ9LOQHYlWH62gKwS8aA5VpCalNpCIcIOiOhIGsir33C6 jXMIsLcnBD0no+il0v7FIl4tgIXO4BdJOXwqV/dx/u7tWNTCHsn3Gvwnddl/rBeEgPyw gPkaGpQc96RJuOXxA7cA64+B6K0TX3VjN4jAGzaWGqnIvhAl4Qibo7eCIh6kucd3MAJz 5nrrpP62bWN1+KAdtsf2BN1xiB7uPUgFd5Cu9+ouPE345U11RaTSwmulFI/PfeiRthdN TVmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fx+Ma3zC; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si6237744pgb.561.2019.06.10.10.12.25; Mon, 10 Jun 2019 10:12:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fx+Ma3zC; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388207AbfFJRMY (ORCPT + 5 others); Mon, 10 Jun 2019 13:12:24 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57714 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387898AbfFJRMY (ORCPT ); Mon, 10 Jun 2019 13:12:24 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHC7UR056957; Mon, 10 Jun 2019 12:12:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186727; bh=8miiJXRQL/O8gcf1AHy/TV7t/sY9raPUDixdUMYIf9g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fx+Ma3zCg0+cpgQg/ubudqf5IMC7ekppCIzWe0Wmi3iQMaH/DdCDAlvTqdBju4rOl /84bmcEkSk3rqPM3R947KYFiBVcLuHPUHgylebfv76PdSLQA3KyDY0hzPhwUD88R1t FDHcMX/X33F+e5k1IAmPalFI2oGXmJhys3ilnHik= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHC6x7010831 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:12:07 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 10 Jun 2019 12:12:05 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 10 Jun 2019 12:12:05 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHC473067224; Mon, 10 Jun 2019 12:12:05 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 08/20] gpio: gpio-omap: simplify get() method Date: Mon, 10 Jun 2019 20:10:51 +0300 Message-ID: <20190610171103.30903-9-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610171103.30903-1-grygorii.strashko@ti.com> References: <20190610171103.30903-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Russell King omap_gpio_get() calls omap_get_gpio_datain() or omap_get_gpio_dataout() to read the GPIO state. These two functions are only called from this method, so they don't add much value. Move their contents into omap_gpio_get() method and simplify. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 44a4287cce9e..bf1e6f1d0de7 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -146,20 +146,6 @@ static void omap_set_gpio_dataout_mask(struct gpio_bank *bank, unsigned offset, bank->context.dataout = l; } -static int omap_get_gpio_datain(struct gpio_bank *bank, int offset) -{ - void __iomem *reg = bank->base + bank->regs->datain; - - return (readl_relaxed(reg) & (BIT(offset))) != 0; -} - -static int omap_get_gpio_dataout(struct gpio_bank *bank, int offset) -{ - void __iomem *reg = bank->base + bank->regs->dataout; - - return (readl_relaxed(reg) & (BIT(offset))) != 0; -} - /* set multiple data out values using dedicate set/clear register */ static void omap_set_gpio_dataout_reg_multiple(struct gpio_bank *bank, unsigned long *mask, @@ -973,14 +959,15 @@ static int omap_gpio_input(struct gpio_chip *chip, unsigned offset) static int omap_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct gpio_bank *bank; - - bank = gpiochip_get_data(chip); + struct gpio_bank *bank = gpiochip_get_data(chip); + void __iomem *reg; if (omap_gpio_is_input(bank, offset)) - return omap_get_gpio_datain(bank, offset); + reg = bank->base + bank->regs->datain; else - return omap_get_gpio_dataout(bank, offset); + reg = bank->base + bank->regs->dataout; + + return (readl_relaxed(reg) & BIT(offset)) != 0; } static int omap_gpio_output(struct gpio_chip *chip, unsigned offset, int value)