From: Greg KH <gregkh@suse.de>
To: Ben Dooks <ben-linux@fluff.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: driver creating directories under a device entry
Date: Tue, 13 Jan 2009 15:36:20 -0800 [thread overview]
Message-ID: <20090113233620.GA17949@suse.de> (raw)
In-Reply-To: <20090113232734.GS12431@fluff.org.uk>
On Tue, Jan 13, 2009 at 11:27:34PM +0000, Ben Dooks wrote:
> I have a driver which uses sysfs_create_dir() to create a set of
> directories under the device sysfs directory to bundle up attributes
> that are added common for each sub-part of the device.
>
> Firstly, is this considered a problem
Yes and no.
> Secondly, sysfs_create_dir() is not exported so the driver cannot
> currently be built as a module. Would a patch to export sysfs_create_dir
> be acceptable?
No :)
The problem is, you are probably creating these attributes _after_
userspace has been notified that the device is present, right? So that
causes a not-so-nice race.
To do this properly, use an attribute group, name it (that will cause it
to show up in a subdirectory), attach it to the device, and then it will
be created automatically when the device is registered with the driver
core, at the proper time to then notify userspace that the device, and
all of its attributes, are present.
Does this help?
thanks,
greg k-h
prev parent reply other threads:[~2009-01-13 23:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 23:27 driver creating directories under a device entry Ben Dooks
2009-01-13 23:36 ` Greg KH [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=20090113233620.GA17949@suse.de \
--to=gregkh@suse.de \
--cc=ben-linux@fluff.org \
--cc=linux-kernel@vger.kernel.org \
/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