[PATCH] gpio: MOXA ART: rename moxart_gpio_base to base

From: Jonas Jensen
Date: Mon Dec 02 2013 - 05:28:58 EST


Renaming "moxart_gpio_base" to "base" allows better fit,
remove line breaks in moxart_gpio_get().

While doing trivial cleanup, also remove fields initialized
with zero in moxart_template_chip.

Signed-off-by: Jonas Jensen <jonas.jensen@xxxxxxxxx>
---

Notes:
Thanks for applying!

This is a follow-up with trivial changes per your comments.

Regarding Documentation/devicetree/bindings/vendor-prefixes.txt,
there's already a patch submitted (Mark Rutland requested this):

https://lkml.org/lkml/2013/10/8/451

Applies to next-20131202

drivers/gpio/gpio-moxart.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
index d662cde..4ecd195 100644
--- a/drivers/gpio/gpio-moxart.c
+++ b/drivers/gpio/gpio-moxart.c
@@ -30,7 +30,7 @@

struct moxart_gpio_chip {
struct gpio_chip gpio;
- void __iomem *moxart_gpio_base;
+ void __iomem *base;
};

static inline struct moxart_gpio_chip *to_moxart_gpio(struct gpio_chip *chip)
@@ -51,7 +51,7 @@ static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)
static int moxart_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
- void __iomem *ioaddr = gc->moxart_gpio_base + GPIO_PIN_DIRECTION;
+ void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;

writel(readl(ioaddr) & ~BIT(offset), ioaddr);
return 0;
@@ -61,7 +61,7 @@ static int moxart_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
- void __iomem *ioaddr = gc->moxart_gpio_base + GPIO_PIN_DIRECTION;
+ void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;

writel(readl(ioaddr) | BIT(offset), ioaddr);
return 0;
@@ -70,7 +70,7 @@ static int moxart_gpio_direction_output(struct gpio_chip *chip,
static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
- void __iomem *ioaddr = gc->moxart_gpio_base + GPIO_DATA_OUT;
+ void __iomem *ioaddr = gc->base + GPIO_DATA_OUT;
u32 reg = readl(ioaddr);

if (value)
@@ -85,14 +85,12 @@ static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int moxart_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
- u32 ret = readl(gc->moxart_gpio_base + GPIO_PIN_DIRECTION);
+ u32 ret = readl(gc->base + GPIO_PIN_DIRECTION);

if (ret & BIT(offset))
- return !!(readl(gc->moxart_gpio_base + GPIO_DATA_OUT) &
- BIT(offset));
+ return !!(readl(gc->base + GPIO_DATA_OUT) & BIT(offset));
else
- return !!(readl(gc->moxart_gpio_base + GPIO_DATA_IN) &
- BIT(offset));
+ return !!(readl(gc->base + GPIO_DATA_IN) & BIT(offset));
}

static struct gpio_chip moxart_template_chip = {
@@ -103,9 +101,7 @@ static struct gpio_chip moxart_template_chip = {
.direction_output = moxart_gpio_direction_output,
.set = moxart_gpio_set,
.get = moxart_gpio_get,
- .base = 0,
.ngpio = 32,
- .can_sleep = 0,
};

static int moxart_gpio_probe(struct platform_device *pdev)
@@ -123,11 +119,11 @@ static int moxart_gpio_probe(struct platform_device *pdev)
mgc->gpio = moxart_template_chip;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mgc->moxart_gpio_base = devm_ioremap_resource(dev, res);
- if (IS_ERR(mgc->moxart_gpio_base)) {
+ mgc->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(mgc->base)) {
dev_err(dev, "%s: devm_ioremap_resource res_gpio failed\n",
dev->of_node->full_name);
- return PTR_ERR(mgc->moxart_gpio_base);
+ return PTR_ERR(mgc->base);
}

mgc->gpio.dev = dev;
--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/