From: Guenter Roeck <linux@roeck-us.net>
To: Alexandre Courbot <gnurou@gmail.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] gpio: Add support for GPIOF_ACTIVE_LOW to gpio_request_one
Date: Wed, 16 Jul 2014 23:37:48 -0700 [thread overview]
Message-ID: <53C76F3C.6090104@roeck-us.net> (raw)
In-Reply-To: <CAAVeFuLtUpKKVWAvJ-bw_b36jYFhrzaWeswnJKyehbwn=6y+4Q@mail.gmail.com>
On 07/16/2014 11:09 PM, Alexandre Courbot wrote:
> On Thu, Jul 17, 2014 at 8:11 AM, Guenter Roeck <linux@roeck-us.net> wrote:
>> The gpio include file and the gpio documentation declare and document
>> GPIOF_ACTIVE_LOW as one of the flags to be passed to gpio_request_one
>> and related functions. However, the flag is not evaluated or used.
>>
>> Check the flag in gpio_request_one and set the gpio internal flag
>> FLAG_ACTIVE_LOW if it is set.
>
> What is the point since the integer GPIO API has no clue of the
> active-low status of a GPIO? It is only used by the gpiod and sysfs
> interfaces.
>
One can use gpio_request_one() to export a gpio pin to user space from
the kernel. That code path does use the flag, as you point out yourself above.
One could also argue that the integer gpio API _should_ support this as well,
but that is a different question.
Guenter
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> drivers/gpio/gpiolib.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
>> index 2ebc907..43d9e34 100644
>> --- a/drivers/gpio/gpiolib.c
>> +++ b/drivers/gpio/gpiolib.c
>> @@ -1842,6 +1842,9 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
>> if (flags & GPIOF_OPEN_SOURCE)
>> set_bit(FLAG_OPEN_SOURCE, &desc->flags);
>>
>> + if (flags & GPIOF_ACTIVE_LOW)
>> + set_bit(FLAG_ACTIVE_LOW, &desc->flags);
>> +
>> if (flags & GPIOF_DIR_IN)
>> err = gpiod_direction_input(desc);
>> else
>> --
>> 1.9.1
>>
>
>
next prev parent reply other threads:[~2014-07-17 6:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 23:11 [PATCH] gpio: Add support for GPIOF_ACTIVE_LOW to gpio_request_one Guenter Roeck
2014-07-17 6:09 ` Alexandre Courbot
2014-07-17 6:37 ` Guenter Roeck [this message]
2014-07-17 7:26 ` Alexandre Courbot
2014-07-17 14:34 ` Guenter Roeck
2014-07-22 4:30 ` Alexandre Courbot
2014-07-22 5:16 ` Guenter Roeck
2014-07-22 6:59 ` Alexandre Courbot
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=53C76F3C.6090104@roeck-us.net \
--to=linux@roeck-us.net \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 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.