X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=include%2Flinux%2Fi2c.h;h=63f1d63cc1d8cd93154d0874421e2b509c08ddfa;hb=bade5622167181844cd4e60087971c1f949e149f;hp=f88577ca3b3ad0d2670f3e392edd4d457c0dd10f;hpb=dbe0580d0d2fccf63b0349840a7ae3dbb16f3074;p=powerpc.git diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f88577ca3b..63f1d63cc1 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -31,6 +31,7 @@ #include #include #include /* for struct device */ +#include /* for completion */ #include /* --- For i2c-isa ---------------------------------------------------- */ @@ -99,19 +100,22 @@ extern s32 i2c_smbus_write_block_data(struct i2c_client * client, /* Returns the number of read bytes */ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, u8 command, u8 *values); +extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, + u8 command, u8 length, + u8 *values); /* * A driver is capable of handling one or more physical devices present on * I2C adapters. This information is used to inform the driver of adapter * events. + * + * The driver.owner field should be set to the module owner of this driver. + * The driver.name field should be set to the name of this driver. */ struct i2c_driver { - struct module *owner; - char name[32]; int id; unsigned int class; - unsigned int flags; /* div., see below */ /* Notifies the driver that a new bus has appeared. This routine * can be used by the driver to test if the bus meets its conditions @@ -249,18 +253,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) dev_set_drvdata (&dev->dev, data); } -/*flags for the driver struct: */ -#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ -#if 0 -/* this flag is gone -- there is a (optional) driver->detach_adapter - * callback now which can be used instead */ -# define I2C_DF_DUMMY 0x02 -#endif - /*flags for the client struct: */ -#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ -#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */ - /* on an i2c_client */ #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ /* Must equal I2C_M_TEN below */ @@ -301,26 +294,20 @@ struct i2c_client_address_data { extern int i2c_add_adapter(struct i2c_adapter *); extern int i2c_del_adapter(struct i2c_adapter *); -extern int i2c_add_driver(struct i2c_driver *); +extern int i2c_register_driver(struct module *, struct i2c_driver *); extern int i2c_del_driver(struct i2c_driver *); +static inline int i2c_add_driver(struct i2c_driver *driver) +{ + return i2c_register_driver(THIS_MODULE, driver); +} + extern int i2c_attach_client(struct i2c_client *); extern int i2c_detach_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 - -struct. */ -extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, - struct i2c_client *prev); - -/* Should be used with new function - extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); - to make sure that client-struct is valid and that it is okay to access - the i2c-client. - returns -EACCES if client doesn't allow use (default) - returns -EBUSY if client doesn't allow multiple use (default) and - usage_count >0 */ +/* Should be used to make sure that client-struct is valid and that it + is okay to access the i2c-client. + returns -ENODEV if client has gone in the meantime */ extern int i2c_use_client(struct i2c_client *); extern int i2c_release_client(struct i2c_client *);