aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-moxart.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-03-24 22:43:33 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-03-27 05:17:32 -0400
commitc9e8dbadb0528d872c5734858dbf76aa4cb31df9 (patch)
tree70b7f8fedeba8972e4dbb2fd761044b32f6728f8 /drivers/gpio/gpio-moxart.c
parenta585f87c863e4e1d496459d382b802bf5ebe3717 (diff)
gpio: moxart: Avoid forward declaration
Slightly adjust the code to avoid forward declaration as we need to call moxart_gpio_set() in moxart_gpio_direction_output() to properly set the output state. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-moxart.c')
-rw-r--r--drivers/gpio/gpio-moxart.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
index 2af990022cc9..a19a14d590f9 100644
--- a/drivers/gpio/gpio-moxart.c
+++ b/drivers/gpio/gpio-moxart.c
@@ -48,25 +48,6 @@ static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)
48 pinctrl_free_gpio(offset); 48 pinctrl_free_gpio(offset);
49} 49}
50 50
51static int moxart_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
52{
53 struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
54 void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
55
56 writel(readl(ioaddr) & ~BIT(offset), ioaddr);
57 return 0;
58}
59
60static int moxart_gpio_direction_output(struct gpio_chip *chip,
61 unsigned offset, int value)
62{
63 struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
64 void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
65
66 writel(readl(ioaddr) | BIT(offset), ioaddr);
67 return 0;
68}
69
70static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 51static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
71{ 52{
72 struct moxart_gpio_chip *gc = to_moxart_gpio(chip); 53 struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
@@ -78,7 +59,6 @@ static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
78 else 59 else
79 reg = reg & ~BIT(offset); 60 reg = reg & ~BIT(offset);
80 61
81
82 writel(reg, ioaddr); 62 writel(reg, ioaddr);
83} 63}
84 64
@@ -93,6 +73,25 @@ static int moxart_gpio_get(struct gpio_chip *chip, unsigned offset)
93 return !!(readl(gc->base + GPIO_DATA_IN) & BIT(offset)); 73 return !!(readl(gc->base + GPIO_DATA_IN) & BIT(offset));
94} 74}
95 75
76static int moxart_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
77{
78 struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
79 void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
80
81 writel(readl(ioaddr) & ~BIT(offset), ioaddr);
82 return 0;
83}
84
85static int moxart_gpio_direction_output(struct gpio_chip *chip,
86 unsigned offset, int value)
87{
88 struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
89 void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
90
91 writel(readl(ioaddr) | BIT(offset), ioaddr);
92 return 0;
93}
94
96static struct gpio_chip moxart_template_chip = { 95static struct gpio_chip moxart_template_chip = {
97 .label = "moxart-gpio", 96 .label = "moxart-gpio",
98 .request = moxart_gpio_request, 97 .request = moxart_gpio_request,