lkml.org 
[lkml]   [2010]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] sysfs: device-core: open - close notifier
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.



\
 
 \ /
  Last update: 2010-11-05 20:37    [W:0.033 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site