From 84fed9daa3606f2409e480e04096e856a5792649 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 29 Dec 2002 19:50:56 -0800 Subject: [PATCH] fix i2c module handling Add a struct module *owner field to struct i2c_adapter and i2c_algorithm and do refcouting on them before use instead of the inc_use and dec_use callbacks. While at it convert those structures to named initializers. --- include/linux/i2c.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'include/linux') diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ab69e01bc8c3..d343349836e2 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -132,6 +132,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, */ struct i2c_driver { + struct module *owner; char name[32]; int id; unsigned int flags; /* div., see below */ @@ -155,18 +156,6 @@ struct i2c_driver { * with the device. */ int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); - - /* These two are mainly used for bookkeeping & dynamic unloading of - * kernel modules. inc_use tells the driver that a client is being - * used by another module & that it should increase its ref. counter. - * dec_use is the inverse operation. - * NB: Make sure you have no circular dependencies, or else you get a - * deadlock when trying to unload the modules. - * You should use the i2c_{inc,dec}_use_client functions instead of - * calling this function directly. - */ - void (*inc_use)(struct i2c_client *client); - void (*dec_use)(struct i2c_client *client); }; /* @@ -232,16 +221,13 @@ struct proc_dir_entry; * with the access algorithms necessary to access it. */ struct i2c_adapter { + struct module *owner; char name[32]; /* some useful name to identify the adapter */ unsigned int id;/* == is algo->id | hwdep.struct->id, */ /* for registered values see below */ struct i2c_algorithm *algo;/* the algorithm to access the bus */ void *algo_data; - /* --- These may be NULL, but should increase the module use count */ - void (*inc_use)(struct i2c_adapter *); - void (*dec_use)(struct i2c_adapter *); - /* --- administration stuff. */ int (*client_register)(struct i2c_client *); int (*client_unregister)(struct i2c_client *); @@ -319,12 +305,6 @@ extern int i2c_del_driver(struct i2c_driver *); extern int i2c_attach_client(struct i2c_client *); extern int i2c_detach_client(struct i2c_client *); -/* Only call these if you grab a resource that makes unloading the - client and the adapter it is on completely impossible. Like when a - /proc directory is entered. */ -extern void i2c_inc_use_client(struct i2c_client *); -extern void i2c_dec_use_client(struct i2c_client *); - /* New function: This is to get an i2c_client-struct for controlling the client either by using i2c_control-function or having the client-module export functions that can be used with the i2c_client -- cgit v1.2.3