[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090113233620.GA17949@suse.de>
Date: Tue, 13 Jan 2009 15:36:20 -0800
From: Greg KH <gregkh@...e.de>
To: Ben Dooks <ben-linux@...ff.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: driver creating directories under a device entry
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists