Patchwork [U-Boot] gpio: s5p_gpio: Call s5p_gpio_set_value() instead of open-code

login
register
mail settings
Submitter Axel Lin
Date June 15, 2013, 2:19 p.m.
Message ID <1371305985.27690.2.camel@phoenix>
Download mbox | patch
Permalink /patch/251626/
State Accepted
Delegated to: Minkyu Kang
Headers show

Comments

Axel Lin - June 15, 2013, 2:19 p.m.
Call s5p_gpio_set_value() to avoid code duplication.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/s5p_gpio.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
Minkyu Kang - June 25, 2013, 1:58 a.m.
On 15/06/13 23:19, Axel Lin wrote:
> Call s5p_gpio_set_value() to avoid code duplication.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/gpio/s5p_gpio.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
> index 656bf4a..4efb768 100644
> --- a/drivers/gpio/s5p_gpio.c
> +++ b/drivers/gpio/s5p_gpio.c
> @@ -48,15 +48,8 @@ void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)
>  
>  void s5p_gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en)
>  {
> -	unsigned int value;
> -
>  	s5p_gpio_cfg_pin(bank, gpio, GPIO_OUTPUT);
> -
> -	value = readl(&bank->dat);
> -	value &= ~DAT_MASK(gpio);
> -	if (en)
> -		value |= DAT_SET(gpio);
> -	writel(value, &bank->dat);
> +	s5p_gpio_set_value(bank, gpio, en);
>  }
>  
>  void s5p_gpio_direction_input(struct s5p_gpio_bank *bank, int gpio)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

Patch

diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 656bf4a..4efb768 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -48,15 +48,8 @@  void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg)
 
 void s5p_gpio_direction_output(struct s5p_gpio_bank *bank, int gpio, int en)
 {
-	unsigned int value;
-
 	s5p_gpio_cfg_pin(bank, gpio, GPIO_OUTPUT);
-
-	value = readl(&bank->dat);
-	value &= ~DAT_MASK(gpio);
-	if (en)
-		value |= DAT_SET(gpio);
-	writel(value, &bank->dat);
+	s5p_gpio_set_value(bank, gpio, en);
 }
 
 void s5p_gpio_direction_input(struct s5p_gpio_bank *bank, int gpio)