Porting Device Driver to 2.6

Alex Holeczy alex at wmi.com
Wed Apr 20 09:26:56 EDT 2005

On Wed, 20 Apr 2005, Dominik Brodowski wrote:

> On Wed, Apr 20, 2005 at 08:41:53AM -0400, Alex Holeczy wrote:
>> On Wed, 20 Apr 2005, Dominik Brodowski wrote:
>>> On Mon, Apr 18, 2005 at 11:59:00AM -0400, Alex Holeczy wrote:
>>>> How do you register the device release function for a generic device under
>>>> kernel 2.6?  It appears that sound cards have a method for registering a
>>>> free function.
>>>> Using the kernel 2.4 there was a 'release' element in the dev_link_t
>>>> structure used to register the device release function.  The 'release'
>>>> element does not exists in the dev_link_t structure for the 2.6 kernel.
>>> Yes, there was, but it was using a timer which is not the preferred way of
>>> doing things. For what purposes do you need it exactly?
>> In the 2.4 kernel environment, the release() function was used to free any
>> resources allocated by a call to the config() function.  The release()
>> function would only free resources if the device was not currently opened.
>> The release() would also call the detach(), if the detach() function was
>> called prior to the resource being closed.
>> I thought that in the 2.6 kernel, the release() function would be required
>> to perform the same function.
> OK, I now understand what you mean. Thanks. 2.6. now serializes this
> behaviour - release() should be called within detach(); however, the
> allocation and freeing of memory (kfree) should be done outside of this. As
> you're writing a sound device driver, I'd suggest that you keep close to
> what the other two PCMCIA sound drivers already do.

I am not developing a 2.6 kernel device driver for a sound card, so 
keeping close to the other two PCMCIA sound drivers may not work.  I have 
been using these source files as a guide.  They have been very beneficial 
in the development process.  The device driver is for a DSP card our 
company makes.

If the detach() function is suppose to call the release() function and the 
release() function is not suppose to free any resources allocated by the 
config() function for the device.

Where should I free the device specific resources?

By 'serialize this behavior', do you mean that the detach() function 
should not be called by the 2.6 kernel if the device is still open?



Alex Holeczy (alex at wmi.com)

Communication Automation Corporation (CAC)      www.cacdsp.com www.wmi.com
1180 McDermott Drive, West Chester, PA  19380

800-367-6735 Ext. 122 or 610-692-9526 Ext. 122 (Voice)
610-436-8258 (Fax) 

More information about the linux-pcmcia mailing list