Re: MOD_INC_USE_COUNT placement

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

 



On Sat, Dec 27, 2003 at 12:21:57PM +0600, Perry Gilfillan wrote:
> Question: Where to put MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT, and
> appropriate statements for linux-2.6.0 kernel?

No where.  Never use those macros in 2.6, they are depreciated and will
generate module warnings if you do.

> I posted an earlier question asking for help with updating the v3tv
> drivers for the Voodoo3 TV 3500 video capture card.  Here is a
> specific question.
> 
> I succeded in getting the driver to compile, install and run on
> linux-2.4.22 with I2C-2.8.1 patch applied.  In the process, refrence
> to the functions voodoo3_inc and voodoo3_dec in voodoo.c were removed
> from the struct i2c_adapter.  Now the module v3tv.o which links both
> voodoo.c and voodoo-i2c.c, does not have its usage updated.  I want to
> find the appropriate place to update module use count, and do it for
> pre and post 2.5.0 kernels.
> 
> voodoo.c does not define struct i2c_adapter.  voodoo-i2c.c defines two:
> 
> struct i2c_adapter voodoo3_i2c_adapter = {
> 	name:			"I2C Voodoo3/Banshee adapter",
> 	id:			I2C_HW_SMBUS_VOODOO3,
> 	algo_data:		&voo_i2c_bit_data,
> 	client_register:	voodoo3_i2c_client_register,
> 	client_unregister:	voodoo3_i2c_client_deregister
> };
> 
> struct i2c_adapter voodoo3_ddc_adapter = {
> 	name:		"DDC Voodoo3/Banshee adapter",
> 	id:		I2C_HW_SMBUS_VOODOO3,
> 	algo_data:	&voo_ddc_bit_data
> };
> 
> I went back and looked at the i2c implementation of i2c-voodoo3 from
> lm_sensors, and see that there is not a register or unregister
> function.  A more basic question might be, do I need to do usage
> count?

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

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

Hope this helps,

greg k-h
--
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