From patchwork Mon Mar 23 12:18:23 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: 46185 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54D59214B0 for ; Mon, 23 Mar 2015 12:18:48 +0000 (UTC) Received: by widex7 with SMTP id ex7sf7321970wid.2 for ; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=IwfthzRSUBQXfChkY0meNjA+d52KNu9Y1lVj/hRyJTo=; b=P17w5PXG00vsZApgZ8CeudTOqyyvreK83rlfBZ1g2NAJSEcmCRRcd8dTmxY/YTIvq/ ymg+yjTZCng/QBrWE4APH/4JbwRqbVWCoWGP8LkNPX4MHoVSIyiThXQm1rbRPYMiHPig 7KvAvip+IN9Uz6O/PVUOZljTsqWQ2/YvNC4zdnHS0zVKcdaJy+F4lQ6NSAdt6i2qho+7 7gces9QB5vxqx70QlTgq95T7ylHhY1/6s2Jzofhm+J886ENKk1nJWkH6v9tSOV2p8rbL D/JUXuIEluVjj4qvoH0jPaA6rZ7MMPpBFP0eGELUffeUBnq2tsHMcba2gwerLRLcOf0h He8A== X-Gm-Message-State: ALoCoQnlLKJSiaCcqxMSvt/70L2cBKOkgCe7jaSFvLAtXIhENTmylIevHuaUsf3o2bpuwq6tQQ02 X-Received: by 10.112.39.11 with SMTP id l11mr1346630lbk.12.1427113127629; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.102 with SMTP id q6ls675984laa.24.gmail; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) X-Received: by 10.152.87.144 with SMTP id ay16mr28472225lab.10.1427113127385; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id u2si427031laz.161.2015.03.23.05.18.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 05:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by laae1 with SMTP id e1so309328laa.2 for ; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr16978098lbb.41.1427113127294; Mon, 23 Mar 2015 05:18:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp789142lbq; Mon, 23 Mar 2015 05:18:46 -0700 (PDT) X-Received: by 10.70.96.145 with SMTP id ds17mr211832259pdb.153.1427113125457; Mon, 23 Mar 2015 05:18:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id te6si741149pbc.185.2015.03.23.05.18.44; Mon, 23 Mar 2015 05:18:45 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752423AbbCWMSk (ORCPT + 27 others); Mon, 23 Mar 2015 08:18:40 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:36310 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbbCWMSg (ORCPT ); Mon, 23 Mar 2015 08:18:36 -0400 Received: by lbbug6 with SMTP id ug6so22347913lbb.3 for ; Mon, 23 Mar 2015 05:18:34 -0700 (PDT) X-Received: by 10.112.166.102 with SMTP id zf6mr79224780lbb.24.1427113114600; Mon, 23 Mar 2015 05:18:34 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id dy8sm150672lac.13.2015.03.23.05.18.33 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Mar 2015 05:18:33 -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 v2 1/8] gpio: omap: convert omap_gpio_is_input() to use gpio offset Date: Mon, 23 Mar 2015 14:18:23 +0200 Message-Id: <1427113110-20813-2-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427113110-20813-1-git-send-email-grygorii.strashko@linaro.org> References: <1427113110-20813-1-git-send-email-grygorii.strashko@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grygorii.strashko@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Tested-by: Tony Lindgren Tested-by: Aaro Koskinen Acked-by: Santosh Shilimkar Acked-by: Javier Martinez Canillas Signed-off-by: Grygorii Strashko --- 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);