From patchwork Thu Mar 19 17:25:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 6051721 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEB59BF90F for ; Thu, 19 Mar 2015 17:31:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2741C2051D for ; Thu, 19 Mar 2015 17:31:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37848204FC for ; Thu, 19 Mar 2015 17:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753950AbbCSRbZ (ORCPT ); Thu, 19 Mar 2015 13:31:25 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:36444 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754907AbbCSRZ4 (ORCPT ); Thu, 19 Mar 2015 13:25:56 -0400 Received: by lbblx11 with SMTP id lx11so35864663lbb.3 for ; Thu, 19 Mar 2015 10:25:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=inOats01pEdOkiCuc2C1LWWzR25jmvzklL6rvyyBzeY=; b=QyzOxIwqXwEZSpX3mAYsSod1wAyGmLBSpcULuJQZfRBA5vGKNHJpIopsgOk8o5p+H/ DKR262xBMv7xdSUEv3eOb1HAtVoxEfx9+jMh9+Y/YObYMh4TUfx20NvXXZx0yKwJJ7vs uGuNOO5TOUCMyTULS4hOpGIWqfspmfqj01x7lcO+5z6SRfKyycxt7PsvrfjmPzRbwRxh JADeiv75sSDyol2glxX/RNbUy2IoMEZtcg7O87N7eB56Og0NBAy3YywlD2m67fcfsplf YhIPlDvlm5UWxiMb1VrjVgT57vJWc8G6yZ6FkSoqxQJ80HL4Jq4FTHdXxF53FSwKUzoR AEwA== X-Gm-Message-State: ALoCoQkqCI+LyEWI1QIlwZCDKNHe1jCtt6X8LMrjw1huiWJQFGbAIBZS3qoGU8jjqgQachLiC8WA X-Received: by 10.112.170.132 with SMTP id am4mr69264979lbc.89.1426785955349; Thu, 19 Mar 2015 10:25:55 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id q10sm410023laa.22.2015.03.19.10.25.54 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Mar 2015 10:25:54 -0700 (PDT) From: To: Javier Martinez Canillas , Linus Walleij , Alexandre Courbot , ssantosh@kernel.org, Kevin Hilman , tony@atomide.com Cc: linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Grygorii Strashko Subject: [PATCH 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset Date: Thu, 19 Mar 2015 19:25:37 +0200 Message-Id: <1426785944-17255-2-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426785944-17255-1-git-send-email-grygorii.strashko@linaro.org> References: <1426785944-17255-1-git-send-email-grygorii.strashko@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Grygorii Strashko Convert omap_gpio_is_input() to use GPIO offset instead of mask and, in such way, make code simpler and remove few lines of code. Signed-off-by: Grygorii Strashko Acked-by: Santosh Shilimkar Acked-by: Javier Martinez Canillas --- drivers/gpio/gpio-omap.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 2b2fc4b..ce71239 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -472,11 +472,11 @@ static void omap_disable_gpio_module(struct gpio_bank *bank, unsigned offset) } } -static int omap_gpio_is_input(struct gpio_bank *bank, int mask) +static int omap_gpio_is_input(struct gpio_bank *bank, unsigned offset) { void __iomem *reg = bank->base + bank->regs->direction; - return readl_relaxed(reg) & mask; + return readl_relaxed(reg) & BIT(offset); } static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned gpio, @@ -519,7 +519,7 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type) offset = GPIO_INDEX(bank, gpio); retval = omap_set_gpio_triggering(bank, offset, type); omap_gpio_init_irq(bank, gpio, offset); - if (!omap_gpio_is_input(bank, BIT(offset))) { + if (!omap_gpio_is_input(bank, offset)) { spin_unlock_irqrestore(&bank->lock, flags); return -EINVAL; } @@ -976,12 +976,10 @@ 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; - u32 mask; bank = container_of(chip, struct gpio_bank, chip); - mask = (BIT(offset)); - if (omap_gpio_is_input(bank, mask)) + if (omap_gpio_is_input(bank, offset)) return omap_get_gpio_datain(bank, offset); else return omap_get_gpio_dataout(bank, offset);