diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2003-03-23 23:29:54 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2003-03-23 23:29:54 -0800 |
| commit | 4a149de8a5f388e7138d11ecc1f6a1e3c26ce688 (patch) | |
| tree | bae2a6ff3183e1e4e318761934175e2b69629ac5 /include/linux | |
| parent | 42382f86038cbfaa2fb37b61aba42cd6c40f6267 (diff) | |
| parent | 0f8fca15b3a93b2e2247633eb4050fb8624ea7e3 (diff) | |
Merge kroah.com:/home/greg/linux/BK/bleed-2.5
into kroah.com:/home/greg/linux/BK/i2c-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/i2c.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 0ae665586de1..bc10de846363 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -156,7 +156,6 @@ extern struct bus_type i2c_bus_type; * function is mainly used for lookup & other admin. functions. */ struct i2c_client { - char name[32]; int id; unsigned int flags; /* div., see below */ unsigned int addr; /* chip address - NOTE: 7bit */ @@ -167,11 +166,21 @@ struct i2c_client { alignment considerations */ struct i2c_adapter *adapter; /* the adapter we sit on */ struct i2c_driver *driver; /* and our access routines */ - void *data; /* for the clients */ int usage_count; /* How many accesses currently */ /* to the client */ + struct device dev; /* the device structure */ }; +#define to_i2c_client(d) container_of(d, struct i2c_client, dev) + +static inline void *i2c_get_clientdata (struct i2c_client *dev) +{ + return dev_get_drvdata (&dev->dev); +} +static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) +{ + return dev_set_drvdata (&dev->dev, data); +} /* * The following structs are for those who like to implement new bus drivers: @@ -210,7 +219,6 @@ struct i2c_algorithm { */ 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 */ @@ -220,12 +228,7 @@ struct i2c_adapter { int (*client_register)(struct i2c_client *); int (*client_unregister)(struct i2c_client *); - void *data; /* private data for the adapter */ - /* some data fields that are used by all types */ - /* these data fields are readonly to the public */ - /* and can be set via the i2c_ioctl call */ - - /* data fields that are valid for all devices */ + /* data fields that are valid for all devices */ struct semaphore bus; struct semaphore list; unsigned int flags;/* flags specifying div. data */ @@ -243,6 +246,16 @@ struct i2c_adapter { }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) +static inline void *i2c_get_adapdata (struct i2c_adapter *dev) +{ + return dev_get_drvdata (&dev->dev); +} + +static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) +{ + return dev_set_drvdata (&dev->dev, data); +} + /*flags for the driver struct: */ #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ #define I2C_DF_DUMMY 0x02 /* do not connect any clients */ |
