linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <acourbot@nvidia.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Chris Ball <cjb@laptop.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH 1/4] mmc: slot-gpio: switch to use flags when getting GPIO
Date: Mon, 22 Sep 2014 11:20:16 +0300	[thread overview]
Message-ID: <541FDBC0.4020302@intel.com> (raw)
In-Reply-To: <CAPDyKFqw2N9zg41iz=qo3kQghmdYpafYdy545NYuu-Ji6pJELQ@mail.gmail.com>

On 08/29/2014 03:16 PM, Ulf Hansson wrote:
> On 27 August 2014 13:00, Linus Walleij <linus.walleij@linaro.org> wrote:
>> When the slot GPIO driver gets the GPIO to be used for card
>> detect, it is now possible to specify a flag to have the line
>> set up as input. Get rid of the explicit setup call for input
>> and use the flag.
>>
>> The extra argument works as there are transition varargs
>> macros in place in the <linux/gpio/consumer.h> header, in
>> the future we will make the flags argument compulsory.
>>
>> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Thanks! Applied for next.

Unfortunately it doesn't seem to work.  I needed the patch
below.


From: Adrian Hunter <adrian.hunter@intel.com>
Date: Mon, 22 Sep 2014 11:01:16 +0300
Subject: [PATCH] gpio: Fix gpio direction flags not getting set

GPIO direction flags are not getting set because
an 'if' statement is the wrong way around.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 15cc0bb..3b54edf 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1674,7 +1674,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
 		set_bit(FLAG_OPEN_SOURCE, &desc->flags);
 
 	/* No particular flag request, return here... */
-	if (flags & GPIOD_FLAGS_BIT_DIR_SET)
+	if (!(flags & GPIOD_FLAGS_BIT_DIR_SET))
 		return desc;
 
 	/* Process flags */
-- 
1.8.3.2



> 
> Kind regards
> Uffe
> 
>> ---
>>  drivers/mmc/core/slot-gpio.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
>> index 5f89cb83d5f0..908c2b29e79f 100644
>> --- a/drivers/mmc/core/slot-gpio.c
>> +++ b/drivers/mmc/core/slot-gpio.c
>> @@ -308,14 +308,10 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
>>         if (!con_id)
>>                 con_id = ctx->cd_label;
>>
>> -       desc = devm_gpiod_get_index(host->parent, con_id, idx);
>> +       desc = devm_gpiod_get_index(host->parent, con_id, idx, GPIOD_IN);
>>         if (IS_ERR(desc))
>>                 return PTR_ERR(desc);
>>
>> -       ret = gpiod_direction_input(desc);
>> -       if (ret < 0)
>> -               return ret;
>> -
>>         if (debounce) {
>>                 ret = gpiod_set_debounce(desc, debounce);
>>                 if (ret < 0)
>> --
>> 1.9.3
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2014-09-22  8:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 11:00 [PATCH 1/4] mmc: slot-gpio: switch to use flags when getting GPIO Linus Walleij
2014-08-27 11:00 ` [PATCH 2/4] mmc: slot-gpio: add gpiod variant to get wp GPIO Linus Walleij
2014-08-29 12:16   ` Ulf Hansson
2014-08-27 11:00 ` [PATCH 3/4 v2] mmc: host: switch OF parser to use gpio descriptors Linus Walleij
2014-08-29 12:16   ` Ulf Hansson
2014-09-09  7:05   ` Linus Walleij
2014-09-09 12:29     ` Ulf Hansson
2014-09-30 11:30   ` Javier Martinez Canillas
2014-09-30 14:01     ` Linus Walleij
2014-08-27 11:00 ` [PATCH 4/4] mmc: mmci: augment driver to handle " Linus Walleij
2014-08-27 11:34   ` Ulf Hansson
2014-08-29 12:16 ` [PATCH 1/4] mmc: slot-gpio: switch to use flags when getting GPIO Ulf Hansson
2014-09-22  8:20   ` Adrian Hunter [this message]
2014-09-22 12:37     ` Linus Walleij
2014-09-24  7:38       ` Alexandre Courbot
  -- strict thread matches above, loose matches on Subject: below --
2014-08-12 17:25 Linus Walleij
2014-08-14 14:28 ` Alexandre Courbot
2014-08-18 11:25 ` Ulf Hansson

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=541FDBC0.4020302@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acourbot@nvidia.com \
    --cc=cjb@laptop.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).