public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: axel.lin@gmail.com
Cc: linux-kernel@vger.kernel.org,
	Misael Lopez Cruz <misael.lopez@ti.com>,
	Jorge Eduardo Candelaria <jorge.candelaria@ti.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 4/4] mfd: twl6040-core: Use gpio_request_one
Date: Thu, 01 Dec 2011 11:10:03 +0200	[thread overview]
Message-ID: <4ED7446B.5000806@compulab.co.il> (raw)
In-Reply-To: <CAF+7xWnf398rY_Lb8CexjZDtcp8poseQc11S-14xyNSVGDdJWw@mail.gmail.com>

On 12/01/11 10:18, Axel Lin wrote:
> 2011/12/1 Igor Grinberg <grinberg@compulab.co.il>:
>> On 12/01/11 03:55, Axel Lin wrote:
>>> Use gpio_request_one() instead of multiple gpiolib calls.
>>>
>>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>>> ---
>>>  drivers/mfd/twl6040-core.c |    7 ++-----
>>>  1 files changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
>>> index 268f80f..e57b1d1 100644
>>> --- a/drivers/mfd/twl6040-core.c
>>> +++ b/drivers/mfd/twl6040-core.c
>>> @@ -509,13 +509,10 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
>>>               twl6040->audpwron = -EINVAL;
>>>
>>>       if (gpio_is_valid(twl6040->audpwron)) {
>>> -             ret = gpio_request(twl6040->audpwron, "audpwron");
>>> +             ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW,
>>> +                                    "audpwron");
>>>               if (ret)
>>>                       goto gpio1_err;
>>> -
>>> -             ret = gpio_direction_output(twl6040->audpwron, 0);
>>> -             if (ret)
>>> -                     goto gpio2_err;
>>>       }
>>
>> same here, double check gpio_is_valid()?
> 
> In the case of
> twl6040->audpwron = -EINVAL;  ( see line 509 )
> gpio_is_valid returns false, we just don't request gpio.
> 
> If we remove the gpio_is_valid checking here,
> then gpio_request_one will return -EINVAL.
> Then the code always goes to the error path if twl6040->audpwron is -EINVAL.

Thanks for the explanation.
So the GPIO is optional - now it makes sense to me.


-- 
Regards,
Igor.

  reply	other threads:[~2011-12-01  9:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
2011-12-01  1:49 ` [PATCH 2/4] mfd: dm355evm_msp: " Axel Lin
2011-12-01  1:53 ` [PATCH 3/4] mfd: omap-usb-host: " Axel Lin
2011-12-01  8:02   ` Igor Grinberg
2011-12-01  1:55 ` [PATCH 4/4] mfd: twl6040-core: " Axel Lin
2011-12-01  8:02   ` Igor Grinberg
2011-12-01  8:18     ` Axel Lin
2011-12-01  9:10       ` Igor Grinberg [this message]
2011-12-01  8:38 ` [PATCH 1/4] mfd: aat2870-core: " Jinyoung Park
2011-12-19 11:13 ` Samuel Ortiz

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=4ED7446B.5000806@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=axel.lin@gmail.com \
    --cc=jorge.candelaria@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=misael.lopez@ti.com \
    --cc=sameo@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox