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: 452080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CB8C514010F for ; Fri, 20 Mar 2015 04:25:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752389AbbCSRZ6 (ORCPT ); Thu, 19 Mar 2015 13:25:58 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:36604 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753867AbbCSRZ4 (ORCPT ); Thu, 19 Mar 2015 13:25:56 -0400 Received: by lamx15 with SMTP id x15so68057781lam.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=Ttd9iyc0rVTc6Lnm2qu4oHKA7qdMzBZiZ1oeYmJswEcRP5KDPUErhSOP1xFQqBrEB9 dVi/0vHHPX++xBHCNfoAOa1Q6cYERCjEyUGFWd84SysilYjaQtWOrElmAj6EgFiK+L/P VGCe5nzgfNqwf8HHllDa1fgF2fbgmEqxEwORrmXAz7SnhynWH+tnrbK2A54pXbMmG6jE sGZRXFpVMIcT4camFroCfe5AI0H7wtao3wAXTu8PX+ko5E0k8UowLyepVZmNVXrLfNaD pVYRa/600dCQSrOg1R/coAmav6/ANhrv594CBP2KH/yuJIX5s8Eb6GQvtTHvEb1U+WLO CavA== X-Gm-Message-State: ALoCoQnGt4sCC1x4hoSByDtc5hIZHtdrz6sBkhrLl2++BenbZC29qwtBO+ZnWIVpQJ2jvQUJyAio 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-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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);