From: David Lechner <david@lechnology.com>
To: William Breathitt Gray <vilhelm.gray@gmail.com>,
Pavel Machek <pavel@ucw.cz>
Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org,
alexandre.torgue@st.com, linux-iio@vger.kernel.org,
patrick.havelange@essensium.com, alexandre.belloni@bootlin.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, mcoquelin.stm32@gmail.com,
syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com,
jic23@kernel.org
Subject: Re: [PATCH v5 4/5] docs: counter: Document character device interface
Date: Mon, 12 Oct 2020 12:04:10 -0500 [thread overview]
Message-ID: <d06d5e47-5776-85ee-0dc5-8b624e36d83d@lechnology.com> (raw)
In-Reply-To: <20201008122845.GA3314@shinobu>
On 10/8/20 7:28 AM, William Breathitt Gray wrote:
> On Thu, Oct 08, 2020 at 10:09:09AM +0200, Pavel Machek wrote:
>> Hi!
>>
>>> + int main(void)
>>> + {
>>> + struct pollfd pfd = { .events = POLLIN };
>>> + struct counter_event event_data[2];
>>> +
>>> + pfd.fd = open("/dev/counter0", O_RDWR);
>>> +
>>> + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches);
>>> + ioctl(pfd.fd, COUNTER_SET_WATCH_IOCTL, watches + 1);
>>> + ioctl(pfd.fd, COUNTER_LOAD_WATCHES_IOCTL);
>>> +
>>> + for (;;) {
>>> + poll(&pfd, 1, -1);
>>
>> Why do poll, when you are doing blocking read?
>>
>>> + read(pfd.fd, event_data, sizeof(event_data));
>>
>> Does your new chrdev always guarantee returning complete buffer?
>>
>> If so, should it behave like that?
>>
>> Best regards,
>> Pavel
>> --
>> (english) http://www.livejournal.com/~pavelmachek
>> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
>
> I suppose you're right: a poll() should be redundant now with this
> version of the character device implementation because buffers will
> always return complete; so a blocking read() should achieve the same
> behavior that a poll() with read() would.
>
> I'll give some more time for additional feedback to come in for this
> version of the patchset, and then likely remove support for poll() in
> the v6 submission.
>
> William Breathitt Gray
>
I hope that you mean that you will just remove it from the example
and not from the chardev. Otherwise it won't be possible to
integrate this with an event loop.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-12 17:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 2:18 [PATCH v5 0/5] Introduce the Counter character device interface William Breathitt Gray
2020-09-27 2:18 ` [PATCH v5 2/5] docs: counter: Update to reflect sysfs internalization William Breathitt Gray
2020-09-27 2:18 ` [PATCH v5 3/5] counter: Add character device interface William Breathitt Gray
2020-10-14 1:40 ` David Lechner
2020-10-18 16:49 ` William Breathitt Gray
2020-10-20 15:53 ` David Lechner
2020-10-25 12:55 ` William Breathitt Gray
2020-10-25 16:36 ` David Lechner
2020-10-14 17:43 ` David Lechner
2020-10-14 19:05 ` William Breathitt Gray
2020-10-14 22:32 ` David Lechner
2020-10-14 22:40 ` David Lechner
2020-10-18 16:58 ` William Breathitt Gray
2020-10-20 16:06 ` David Lechner
2020-10-25 13:18 ` William Breathitt Gray
2020-10-25 16:34 ` David Lechner
2020-10-25 17:53 ` William Breathitt Gray
2020-09-27 2:18 ` [PATCH v5 4/5] docs: counter: Document " William Breathitt Gray
2020-10-08 8:09 ` Pavel Machek
2020-10-08 12:28 ` William Breathitt Gray
2020-10-12 17:04 ` David Lechner [this message]
2020-10-13 18:58 ` William Breathitt Gray
2020-10-13 19:08 ` David Lechner
2020-10-13 19:27 ` William Breathitt Gray
2020-09-27 2:18 ` [PATCH v5 5/5] counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 William Breathitt Gray
2020-10-14 0:13 ` David Lechner
2020-10-18 14:50 ` William Breathitt Gray
2020-10-13 0:35 ` [PATCH v5 0/5] Introduce the Counter character device interface David Lechner
2020-10-18 14:14 ` William Breathitt Gray
[not found] ` <e38f6dc3a08bf2510034334262776a6ed1df8b89.1601170670.git.vilhelm.gray@gmail.com>
2020-10-13 2:15 ` [PATCH v5 1/5] counter: Internalize sysfs interface code David Lechner
2020-10-18 14:49 ` William Breathitt Gray
2020-10-20 15:38 ` David Lechner
2020-10-23 13:12 ` William Breathitt Gray
2020-10-15 1:38 ` David Lechner
2020-10-18 17:00 ` William Breathitt Gray
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=d06d5e47-5776-85ee-0dc5-8b624e36d83d@lechnology.com \
--to=david@lechnology.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@st.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=kamel.bouhara@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=patrick.havelange@essensium.com \
--cc=pavel@ucw.cz \
--cc=syednwaris@gmail.com \
--cc=vilhelm.gray@gmail.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;
as well as URLs for NNTP newsgroup(s).