linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* clarity on kref needed.
@ 2006-01-18  6:57 Mukund JB.
  2006-01-18 15:51 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Mukund JB. @ 2006-01-18  6:57 UTC (permalink / raw)
  To: linux-kernel


Dear All,

I have gone through kref and am planning to implement then in my usb driver.
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.

kref_put(&dev->kref);
	increment the refcount.

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.
Is it correct? I mean, when is the mem_release () called i.e. when the refcount is '0' or '1'.

Thanks & Regards,
Mukund Jampala


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clarity on kref needed.
  2006-01-18  6:57 clarity on kref needed Mukund JB.
@ 2006-01-18 15:51 ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2006-01-18 15:51 UTC (permalink / raw)
  To: Mukund JB.; +Cc: linux-kernel

On Wed, Jan 18, 2006 at 12:27:45PM +0530, Mukund JB. wrote:
> 
> Dear All,
> 
> I have gone through kref and am planning to implement then in my usb driver.

What kind of usb driver?

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clarity on kref needed.
  2006-01-19  7:00 Mukund JB.
@ 2006-01-19 15:55 ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2006-01-19 15:55 UTC (permalink / raw)
  To: Mukund JB.; +Cc: linux-kernel

On Thu, Jan 19, 2006 at 12:30:40PM +0530, Mukund JB. wrote:
> 
> Can you give me some pointers & documentation links for HOWTO using
> libusb/usbfs instead of a kernel driver.

Try reading the libusb documentation.  If you have further questions,
try the libusb developer mailing list.

good luck,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: clarity on kref needed.
@ 2006-01-19  7:00 Mukund JB.
  2006-01-19 15:55 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Mukund JB. @ 2006-01-19  7:00 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel


Can you give me some pointers & documentation links for HOWTO using libusb/usbfs instead of a kernel driver.

Regards,
Mukund Jampala

> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Thursday, January 19, 2006 11:03 AM
> To: Mukund JB.
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: clarity on kref needed.
> 
> 
> On Thu, Jan 19, 2006 at 10:35:37AM +0530, Mukund JB. wrote:
> > 
> > 
> > > -----Original Message-----
> > > From: Greg KH [mailto:greg@kroah.com]
> > > Sent: Thursday, January 19, 2006 10:33 AM
> > > To: Mukund JB.
> > > Cc: linux-kernel@vger.kernel.org
> > > Subject: Re: clarity on kref needed.
> > > 
> > > 
> > > On Thu, Jan 19, 2006 at 10:15:51AM +0530, Mukund JB. wrote:
> > > > 
> > > > > > 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.
> > > 
> > > You shouldn't need a kernel driver for this, it can be done 
> > > in userspace
> > > with libusb/usbfs, right?
> > 
> > I mean I will register a char driver. I will just write a 
> simple char
> > kernel module to read data from the USB device and zero 
> copy it to the
> > userspace application. I guess that is the minimum work we 
> need to do.
> 
> You can do that from userspace with libusb/usbfs with no kernel driver
> needed.  Why not do that instead?
> 
> > Is there any other way using libusb/usbfs in which we can do this
> > without a need of USB kernel driver?
> 
> Yes, use libusb/usbfs :)
> 
> > > > 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/Docum
> > entation/kref.txt
> > > >
> > > >Is kref depricated because I find nothing related to it 
> in linux/Documentation/?
> > 
> > > What kernel version are you looking at?  Look in the 
> kernel source tree
> > > from kernel.org.  What kernel tree are you building your 
> driver against.
> > 
> > I am planning it for 2.6.11.12.
> 
> That's a pretty old kernel version, why not use the latest version?
> 
> thanks,
> 
> greg k-h
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clarity on kref needed.
  2006-01-19  5:05 Mukund JB.
@ 2006-01-19  5:33 ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2006-01-19  5:33 UTC (permalink / raw)
  To: Mukund JB.; +Cc: linux-kernel

On Thu, Jan 19, 2006 at 10:35:37AM +0530, Mukund JB. wrote:
> 
> 
> > -----Original Message-----
> > From: Greg KH [mailto:greg@kroah.com]
> > Sent: Thursday, January 19, 2006 10:33 AM
> > To: Mukund JB.
> > Cc: linux-kernel@vger.kernel.org
> > Subject: Re: clarity on kref needed.
> > 
> > 
> > On Thu, Jan 19, 2006 at 10:15:51AM +0530, Mukund JB. wrote:
> > > 
> > > > > 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.
> > 
> > You shouldn't need a kernel driver for this, it can be done 
> > in userspace
> > with libusb/usbfs, right?
> 
> I mean I will register a char driver. I will just write a simple char
> kernel module to read data from the USB device and zero copy it to the
> userspace application. I guess that is the minimum work we need to do.

You can do that from userspace with libusb/usbfs with no kernel driver
needed.  Why not do that instead?

> Is there any other way using libusb/usbfs in which we can do this
> without a need of USB kernel driver?

Yes, use libusb/usbfs :)

> > > 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/Docum
> entation/kref.txt
> > >
> > >Is kref depricated because I find nothing related to it in linux/Documentation/?
> 
> > What kernel version are you looking at?  Look in the kernel source tree
> > from kernel.org.  What kernel tree are you building your driver against.
> 
> I am planning it for 2.6.11.12.

That's a pretty old kernel version, why not use the latest version?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: clarity on kref needed.
@ 2006-01-19  5:05 Mukund JB.
  2006-01-19  5:33 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Mukund JB. @ 2006-01-19  5:05 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel



> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Thursday, January 19, 2006 10:33 AM
> To: Mukund JB.
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: clarity on kref needed.
> 
> 
> On Thu, Jan 19, 2006 at 10:15:51AM +0530, Mukund JB. wrote:
> > 
> > > > 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.
> 
> You shouldn't need a kernel driver for this, it can be done 
> in userspace
> with libusb/usbfs, right?

I mean I will register a char driver. I will just write a simple char kernel module to read data from the USB device and
zero copy it to the userspace application. I guess that is the minimum work we need to do.

Is there any other way using libusb/usbfs in which we can do this without a need of USB kernel driver? 

> > 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/Docum
entation/kref.txt
> >
> >Is kref depricated because I find nothing related to it in linux/Documentation/?

> What kernel version are you looking at?  Look in the kernel source tree
> from kernel.org.  What kernel tree are you building your driver against.

I am planning it for 2.6.11.12.

Regards,
Mukund Jampala

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clarity on kref needed.
  2006-01-19  4:45 Mukund JB.
@ 2006-01-19  5:03 ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2006-01-19  5:03 UTC (permalink / raw)
  To: Mukund JB.; +Cc: linux-kernel

On Thu, Jan 19, 2006 at 10:15:51AM +0530, Mukund JB. wrote:
> 
> > > 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.

You shouldn't need a kernel driver for this, it can be done in userspace
with libusb/usbfs, right?

> 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/?

What kernel version are you looking at?  Look in the kernel source tree
from kernel.org.  What kernel tree are you building your driver against.

And no, it's not depreciated at all.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: clarity on kref needed.
@ 2006-01-19  4:45 Mukund JB.
  2006-01-19  5:03 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Mukund JB. @ 2006-01-19  4:45 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel


> > 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
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-19 16:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-18  6:57 clarity on kref needed Mukund JB.
2006-01-18 15:51 ` Greg KH
2006-01-19  4:45 Mukund JB.
2006-01-19  5:03 ` Greg KH
2006-01-19  5:05 Mukund JB.
2006-01-19  5:33 ` Greg KH
2006-01-19  7:00 Mukund JB.
2006-01-19 15:55 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).