Re: MOD_INC_USE_COUNT placement

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

 



Re: > Question: Where to put MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT, and
Re: > appropriate statements for linux-2.6.0 kernel?
Re: 
Re: No where.  Never use those macros in 2.6, they are depreciated and will
Re: generate module warnings if you do.

Greg,

I was trying to imply by saying 'appropriate statements for linux-2.6.0' that I would not use the INC/DEC macros.  I've since gone through all of the modules that make up v3tv, and added conditional statments like this:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
        if (client->adapter->owner)
                module_put(client->adapter->owner);
#else
        MOD_DEC_USE_COUNT;
#endif

This particular snip comes from voodoo-msp3400.c, which is not DEC it's usage count, and can't be unloaded.  I copied this snip back from another file where it seems to be working properly, so I don't hink there is a hidden typo in it.  Very frustrating.  The various conditionals that I've added enable v3tv to compile on 2.6.0 with the exception of voodoo-v4l.c.  Thats another topic altogether.

The question still stands, if I need to use try_module_get and module_put in voodoo.c or voodoo-i2c.c to set uasage count?

Re: 
Re: Add:
Re: 	.owner = 	THIS_MODULE,
Re: to both of those structures.  That will handle the usage count for your
Re: module properly.

I've had poor results using the .label = VALUE format.  label: VALUE seems always work.

Are you saying that by including .owner = THIS_MODULE, 2.6.0 will do usage count auto-magically?

Re: Also realize the i2c drivers changed a bit from 2.4 to 2.6, and you need
Re: to do a few different things now.  See the i2c drivers for specific
Re: examples.

The biggest set of changes between 2.4 and 2.6 that I encountered was that client->data was no longer present.  I looked at the various i2c modules in 2.6 and set conditionals like this:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
        struct msp3400c *msp  = i2c_get_clientdata(client);
#else
        struct msp3400c *msp  = (struct msp3400c*)client->data;
#endif

As I said, with this type of conditional, it compiles cleanly in 2.6.  The prtotypes of functions that call i2c_probe also changed.  Testing in 2.6 will have to wait untill I get this beast to use v4l2.

If you care to look, it's all published at http://gilfillan.org:8000/v3tv  Take note of README-260.html for asummary of changes affecting 2.6.

Thanks,

Perry

-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze
--
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