From patchwork Mon Jun 10 17:10:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166353 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1273963ilk; Mon, 10 Jun 2019 10:13:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlluCRVFlVk4ZEhqB+oww1y2+qHi4Whs4PdreG7rhAUNrApShLf5OQRXYMKNLe1/PTf1k6 X-Received: by 2002:a62:6d47:: with SMTP id i68mr76405789pfc.189.1560186800761; Mon, 10 Jun 2019 10:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186800; cv=none; d=google.com; s=arc-20160816; b=I1qshznbEJ1geCv3iOuPtdcYNI2TiajcQqjm57AFP2y12y3cplOw1Z+U4qOL3sLc3W kP65FX+Ez4xoj0UNh1YvCdvtqBX3R7CacHPdrx88jlnEhGkHekvjtLFE9pSVXGteX+cv bucAoyHdB/dn9uXYvm32Awfwba/BJ2EgDV7At1diB+E48JQ+SFQnAlS0eH0UHQFEbcit uCsxdRP9vjCzV0pwgiUTNSxZekbHPOHpjMTdIoCz8Og6ygyDeknm/yCiA/VkHw2Sd0+W 66QWW2e1xIqx6s5QyqhaST+GFqgHJ5cEuZCfWzzYikHTDOQ0qIz05L4ardSB/tChzOkv Ww8w== 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=Z575S9olDMLpCethO+TC+EKmcyRYsczz36ohGuMtYWo=; b=djvKxNteNG7EYOeXhqPR5H1BNk10Td1Xwcxwq2fLSfC0yWu+dFWtXFW/eFBOUJHYZa JcSAkt6Lm7cQJro9UWUk/tC+SEWo8e047aUs3yAmmaax7GXAgggBKx1NIy6rm6ju71IA rrphYP9Yx5hDyN63Db9ZRixNrBXx0HA6mAiT+FDs/113ogEa1vyA54xaDjnuAzoXz+7F aAUApFkQFc8lCuB7zeX9cvq9LsLmucHR4yuN+MiU2znTz2ds03pBi1pKtd5SlwOLHN67 v1+/yfcRYpF3RjwOFzYp+dR1KrE2vdospaUnkj7MvOfbvm0stVKn9ul2UcY5UIkfOvNL vMXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ougQjhc6; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 cj14si10503411plb.141.2019.06.10.10.13.20; Mon, 10 Jun 2019 10:13:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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=ougQjhc6; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 S1727997AbfFJRNT (ORCPT + 5 others); Mon, 10 Jun 2019 13:13:19 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57844 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387495AbfFJRND (ORCPT ); Mon, 10 Jun 2019 13:13:03 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHCsIm057127; Mon, 10 Jun 2019 12:12:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186774; bh=Z575S9olDMLpCethO+TC+EKmcyRYsczz36ohGuMtYWo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ougQjhc6T67WEzIZlZZqImuxlPpVxQC9c+I8XPjBXo42XdIx2RNjz6fKfP2Qr1P0f 6IhaW4dM4Kru1NTvvatIZyCzUoBPW/9EL7O4fw+b6dFYohNpKUkWCdrGT61JZd4i8b fBgfZ3u/udVxshTjiMwtCEmcevro1FQ05Z+T0v4A= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHCsQS081099 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:12:54 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE108.ent.ti.com (157.170.170.38) 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:54 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE104.ent.ti.com (157.170.170.34) 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:54 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHCr5F039807; Mon, 10 Jun 2019 12:12:53 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 16/20] gpio: gpio-omap: clean up omap_gpio_restore_context() Date: Mon, 10 Jun 2019 20:10:59 +0300 Message-ID: <20190610171103.30903-17-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-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Russell King Use local variables to store the base iomem address and regs table pointer like omap_gpio_init_context() does. Not only does this make the function neater, it also avoids unnecessary reloads of the same data multiple times. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c24a91b2df97..1c5fa12bcf9f 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1094,32 +1094,26 @@ static void omap_gpio_init_context(struct gpio_bank *p) static void omap_gpio_restore_context(struct gpio_bank *bank) { - writel_relaxed(bank->context.wake_en, - bank->base + bank->regs->wkup_en); - writel_relaxed(bank->context.ctrl, bank->base + bank->regs->ctrl); - writel_relaxed(bank->context.leveldetect0, - bank->base + bank->regs->leveldetect0); - writel_relaxed(bank->context.leveldetect1, - bank->base + bank->regs->leveldetect1); - writel_relaxed(bank->context.risingdetect, - bank->base + bank->regs->risingdetect); - writel_relaxed(bank->context.fallingdetect, - bank->base + bank->regs->fallingdetect); - writel_relaxed(bank->context.dataout, - bank->base + bank->regs->dataout); - writel_relaxed(bank->context.oe, bank->base + bank->regs->direction); + struct omap_gpio_reg_offs *regs = bank->regs; + void __iomem *base = bank->base; + + writel_relaxed(bank->context.wake_en, base + regs->wkup_en); + writel_relaxed(bank->context.ctrl, base + regs->ctrl); + writel_relaxed(bank->context.leveldetect0, base + regs->leveldetect0); + writel_relaxed(bank->context.leveldetect1, base + regs->leveldetect1); + writel_relaxed(bank->context.risingdetect, base + regs->risingdetect); + writel_relaxed(bank->context.fallingdetect, base + regs->fallingdetect); + writel_relaxed(bank->context.dataout, base + regs->dataout); + writel_relaxed(bank->context.oe, base + regs->direction); if (bank->dbck_enable_mask) { - writel_relaxed(bank->context.debounce, bank->base + - bank->regs->debounce); + writel_relaxed(bank->context.debounce, base + regs->debounce); writel_relaxed(bank->context.debounce_en, - bank->base + bank->regs->debounce_en); + base + regs->debounce_en); } - writel_relaxed(bank->context.irqenable1, - bank->base + bank->regs->irqenable); - writel_relaxed(bank->context.irqenable2, - bank->base + bank->regs->irqenable2); + writel_relaxed(bank->context.irqenable1, base + regs->irqenable); + writel_relaxed(bank->context.irqenable2, base + regs->irqenable2); } static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)