gpio: moxart: Avoid forward declaration
PATCH v3 1/2 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.
--- drivers/gpio/gpio-moxart.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
drivers/gpio/gpio-moxart.c +19 -20
@@ -48,25 +48,6 @@ static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)pinctrl_free_gpio (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->base +GPIO_PIN_DIRECTION ; - -writel (readl (ioaddr) & ~BIT (offset), ioaddr); -return 0 ; -} - -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->base +GPIO_PIN_DIRECTION ; - -writel (readl (ioaddr) |BIT (offset), ioaddr); -return 0 ; -} -static void moxart_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {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)else reg = reg & ~BIT (offset); -writel (reg, ioaddr); }
@@ -93,6 +73,25 @@ static int moxart_gpio_get(struct gpio_chip *chip, unsigned offset)return !!(readl (gc->base +GPIO_DATA_IN ) &BIT (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->base +GPIO_PIN_DIRECTION ; + +writel (readl (ioaddr) & ~BIT (offset), ioaddr); +return 0 ; +} + +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->base +GPIO_PIN_DIRECTION ; + +writel (readl (ioaddr) |BIT (offset), ioaddr); +return 0 ; +} +static struct gpio_chip moxart_template_chip = { .label ="moxart-gpio" , .request = moxart_gpio_request,
Signature · 1 line
1.8.3.2
PATCH v3 2/2 gpio: moxart: Actually set output state in moxart_gpio_direction_output()
moxart_gpio_direction_output() ignored the state passed into it. Fix it.
--- drivers/gpio/gpio-moxart.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-moxart.c +1 -0
@@ -88,6 +88,7 @@ static int moxart_gpio_direction_output(struct gpio_chip *chip,struct moxart_gpio_chip *gc =to_moxart_gpio (chip);void __iomem *ioaddr = gc->base +GPIO_PIN_DIRECTION ; +moxart_gpio_set (chip, offset, value);writel (readl (ioaddr) |BIT (offset), ioaddr);return 0 ; }
Signature · 1 line
1.8.3.2
Re: [PATCH v3 2/2] gpio: moxart: Actually set output state in moxart_gpio_direction_output()
Quoted 1 line · Axel Lin
moxart_gpio_direction_output()ignored the state passed into it. Fix it.
Re: [PATCH v3 2/2] gpio: moxart: Actually set output state in moxart_gpio_direction_output()
In reply to Axel LinQuoted 3 lines · Axel Lin
moxart_gpio_direction_output()ignored the state passed into it. Fix it.Signed-off-by Axel Lin <[email protected]>
Patch applied unless the moxart people start complaining.
Yours,
Linus Walleij
Re: [PATCH v3 2/2] gpio: moxart: Actually set output state in moxart_gpio_direction_output()
In reply to Axel LinThanks !
Verified by buzzing the buzzer and writing RTC (next-20140403):
echo 24 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio24/direction echo 1 > /sys/class/gpio/gpio24/value echo 0 > /sys/class/gpio/gpio24/value
date +%Y%m%d%h%m -s "201001202323" hwclock -w
reboot
..
[ 2.420000] moxart-rtc rtc.0: setting system clock to 2010-01-20
22:23:31 UTC (1264026211)
..
date +%Y%m%d%h%m -s "201212181553" hwclock -w
reboot
..
[ 2.410000] moxart-rtc rtc.0: setting system clock to 2012-12-18
14:53:29 UTC (1355842409)
Re: [PATCH v3 2/2] gpio: moxart: Actually set output state in moxart_gpio_direction_output()
Quoted 1 line · Jonas Jensen
Verified by buzzing the buzzer and writing RTC (next-20140403):
(...)
Quoted 1 line
Tested-by Jonas Jensen <[email protected]>
This patch is already upstream in Torvalds' tree, but thanks anyway!
Yours,
Linus Walleij
Quoted 3 lines · Axel Lin
Slightly adjust the code to avoid forward declaration as we need to call
moxart_gpio_set()inmoxart_gpio_direction_output()to properly set the output state.
Quoted 5 lines · Axel Lin
Slightly adjust the code to avoid forward declaration as we need to call
moxart_gpio_set()inmoxart_gpio_direction_output()to properly set the output state.Signed-off-by Axel Lin <[email protected]>
Nice cleanup, patch applied with Alexandre's review tag.
Yours,
Linus Walleij