RE: USB-skeleton kref query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg, 

>> Dear Linux Team,
>>
>> I am trying to understand the USB Architecture and write my own
client
>> driver under Linux and some mew concepts of 2.6.x.
>
>What kind of "client driver"?

Thanks for the response. Delayed as I was out these days.
It is a USB based finger print authentication device.

>> My point of about kref
>> ----------------------
>> Used when the multiple threads are involved within the driver.
>> I am not sure whether this can be when there are no thread within the
>> driver and to control the Process synchronization. Can I get some
>> clarity on this?
>
>Have you read the kref documentation that is in the kernel tree:
>	Documentation/kref.txt

I am unsing 2.6.11.12. I found none.

>That should explain how they should be used.
>
>> Main Question
>> -------------
>> I have seen that kref_init () is issues in probe.	// no issue with
>> this
>>
>> Device memory allocation and Kref_get() call are issued in open
context.
>> Fine.ok.
>>
>> In that case kref_put should be called in close context or any error
>> context. Right?
>> Yes, I find these two being issued in the usb-skeleton driver.
>>
>> But, I find additional kref_put() call in disconnect? That too
without
>> any condition checking? Why do I need it here?
>
>Because the disconnect call to kref_put() matches the call to
>kref_init() in probe.  If you don't do this, you will leak memory.

Thanks, that clear. So I guess, kref_put() will call the registered
function when the refcount is '0'.

>Also, have you read the Linux USB documentation?  It's automatically
>built for you when you run:
>	make psdocs
>or
>	make pdfdocs
>and will be in the Documentation/DocBook/usb.* file

I will look at them. 

- Mukund Jampala



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux