Re: [PATCH] rtc: rtc-v3020: use gpio_request_one()

2013-02-21 Thread Jingoo Han
On Thursday, February 21, 2013 5:48 PM, Igor Grinberg wrote:
> 
> On 02/21/13 10:31, Jingoo Han wrote:
> > Using gpio_request_one() can make the code simpler because it can
> > set the direction and initial value in one shot.
> 
> If you are on this, then I think converting to gpio_request_array()
> would be even better.

Hi Igor Grinberg,

OK, I see.
I will use gpio_request_array() and send v2 patch soon.
Thank you for your comment.


Best regards,
Jingoo Han

> 
> >
> > Signed-off-by: Jingoo Han 
> > ---
> >  drivers/rtc/rtc-v3020.c |5 ++---
> >  1 files changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
> > index bca5d67..d59cd24 100644
> > --- a/drivers/rtc/rtc-v3020.c
> > +++ b/drivers/rtc/rtc-v3020.c
> > @@ -125,11 +125,10 @@ static int v3020_gpio_map(struct v3020 *chip, struct 
> > platform_device *pdev,
> > v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
> >
> > for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
> > -   err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
> > +   err = gpio_request_one(v3020_gpio[i].gpio, GPIOF_OUT_INIT_HIGH,
> > +   v3020_gpio[i].name);
> > if (err)
> > goto err_request;
> > -
> > -   gpio_direction_output(v3020_gpio[i].gpio, 1);
> > }
> 
> If you convert to gpio_request_array(), you can also drop the for loop.
> 
> >
> > chip->gpio = v3020_gpio;
> >
> 
> --
> Regards,
> Igor.

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


Re: [PATCH] rtc: rtc-v3020: use gpio_request_one()

2013-02-21 Thread Igor Grinberg
On 02/21/13 10:31, Jingoo Han wrote:
> Using gpio_request_one() can make the code simpler because it can
> set the direction and initial value in one shot.

If you are on this, then I think converting to gpio_request_array()
would be even better.

> 
> Signed-off-by: Jingoo Han 
> ---
>  drivers/rtc/rtc-v3020.c |5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
> index bca5d67..d59cd24 100644
> --- a/drivers/rtc/rtc-v3020.c
> +++ b/drivers/rtc/rtc-v3020.c
> @@ -125,11 +125,10 @@ static int v3020_gpio_map(struct v3020 *chip, struct 
> platform_device *pdev,
>   v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
>  
>   for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
> - err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
> + err = gpio_request_one(v3020_gpio[i].gpio, GPIOF_OUT_INIT_HIGH,
> + v3020_gpio[i].name);
>   if (err)
>   goto err_request;
> -
> - gpio_direction_output(v3020_gpio[i].gpio, 1);
>   }

If you convert to gpio_request_array(), you can also drop the for loop.

>  
>   chip->gpio = v3020_gpio;
> 

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


[PATCH] rtc: rtc-v3020: use gpio_request_one()

2013-02-21 Thread Jingoo Han
Using gpio_request_one() can make the code simpler because it can
set the direction and initial value in one shot.

Signed-off-by: Jingoo Han 
---
 drivers/rtc/rtc-v3020.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index bca5d67..d59cd24 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -125,11 +125,10 @@ static int v3020_gpio_map(struct v3020 *chip, struct 
platform_device *pdev,
v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
 
for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
-   err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
+   err = gpio_request_one(v3020_gpio[i].gpio, GPIOF_OUT_INIT_HIGH,
+   v3020_gpio[i].name);
if (err)
goto err_request;
-
-   gpio_direction_output(v3020_gpio[i].gpio, 1);
}
 
chip->gpio = v3020_gpio;
-- 
1.7.2.5


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