From: wg@grandegger.com (Wolfgang Grandegger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/6 v9] gpio: Add userland device interface to block GPIO
Date: Thu, 06 Dec 2012 08:28:02 +0100 [thread overview]
Message-ID: <50C04902.7010505@grandegger.com> (raw)
In-Reply-To: <50BFC8C9.5070504@antcom.de>
On 12/05/2012 11:20 PM, Roland Stigge wrote:
> Hi Wolfgang,
>
> On 05/12/12 20:01, Wolfgang Grandegger wrote:
>>> + for (i = 0; i < block->ngpio; i++) {
>>> + status = gpio_request(block->gpio[i], "gpioblock dev");
>>
>> You could use the name of the GPIO block.
>
> OK.
>
>>> + if (status)
>>> + goto err1;
>>> +
>>> + irq = gpio_to_irq(block->gpio[i]);
>>> + if (irq >= 0 &&
>>> + !test_bit(FLAG_IS_OUT, &gpio_desc[block->gpio[i]].flags) &&
>>> + !gpio_block_is_irq_duplicate(block, i)) {
>>> + status = request_irq(irq, gpio_block_irq_handler,
>>> + IRQF_TRIGGER_FALLING,
>>> + block->name, block);
>>> + if (status)
>>> + goto err2;
>>> +
>>> + block->irq_controlled = true;
>>> + }
>>> + }
>>
>> There is no need to request IRQs if "O_NONBLOCK" is specified.
>
> Sure? Regarding this, I found: "The poll() function shall not be
> affected by the O_NONBLOCK flag." [1]
Ah, didn't know that.
>> I observed that the read returns once immediately (without blocking)
>> after reboot. I did not look into that yet.
>
> Didn't happen to me. Can you tell how this can be reproduced?
I think there is an interrupt pending for some reason. It might not be
the case with your setup.
Feel free to add my:
"Tested by: Wolfgang Grandegger <wg@grandegger.com>".
Will do some more tests when time permits, especially with mixed GPIO
input and output.
Wolfgang.
WARNING: multiple messages have this Message-ID (diff)
From: Wolfgang Grandegger <wg@grandegger.com>
To: Roland Stigge <stigge@antcom.de>
Cc: gregkh@linuxfoundation.org, grant.likely@secretlab.ca,
linus.walleij@linaro.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de,
jbe@pengutronix.de, plagnioj@jcrosoft.com, highguy@gmail.com,
broonie@opensource.wolfsonmicro.com, daniel-gl@gmx.net,
rmallon@gmail.com, tru@work-microwave.de, sr@denx.de
Subject: Re: [PATCH 3/6 v9] gpio: Add userland device interface to block GPIO
Date: Thu, 06 Dec 2012 08:28:02 +0100 [thread overview]
Message-ID: <50C04902.7010505@grandegger.com> (raw)
In-Reply-To: <50BFC8C9.5070504@antcom.de>
On 12/05/2012 11:20 PM, Roland Stigge wrote:
> Hi Wolfgang,
>
> On 05/12/12 20:01, Wolfgang Grandegger wrote:
>>> + for (i = 0; i < block->ngpio; i++) {
>>> + status = gpio_request(block->gpio[i], "gpioblock dev");
>>
>> You could use the name of the GPIO block.
>
> OK.
>
>>> + if (status)
>>> + goto err1;
>>> +
>>> + irq = gpio_to_irq(block->gpio[i]);
>>> + if (irq >= 0 &&
>>> + !test_bit(FLAG_IS_OUT, &gpio_desc[block->gpio[i]].flags) &&
>>> + !gpio_block_is_irq_duplicate(block, i)) {
>>> + status = request_irq(irq, gpio_block_irq_handler,
>>> + IRQF_TRIGGER_FALLING,
>>> + block->name, block);
>>> + if (status)
>>> + goto err2;
>>> +
>>> + block->irq_controlled = true;
>>> + }
>>> + }
>>
>> There is no need to request IRQs if "O_NONBLOCK" is specified.
>
> Sure? Regarding this, I found: "The poll() function shall not be
> affected by the O_NONBLOCK flag." [1]
Ah, didn't know that.
>> I observed that the read returns once immediately (without blocking)
>> after reboot. I did not look into that yet.
>
> Didn't happen to me. Can you tell how this can be reproduced?
I think there is an interrupt pending for some reason. It might not be
the case with your setup.
Feel free to add my:
"Tested by: Wolfgang Grandegger <wg@grandegger.com>".
Will do some more tests when time permits, especially with mixed GPIO
input and output.
Wolfgang.
next prev parent reply other threads:[~2012-12-06 7:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 20:39 [PATCH 0/6 v9] gpio: Add block GPIO Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-04 20:39 ` [PATCH 1/6 v9] gpio: Add a block GPIO API to gpiolib Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-04 20:39 ` [PATCH 2/6 v9] gpio: Add sysfs support to block GPIO API Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-04 20:39 ` [PATCH 3/6 v9] gpio: Add userland device interface to block GPIO Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-05 19:01 ` Wolfgang Grandegger
2012-12-05 19:01 ` Wolfgang Grandegger
2012-12-05 22:20 ` Roland Stigge
2012-12-05 22:20 ` Roland Stigge
2012-12-06 7:28 ` Wolfgang Grandegger [this message]
2012-12-06 7:28 ` Wolfgang Grandegger
2012-12-04 20:39 ` [PATCH 4/6 v9] gpiolib: Fix default attributes for class Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-04 20:39 ` [PATCH 5/6 v9] gpio: Add device tree support to block GPIO API Roland Stigge
2012-12-04 20:39 ` Roland Stigge
2012-12-04 20:39 ` [PATCH 6/6 v9] gpio: Add block gpio to several gpio drivers Roland Stigge
2012-12-04 20:39 ` Roland Stigge
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=50C04902.7010505@grandegger.com \
--to=wg@grandegger.com \
--cc=linux-arm-kernel@lists.infradead.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.