1 /*
2 * some i2c layer compatibility stuff -- to avoid cluttering up the
3 * i2c modules with tons of #ifdefs
4 */
5
6
i2c_get_adapdata(struct i2c_adapter * dev)7 static inline void *i2c_get_adapdata(struct i2c_adapter *dev)
8 {
9 return dev->data;
10 }
11
i2c_set_adapdata(struct i2c_adapter * dev,void * data)12 static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
13 {
14 dev->data = data;
15 }
16
i2c_get_clientdata(struct i2c_client * dev)17 static inline void *i2c_get_clientdata(struct i2c_client *dev)
18 {
19 return dev->data;
20 }
21
i2c_set_clientdata(struct i2c_client * dev,void * data)22 static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
23 {
24 dev->data = data;
25 }
26
27 #define I2C_DEVNAME(str) .name = str
28
i2c_clientname(struct i2c_client * c)29 static inline char *i2c_clientname(struct i2c_client *c)
30 {
31 return c->name;
32 }
33
i2c_clients_command(struct i2c_adapter * adap,unsigned int cmd,void * arg)34 static inline void i2c_clients_command(struct i2c_adapter *adap,
35 unsigned int cmd, void *arg)
36 {
37 int i;
38
39 for (i = 0; i < I2C_CLIENT_MAX; i++) {
40 if (NULL == adap->clients[i])
41 continue;
42 if (NULL == adap->clients[i]->driver->command)
43 continue;
44 adap->clients[i]->driver->command(adap->clients[i],cmd,arg);
45 }
46 }
47
48
49 /*
50 * Local variables:
51 * c-basic-offset: 8
52 * End:
53 */
54