public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Samu Onkalo <samu.p.onkalo@nokia.com>
Cc: hmh@hmh.eng.br, alan@linux.intel.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysfs: device-core: sysfs open close notify
Date: Thu, 4 Nov 2010 06:23:39 -0700	[thread overview]
Message-ID: <20101104132339.GC10390@suse.de> (raw)
In-Reply-To: <1288861417-469-1-git-send-email-samu.p.onkalo@nokia.com>

On Thu, Nov 04, 2010 at 11:03:37AM +0200, Samu Onkalo wrote:
> Patch adds possibility for a driver to get open and close
> notifications from the sysfs accesses. Driver may need this
> information for enabling features and for runtime
> power management control.
> 
> Patch causes quite small overhead compared to current implementation.
> Sysfs_ops is enhanced with open_close notify method which causes
> some increase to static memory consumption. Sysfs attribute defition
> is not changed.
> 
> Device core is modified with open_close_notification function and
> corresponding sysfs_ops change. New macro is introduced which can
> be used to setup sysfs attributes with open_close notification
> in a device driver.
> 
> Sysfs control itself contains new optional calls to open_close_
> notifications and a function which controls the feature.
> By default nothing it changed at runtime.
> 
> Normal sysfs creation and remove functions can be used to control
> attributes in device drivers.
> 
> Change needed device drivers:
> For sysfs attributes which needs open_close_notification:
> Use DEVICE_ATTR_NOTIFY instead of DEVICE_ATTR with sysfs attributes.
> Call sysfs_set_open_notify for those attributes after the creation.

Can you somehow not have to make the extra call to
sysfs_set_open_notify?  The driver doesn't want to dig down and find the
kobject, and shouldn't have to do this.  Also, it will race with the
creation of the sysfs file and userspace opening the file before the
driver has the ability to set this marking on the file, so the driver
could never be notified of the original open and everyone involved will
be confused.

thanks,

greg k-h

  reply	other threads:[~2010-11-04 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04  9:03 [PATCH] sysfs: device-core: sysfs open close notify Samu Onkalo
2010-11-04 13:23 ` Greg KH [this message]
2010-11-04 13:32   ` samu.p.onkalo
2010-11-04 16:03     ` Greg KH
2010-11-04 16:37       ` Onkalo Samu
2010-11-04 18:27         ` Greg KH
2010-11-05  8:03   ` samu.p.onkalo

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=20101104132339.GC10390@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --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