Question: Where to put MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT, and appropriate statements for linux-2.6.0 kernel? 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? i2c-voodoo3 from lm_sensors also uses module_init() and module_exit(). The v3tv module does mot use these, but other modules in the v3tv package do. Should these functions be added to the v3tv module rather than usage count? voodoo3_i2c_adapter is the more important one at this time, but I think usage should be incremented for voodoo3_ddc_adapter as well. We can just concentrate on the i2c adapter. voodoo.c does include functions voodoo3_inc and voodoo3_dec, but I think I'll omit them now, and eventually remove them all together later. Now I need to consider where to update usgae count in the register functions. voodoo-i2c.c has this function: static int voodoo3_i2c_client_register(struct i2c_client *client) { short i; for (i = 0; i < V3_MAX_I2C_CLIENTS; i++) { if (voodoo->i2c_clients[i] == NULL || voodoo->i2c_clients[i]->driver->id == client->driver->id) { voodoo->i2c_clients[i] = client; if (debug) { printk("voodoo.o: attach client: %s at slot %d\n", client->name, i); } if (client->driver->id == I2C_DRIVERID_TUNER) { int type; switch (model) { case VOODOO3_MODEL_NTSC: type = TUNER_PHILIPS_NTSC; break; case VOODOO3_MODEL_PAL: type = TUNER_SAMSUNG_PAL; break; case VOODOO3_MODEL_SECAM: type = TUNER_PHILIPS_SECAM; break; default: type = TUNER_ABSENT; break; } voodoo_call_i2c_client (I2C_DRIVERID_TUNER, TUNER_SET_TYPE, &type); } return 0; } } return -ENODEV; } Would this be right placed before the return 0; ? if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) MOD_INC_USE_COUNT; #else if (!try_module_get(THIS_MODULE)) { dprintk(1, KERN_ERR "voodoo3: failed to increment usecount\n"); return NULL; } #endif If this is good, do I need to assign struct member voodoo3_i2c_adapter.owner = THIS_MODULE first? Thanks for any input, Perry Gilfillan --------------------- Here are a few links to the files I've refered to. v3tv/voodoo.c http://gilfillan.org:8000/v3tv/voodoo.c v3tv/voodoo-i2c.c http://gilfillan.org:8000/v3tv/voodoo-i2c.c linux-2.6.0/drivers/i2c/busses/i2c-voodoo3.c http://gilfillan.org:8000/v3tv/i2c-voodoo3.c -- ______________________________________________ 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/