All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"'Alessandro Zummo'" <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com
Subject: Re: [PATCH] rtc: rtc-v3020: use gpio_request_one()
Date: Thu, 21 Feb 2013 10:48:28 +0200	[thread overview]
Message-ID: <5125DF5C.7070700@compulab.co.il> (raw)
In-Reply-To: <00cb01ce100d$dc282200$94786600$%han@samsung.com>

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 <jg1.han@samsung.com>
> ---
>  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.

  reply	other threads:[~2013-02-21  8:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21  8:31 [PATCH] rtc: rtc-v3020: use gpio_request_one() Jingoo Han
2013-02-21  8:48 ` Igor Grinberg [this message]
2013-02-22  2:13   ` Jingoo Han
2013-02-22  2:19 ` [V2] rtc: rtc-v3020: use gpio_request_array() Jingoo Han
2013-02-22  2:19   ` [PATCH V2] " Jingoo Han
2013-02-24  8:48   ` Igor Grinberg
2015-05-19 22:11   ` [rtc-linux] Re: [V2] " Alexandre Belloni
2015-05-19 22:11     ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5125DF5C.7070700@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.