linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Enrico Weigelt, metux IT consult" <lkml@metux.net>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	zhuchangchun <zhuchangchun@cvte.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	hendychu@aliyun.coma,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: [PATCH] pinctrl: intel: Implements gpio free function
Date: Thu, 4 Apr 2019 14:52:08 +0300	[thread overview]
Message-ID: <20190404115208.GR9224@smile.fi.intel.com> (raw)
In-Reply-To: <cb643914-2c3f-0c63-13e4-8171fa9a37e7@metux.net>

On Thu, Apr 04, 2019 at 12:51:35PM +0200, Enrico Weigelt, metux IT consult wrote:
> On 03.04.19 06:13, Linus Walleij wrote:
> 
> > But the chardev on the other hand will protect you from all this.> > If the program crashes, the lines will be free:ed.> > If two scripts
> try to access the same GPIO, they will be denied.
> Right, when you want this concurrency protection and cleanup stiff
> the chardev is the better choice. But I've already had several cases
> where the simplicity of the sysfs interface is a big win - all you need
> few trivial fs operations.
> 
> That's also nice for exporting in a grid, eg. via 9P (eg. nice for
> quickly building up HIL environments)
> 
> ioctls have the bad side effect that they can't be exported via
> network in a generic way - your remote fs protocol must support all of
> them - even worse: it needs to cope with overlapping ioctl-nr's that
> can have entirely different data structures depending on the actual
> device. And now try to do that w/ reasonable effort and w/o creating
> a shared memory between server and client :p
> 
> Another interesting usecase is permission handling:
> 
> a) some ioctls need special privileges (oh, how I hate all these "if
>    (!capable(CAP_SYS_ADMIN)) ..." lines in the drivers), but you wanna
>    give some unprivileged user access to them
> b) you wanna give an unprivileged user access to specific gpio's,
>    but not to all at once.
> 
> With pure filesystem based approach, you can easly define permissions
> for each filesystem object.

Also you may consider gpiod daemon and it's socket interface, for example.
Yes, complicated, but solves above problems AFAICT.

I guess the best person, missed in Cc, Bartosz, can tell more about user space
interaction.

And btw gpiod still a good to have for other even local cases:
https://github.com/brgl/libgpiod/issues/29
https://github.com/brgl/libgpiod/issues/40
...

> Yes, these usecases aren't so common for average Jon Doe, but the gpio
> subsystem is used that way, out there in the field, and it would be bad
> if that functionality would go away someday.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2019-04-04 11:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  2:35 [PATCH] pinctrl: intel: Implements gpio free function zhuchangchun
2019-03-21  8:44 ` Mika Westerberg
2019-03-21  9:23   ` Andy Shevchenko
2019-03-22 18:32     ` Enrico Weigelt, metux IT consult
2019-03-22 19:06       ` Andy Shevchenko
2019-03-25  9:36         ` Enrico Weigelt, metux IT consult
2019-03-25 11:45           ` Andy Shevchenko
2019-04-03  4:13       ` Linus Walleij
2019-04-04 10:51         ` Enrico Weigelt, metux IT consult
2019-04-04 11:52           ` Andy Shevchenko [this message]
2019-04-04 16:03           ` Linus Walleij
     [not found]   ` <2019032119195575582546@cvte.com>
2019-03-21 12:03     ` Mika Westerberg
     [not found]       ` <2019032120213955866649@cvte.com>
2019-03-21 12:36         ` Mika Westerberg
     [not found]           ` <2019032121342663125658@cvte.com>
2019-03-21 13:56             ` Mika Westerberg
     [not found]               ` <2019032211131426883268@cvte.com>
2019-03-22 10:42                 ` Mika Westerberg
     [not found]                   ` <2019032314505202825175@cvte.com>
2019-03-23 16:48                     ` andriy.shevchenko
     [not found]                       ` <2019032517511048990383@cvte.com>
2019-03-25 11:48                         ` andriy.shevchenko
2019-03-22 18:35               ` Enrico Weigelt, metux IT consult

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=20190404115208.GR9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=hendychu@aliyun.coma \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metux.net \
    --cc=mika.westerberg@linux.intel.com \
    --cc=zhuchangchun@cvte.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).