issues dealing with kobjects
Greg KH
greg at kroah.com
Fri Jun 20 12:16:47 EDT 2014
On Fri, Jun 20, 2014 at 11:31:03AM +0530, Raghavendra wrote:
> Hello all,
>
> I am facing a small issue dealing with kobjects.
> I am writing a simple i2c driver for which I would like to export a few
> sysfs attributes(files).
Please don't, unless these attributes are something that all other i2c
drivers export and are documented in Documentation/ABI/
> The files are many, so I've decided to pack them into a directory in
> sysfs (inside the i2c device) and so I thought of kobjects.
No, please never use "raw" kobjects in a driver, use the driver core
functions instead. You can have an attribute group that is associated
with your driver or device, and the driver core will automatically
create the files for you (in a subdir if you want it), in a race-free
manner. Please use that interface instead.
thanks,
greg k-h
More information about the Kernelnewbies
mailing list