aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e3a1721c8354..7c7695940ddd 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -228,7 +228,9 @@ struct i2c_client {
228 struct device dev; /* the device structure */ 228 struct device dev; /* the device structure */
229 int irq; /* irq issued by device */ 229 int irq; /* irq issued by device */
230 struct list_head detected; 230 struct list_head detected;
231#if IS_ENABLED(CONFIG_I2C_SLAVE)
231 i2c_slave_cb_t slave_cb; /* callback for slave mode */ 232 i2c_slave_cb_t slave_cb; /* callback for slave mode */
233#endif
232}; 234};
233#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 235#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
234 236
@@ -253,6 +255,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
253 255
254/* I2C slave support */ 256/* I2C slave support */
255 257
258#if IS_ENABLED(CONFIG_I2C_SLAVE)
256enum i2c_slave_event { 259enum i2c_slave_event {
257 I2C_SLAVE_REQ_READ_START, 260 I2C_SLAVE_REQ_READ_START,
258 I2C_SLAVE_REQ_READ_END, 261 I2C_SLAVE_REQ_READ_END,
@@ -269,6 +272,7 @@ static inline int i2c_slave_event(struct i2c_client *client,
269{ 272{
270 return client->slave_cb(client, event, val); 273 return client->slave_cb(client, event, val);
271} 274}
275#endif
272 276
273/** 277/**
274 * struct i2c_board_info - template for device creation 278 * struct i2c_board_info - template for device creation
@@ -404,8 +408,10 @@ struct i2c_algorithm {
404 /* To determine what the adapter supports */ 408 /* To determine what the adapter supports */
405 u32 (*functionality) (struct i2c_adapter *); 409 u32 (*functionality) (struct i2c_adapter *);
406 410
411#if IS_ENABLED(CONFIG_I2C_SLAVE)
407 int (*reg_slave)(struct i2c_client *client); 412 int (*reg_slave)(struct i2c_client *client);
408 int (*unreg_slave)(struct i2c_client *client); 413 int (*unreg_slave)(struct i2c_client *client);
414#endif
409}; 415};
410 416
411/** 417/**