From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/2] fs: sysfs: Add devres support
Date: Fri, 22 Nov 2013 14:53:30 -0800 [thread overview]
Message-ID: <20131122225330.GA25361@kroah.com> (raw)
In-Reply-To: <20131122224734.GB12800@core.coreip.homeip.net>
On Fri, Nov 22, 2013 at 02:47:38PM -0800, Dmitry Torokhov wrote:
> On Sat, Mar 16, 2013 at 09:21:40AM -0700, Greg Kroah-Hartman wrote:
> > On Thu, Mar 14, 2013 at 08:24:45PM -0700, Guenter Roeck wrote:
> > > Provide devres functions for device_create_file, sysfs_create_file,
> > > and sysfs_create_group plus the respective remove functions.
> > >
> > > Idea is to be able to drop calls to the remove functions from the various
> > > drivers using those calls.
> >
> > Hm, despite the fact that almost every driver that makes these calls is
> > broken? :)
> >
> > > Potential savings are substantial. There are more than 700 calls to
> > > device_remove_file in the kernel, more than 500 calls to sysfs_remove_group,
> > > and some 50 calls to sysfs_remove_file (though not all of those use dev->kobj
> > > as parameter). Expanding the API to sysfs_create_bin_file would add another 80+
> > > opportunities, and adding sysfs_create_link would create another 100 or so.
> >
> > The idea is nice, but why are these drivers adding sysfs files on their
> > own? Are they doing this in a way that is race-free with userspace
> > (i.e. creating them before userspace is told about the device), or are
> > they broken and need to have these calls added to the "default
> > device/driver/bus" attribute list for them instead?
>
> Just stumbled upon this thread...
>
> There is a need for drivers to add driver-specific attributes to a
> device. Since they are driver specific they can not go into bus or class
> or whatever default attributes that are created when device is
> instantiated, but rather attached to the device when a driver binds to
> them. An example would be a PS/2 mouse driver allowing user to control
> report rate and resolution of the device. Since it only applicable to
> PS/2 mice the knob does not belong to the generic serio layer/bus nor
> should it go into input layer as it is again PS/2 specific. So psmouse
> creates it while binding to a serio port.
Yeah, platform drivers also "need" this type of thing as well, so you
are right, I can't forbit it for everyone.
> Do we send a uevent when driver binds/unbinds from a device?
No, we don't, see kobject_actions[] for what we implement.
> If not I think we should so that userspace can check for additional
> attributes, if any.
We might be able to do a "change" event for the device itself after it
has been bound / unbound, but I don't know what userspace will do with
that information at this point in time (i.e. 10+ years without that
information...)
thanks,
greg k-h
prev parent reply other threads:[~2013-11-22 22:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 3:24 [RFC PATCH 0/2] fs: sysfs: Add devres support Guenter Roeck
2013-03-15 3:24 ` [RFC PATCH 1/2] fs: sysfs: Add support for devm_ functions Guenter Roeck
2013-03-15 3:24 ` [RFC PATCH 2/2] drivers/core: " Guenter Roeck
2013-03-16 16:21 ` [RFC PATCH 0/2] fs: sysfs: Add devres support Greg Kroah-Hartman
2013-03-16 18:12 ` Guenter Roeck
2013-03-16 19:50 ` Greg Kroah-Hartman
2013-03-16 21:25 ` Guenter Roeck
2013-03-17 6:30 ` [lm-sensors] " Guenter Roeck
2013-03-17 12:39 ` Jean Delvare
2013-03-17 13:19 ` Guenter Roeck
2013-03-17 14:54 ` Guenter Roeck
2013-03-18 8:02 ` Jean Delvare
2013-03-18 13:29 ` Guenter Roeck
2013-11-22 22:47 ` Dmitry Torokhov
2013-11-22 22:53 ` Greg Kroah-Hartman [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=20131122225330.GA25361@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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