public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Samu Onkalo <samu.p.onkalo@nokia.com>
Cc: hmh@hmh.eng.br, alan@linux.intel.com, gregkh@suse.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sysfs: device-core: open - close notifier
Date: Fri, 5 Nov 2010 12:34:07 -0700	[thread overview]
Message-ID: <20101105123407.44105afc.akpm@linux-foundation.org> (raw)
In-Reply-To: <1288958986-26511-1-git-send-email-samu.p.onkalo@nokia.com>

On Fri,  5 Nov 2010 14:09:46 +0200
Samu Onkalo <samu.p.onkalo@nokia.com> wrote:

> Device drivers have no idea when somebody in userspace keeps some sysfs entry
> open. The driver just receives read or write calls. The driver may want to
> control HW state based on activity so it either have to turn HW on and off
> for each sysfs access or it needs separate enable disable entry which controls
> the HW state. In cases where sysfs is used to pass some events under interrupt
> control (like proximity events from the proximity sensors) it is not enough to
> just keep sysfs entry open in userspace.

I'm unconvinced that drivers should be doing this and it could be that
once this proposal is fully understood, the verdict is "stop doing
that".  But we aren't there yet.

So please, tell us in much more detail why you believe that this form
of sysfs/device interaction is desirable.  Probably, describing the
specific example of proximity drivers would be a good way of doing this.

> This patch adds a possibility for driver to know when some sysfs entry is
> open.

The implementation itself doesn't appear to cope with multiple opens at
all.  What happens if userspace does open, open, close?  The drive has to
do its own refcounting, duplicating the VFS core's refcounting (which
might be hard to use for this purpose).

Stylistically, the use of a combined open+close handler with a mode
argument is unusual.  Separate ->open and ->close notifiers would be
more usual.


      reply	other threads:[~2010-11-05 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 12:09 [PATCH v2] sysfs: device-core: open - close notifier Samu Onkalo
2010-11-05 19:34 ` Andrew Morton [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=20101105123407.44105afc.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=hmh@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samu.p.onkalo@nokia.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