From: Linus Walleij <linus.walleij@linaro.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Alexandre Courbot <gnurou@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] gpio: chardev: Return error for seek operations
Date: Fri, 2 Dec 2016 13:37:10 +0100 [thread overview]
Message-ID: <CACRpkdZYrrCKFJp5kHSWeJNo7HCxqZcfZ331Rzepo2DQj6tF2A@mail.gmail.com> (raw)
In-Reply-To: <1480507521-17766-1-git-send-email-lars@metafoo.de>
On Wed, Nov 30, 2016 at 1:05 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> The GPIO chardev is used for management tasks (allocating line and event
> handles) and does neither support read() nor write() operations. Hence it
> does not make much sense to allow seek operations.
>
> Currently the chardev uses noop_llseek() for its seek implementation. This
> function does not move the pointer and simply returns the current position
> (always 0 for the GPIO chardev). noop_llseek() is primarily meant for
> devices that can not support seek, but where there might be a user that
> depends on the seek() operation succeeding. For newly added devices that
> can not support seek operations it is recommended to use no_llseek(), which
> will return an error. For more information see commit 6038f373a3dc
> ("llseek: automatically add .llseek fop").
>
> Unfortunately this was overlooked when the GPIO chardev ABI was introduced.
> But it is highly unlikely that since then userspace applications have
> appeared that rely on being able to perform non-failing seek operations on
> a GPIO chardev file descriptor. So it should be safe to change from
> noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev
> open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags
> from the file. Neither of these should be set on a file that does not
> support seek operations.
>
> Fixes: 3c702e9987e2 ("gpio: add a userspace chardev ABI for GPIOs")
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
> Ideally this gets added to stable as well to get a consistent ABI
> throughout.
Thanks Lars-Peter, I applied this and tagged it for stable.
Yours,
Linus Walleij
prev parent reply other threads:[~2016-12-02 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 12:05 [PATCH] gpio: chardev: Return error for seek operations Lars-Peter Clausen
2016-11-30 12:13 ` Lars-Peter Clausen
2016-12-02 12:37 ` Linus Walleij [this message]
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=CACRpkdZYrrCKFJp5kHSWeJNo7HCxqZcfZ331Rzepo2DQj6tF2A@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=arnd@arndb.de \
--cc=gnurou@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-gpio@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 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).