From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] gpio: vybrid: Use proper parameter name for gpio offset
Date: Tue, 09 Jun 2015 22:24:44 +0800 [thread overview]
Message-ID: <1433859884.10944.1.camel@ingics.com> (raw)
It's confusing to use gpio as gpio offset parameter so rename it to offset
for better readability.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
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)
--
2.1.0
next reply other threads:[~2015-06-09 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 14:24 Axel Lin [this message]
2015-06-09 14:37 ` [U-Boot] [PATCH] gpio: vybrid: Use proper parameter name for gpio offset Bhuvanchandra DV
2015-06-10 0:39 ` Axel Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433859884.10944.1.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.