Re: [PATCH 1/1] tpm: implement use of sysfs classes

Greg KH
2005-02-04T22:11:15Z

On Fri, Feb 04, 2005 at 03:37:20PM -0600, Kylene Hall wrote:
> On Fri, 2005-02-04 at 14:52, Greg KH wrote:
> > On Fri, Feb 04, 2005 at 02:12:50PM -0600, Kylene Hall wrote:
> > > +static struct class tpm_class = {
> > > + .name = "tpm",
> > > + .class_dev_attrs = tpm_attrs,
> > > +};
> >
> > Where is your release function? Did you see any warnings from the
> > kernel when you removed any of these class devices? Why did you ignore
> > it?
> >
> Sorry, I missed the warning message. I have looked at some other
> instances for what I might need to put in that function and I'm
> stumped. I didn't kmalloc my class_device structure so I don't need to
> kfree it.

How do you create the structure that contains the class device? What
will happen if a user holds a reference to the class device and your
structure holding that class device goes away?

Ick, I think I agree more and more with Al Viro that exposing this kind
of stuff to developers was a big mistake...

Anyway, why not try using the class_simple interface instead? If you do
that you don't have to worry (as much) in the reference counting logic.

thanks,

greg k-h