RE: clarity on kref needed.

From: Mukund JB.
Date: Wed Jan 18 2006 - 23:53:15 EST



> > I have gone through kref and am planning to implement then
> in my usb driver.
>
> What kind of usb driver?
It is a finger print authentication USB driver. it doesn ot do the authgentication but transports data to the application which really does some processing.

No, I did not find any Documentation/kref.txt.
But I have read about kred in the link below:
http://developer.osdl.org/dev/robustmutexes/src/fusyn.hg/Documentation/kref.txt

Is kref depricated because I find nothing related to it in linux/Documentation/?

Thanks & Regards,
Mukund Jampala
>
> > please terminate my misconceptions if any by correcting the
> statements below.
> >
> > In the call below:
> > kref_init(&dev->kref);
> > sets the refcount in the kref to 1.
>
> Yes.
>
> > kref_put(&dev->kref);
> > increment the refcount.
>
> Hm, don't you mean "kref_get()" here? If so, yes, that is correct.
>
> > kref_put(&dev->kref, mem_release );
> > What I understand is when the refcount falls back to '1', only then
> > the mem_release() function will be called.
>
> No, when it falls to 0 it will be called.
>
> > Is it correct? I mean, when is the mem_release () called
> i.e. when the
> > refcount is '0' or '1'.
>
> 0. There's an OLS paper from a few years ago that describes kref in
> detail, as well as the in-kernel documentation of it (see the file
> Documentation/kref.txt). Did you read that?
>
> thanks,
>
> greg k-h
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/