Re: [PATCH] RFC: Attributes in /sys/cdev

Jonathan Corbet
2003-09-22T16:46:12Z

> > I have no idea whether this follows the original plan for /sys/cdev.
>
> They are more of a side effect.

So...to be sure I have things straight.../sys/cdev isn't really meant to be
there, and char devices wanting to do things in sysfs should be working
under /sys/devices or /sys/class or /sys/somethingelse?

> * driver has embedded struct cdev in its data structures

> * ->open() can use ->i_cdev to get whatever data structure driver
> had intended and avoid any lookups of its own

I noticed there's no "private" member in the cdev structure. So drivers
should embed the structure and use container_of to get their real structure
of interest?

[Forgive my ignorance here...] If I embed a struct cdev within my own
device structure, how do I know when I can safely free said device
structure? Will there be a release method that gets exposed at the driver
level, or am I missing something obvious again?

Thanks,

jon

Jonathan Corbet
Executive editor, LWN.net
corbet@lwn.net