linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Westermann, Oliver" <Oliver.Westermann@cognex.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: Assign line names at runtime
Date: Fri, 12 Jan 2024 20:31:05 +0800	[thread overview]
Message-ID: <20240112123105.GA66782@rigel> (raw)
In-Reply-To: <CAMRc=MfeZTynTrdQdMqqvsMYsNo5yHgo+LzuRdqYpg-oZC+f6A@mail.gmail.com>

On Fri, Jan 12, 2024 at 12:26:55PM +0100, Bartosz Golaszewski wrote:
> On Fri, Jan 12, 2024 at 1:36 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Thu, Jan 11, 2024 at 04:52:24PM +0000, Westermann, Oliver wrote:
> > > Hey and thanks for your responses, those are actually quite insightful.
> > >
> > > What I read from that is that changing line names really has a lot of
> > > implications.
> > >
> >
> > After sleeping on it, I don't think line renaming is actually such a big issue.
> >
> > Firstly, hot plugging means the line namespace is never going to be
> > static, even if I was tacitly assuming it was.  Turns out I don't think
> > that matters as much as I thought anyway.  We just need to make sure the
> > user is aware of it as well.
> >
> > The analogy I would use is files in a filesystem, where the chip
> > corresponds to a directory and the line a file.  We aren't terribly
> > concerned that a file may be renamed while we do a find, or while
> > opening or using a file, so it should be the same for a line.
> >
> > We rename a file through the directory, so it makes sense to rename the
> > line through the chip, and not require the line to be requested.
> > So we would add a new ioctl on the chip to perform the rename.
> > Could make that more general in case we ever add something else to line
> > info that isn't controlled by requesting the line, but I'm note sure the
> > additional complexity would be worth it, given how unlikely that is.
> > But I digress...
> >
> > We don't inform a user with an open file that it may have been renamed
> > while open, so neither would we with the line. If it is an issue for you
> > then you can add a watch on the line info, similar to using inotify
> > on the filesystem.
> >
> > The point the analogy breaks down a bit is that we allow duplicate names,
> > (I don't think anyone really wants that feature, but historically it has
> > been allowed so we're stuck with it.) but I don't think that is of any
> > consequence to this discussion.
> >
>
> This analogy is great and all but there's one issue with it - we're
> not dealing with a filesystem that everyone can modify. We have more
> or less agreed so far that we allow multiple readers of GPIO
> information but whenever there's any setting done, one needs to
> request the line for exclusive usage. Now we'd break that logic by
> allowing all users to arbitrarily rename GPIO lines and I don't like
> this.
>

Firstly, sorry if I gave the impression I'm all in on this idea - this
is still spitballing.

You are extending the analogy too far, I'm only applying it to names and how
name instability might be viewed from the user's perspective.
I was thinking it could be a deal-breaker, but if it is ok for the
filesystem then maybe not.

I have no problem considering the line name to be metadata, not data (line
configuration and value).

You aren't allowing all users - you are allowing those that have
permission to open the chip, so it can be locked down if necessary, the same
as requesting the line.

Having said all that, I am uneasy that this capability could be abused,
particularly in ways we can't anticipate.
So I'm at the point that I think we could do it, one way or another, but
much less certain if we should.
I would not consider it if there was an alternative.

Cheers,
Kent.

  reply	other threads:[~2024-01-12 12:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 16:52 Assign line names at runtime Westermann, Oliver
2024-01-12  0:35 ` Kent Gibson
2024-01-12 11:26   ` Bartosz Golaszewski
2024-01-12 12:31     ` Kent Gibson [this message]
2024-01-12 13:16       ` Westermann, Oliver
2024-01-18 23:48         ` Kent Gibson
  -- strict thread matches above, loose matches on Subject: below --
2024-01-11 10:42 Westermann, Oliver
2024-01-11 15:10 ` Bartosz Golaszewski
2024-01-11 16:28   ` Kent Gibson
2024-01-12  8:33 ` Alexander Dahl

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=20240112123105.GA66782@rigel \
    --to=warthog618@gmail.com \
    --cc=Oliver.Westermann@cognex.com \
    --cc=brgl@bgdev.pl \
    --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).