From patchwork Tue Jun 9 14:24:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 482254 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 256D8140518 for ; Wed, 10 Jun 2015 00:25:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 243124B739; Tue, 9 Jun 2015 16:24:59 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qdObM848prXE; Tue, 9 Jun 2015 16:24:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B50F34B72A; Tue, 9 Jun 2015 16:24:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A4674B72A for ; Tue, 9 Jun 2015 16:24:56 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j0UyLtNs5jJL for ; Tue, 9 Jun 2015 16:24:56 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by theia.denx.de (Postfix) with ESMTPS id 0E1124B725 for ; Tue, 9 Jun 2015 16:24:51 +0200 (CEST) Received: by pabqy3 with SMTP id qy3so14943452pab.3 for ; Tue, 09 Jun 2015 07:24:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=uvGM4FViRKBq0zu3QL2DUsNQC+ETjLO02hwhWcD7iA4=; b=Mb/8E1IAyvQVTX/YAmNyZq41KPBjIyAw4quD1CLM3cKQlitjn1qCyBK63jg5E3hwys dCFuCe9TrmMY4bjXuBkDSbMi//tbANZS4UxA2RCqsGn+d09nkaKmbHAnlE2dt7dpkybv HmesZrWEOVQEBeKhLz6sQ5HcX5GixK/Tu+avsqTmp0nD/Jnxx2QfDvaHuSRvgcy7ku8T nuqsBpa76dYpG5R7LlcB8MLDIb8EPH1jE2M03kG/MfOG+Qz5UFpwRdl4imZ2mmH4KOR2 gcWC7SI20hfW0hv4AUJombZPVjQov707vf58yNos94Jo1mvL6KbezevlZNxM20W1CaXU IGKA== X-Gm-Message-State: ALoCoQkNIQD2F+wtvfyE8HJfP0zQDbCGYhWIGN2VvlotYsQgTdLBPk+NZOrg8ED8kft5cxLSClaA X-Received: by 10.68.135.36 with SMTP id pp4mr40004417pbb.134.1433859889910; Tue, 09 Jun 2015 07:24:49 -0700 (PDT) Received: from phoenix.local (118-171-140-12.dynamic.hinet.net. [118.171.140.12]) by mx.google.com with ESMTPSA id rd7sm5839648pdb.64.2015.06.09.07.24.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 07:24:48 -0700 (PDT) Message-ID: <1433859884.10944.1.camel@ingics.com> From: Axel Lin To: u-boot@lists.denx.de Date: Tue, 09 Jun 2015 22:24:44 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Bhuvanchandra DV Subject: [U-Boot] [PATCH] gpio: vybrid: Use proper parameter name for gpio offset X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It's confusing to use gpio as gpio offset parameter so rename it to offset for better readability. Signed-off-by: Axel Lin --- drivers/gpio/vybrid_gpio.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/vybrid_gpio.c b/drivers/gpio/vybrid_gpio.c index 6eaf0a9..14ba7e5 100644 --- a/drivers/gpio/vybrid_gpio.c +++ b/drivers/gpio/vybrid_gpio.c @@ -21,54 +21,54 @@ struct vybrid_gpios { struct vybrid_gpio_regs *reg; }; -static int vybrid_gpio_direction_input(struct udevice *dev, unsigned gpio) +static int vybrid_gpio_direction_input(struct udevice *dev, unsigned offset) { const struct vybrid_gpios *gpios = dev_get_priv(dev); + unsigned gpio = offset + (gpios->chip * VYBRID_GPIO_COUNT); - gpio = gpio + (gpios->chip * VYBRID_GPIO_COUNT); imx_iomux_gpio_set_direction(gpio, VF610_GPIO_DIRECTION_IN); return 0; } -static int vybrid_gpio_direction_output(struct udevice *dev, unsigned gpio, +static int vybrid_gpio_direction_output(struct udevice *dev, unsigned offset, int value) { const struct vybrid_gpios *gpios = dev_get_priv(dev); + unsigned gpio = offset + (gpios->chip * VYBRID_GPIO_COUNT); - gpio = gpio + (gpios->chip * VYBRID_GPIO_COUNT); gpio_set_value(gpio, value); imx_iomux_gpio_set_direction(gpio, VF610_GPIO_DIRECTION_OUT); return 0; } -static int vybrid_gpio_get_value(struct udevice *dev, unsigned gpio) +static int vybrid_gpio_get_value(struct udevice *dev, unsigned offset) { const struct vybrid_gpios *gpios = dev_get_priv(dev); - return ((readl(&gpios->reg->gpio_pdir) & (1 << gpio))) ? 1 : 0; + return ((readl(&gpios->reg->gpio_pdir) & (1 << offset))) ? 1 : 0; } -static int vybrid_gpio_set_value(struct udevice *dev, unsigned gpio, +static int vybrid_gpio_set_value(struct udevice *dev, unsigned offset, int value) { const struct vybrid_gpios *gpios = dev_get_priv(dev); + if (value) - writel((1 << gpio), &gpios->reg->gpio_psor); + writel((1 << offset), &gpios->reg->gpio_psor); else - writel((1 << gpio), &gpios->reg->gpio_pcor); + writel((1 << offset), &gpios->reg->gpio_pcor); return 0; } -static int vybrid_gpio_get_function(struct udevice *dev, unsigned gpio) +static int vybrid_gpio_get_function(struct udevice *dev, unsigned offset) { const struct vybrid_gpios *gpios = dev_get_priv(dev); + unsigned gpio = offset + (gpios->chip * VYBRID_GPIO_COUNT); u32 g_state = 0; - gpio = gpio + (gpios->chip * VYBRID_GPIO_COUNT); - imx_iomux_gpio_get_function(gpio, &g_state); if (((g_state & (0x07 << PAD_MUX_MODE_SHIFT)) >> PAD_MUX_MODE_SHIFT) > 0)