]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/i2c.h
PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle
[karo-tx-linux.git] / include / linux / i2c.h
index 28b27282496fa447498f6d30d30cf85977156f62..f4784c0fe9750446fd1a68ac291585ef6f6a7dbd 100644 (file)
@@ -47,6 +47,7 @@ struct i2c_driver;
 union i2c_smbus_data;
 struct i2c_board_info;
 
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 /*
  * The master routines are the ones normally used to transmit data to devices
  * on a bus (or read from them). Apart from two basic transfer functions to
@@ -93,6 +94,7 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client,
 extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
                                          u8 command, u8 length,
                                          const u8 *values);
+#endif /* I2C */
 
 /**
  * struct i2c_driver - represent an I2C device driver
@@ -178,8 +180,8 @@ struct i2c_driver {
  * @driver: device's driver, hence pointer to access routines
  * @dev: Driver model device node for the slave.
  * @irq: indicates the IRQ generated by this device (if any)
- * @list: list of active/busy clients (DEPRECATED)
- * @detected: member of an i2c_driver.clients list
+ * @detected: member of an i2c_driver.clients list or i2c-core's
+ *     userspace_devices list
  *
  * An i2c_client identifies a single device (i.e. chip) connected to an
  * i2c bus. The behaviour exposed to Linux is defined by the driver
@@ -195,7 +197,6 @@ struct i2c_client {
        struct i2c_driver *driver;      /* and our access routines      */
        struct device dev;              /* the device structure         */
        int irq;                        /* irq issued by device         */
-       struct list_head list;          /* DEPRECATED */
        struct list_head detected;
 };
 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -261,6 +262,7 @@ struct i2c_board_info {
        .type = dev_type, .addr = (dev_addr)
 
 
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 /* Add-on boards should register/unregister their devices; e.g. a board
  * with integrated I2C, a config eeprom, sensors, and a codec that's
  * used in conjunction with the primary hardware.
@@ -284,6 +286,7 @@ extern struct i2c_client *
 i2c_new_dummy(struct i2c_adapter *adap, u16 address);
 
 extern void i2c_unregister_device(struct i2c_client *);
+#endif /* I2C */
 
 /* Mainboard arch_initcall() code should register all its I2C devices.
  * This is done at arch_initcall time, before declaring any i2c adapters.
@@ -300,7 +303,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
 {
        return 0;
 }
-#endif
+#endif /* I2C_BOARDINFO */
 
 /*
  * The following structs are for those who like to implement new bus drivers:
@@ -339,14 +342,12 @@ struct i2c_adapter {
        /* data fields that are valid for all devices   */
        u8 level;                       /* nesting level for lockdep */
        struct mutex bus_lock;
-       struct mutex clist_lock;
 
        int timeout;                    /* in jiffies */
        int retries;
        struct device dev;              /* the adapter device */
 
        int nr;
-       struct list_head clients;       /* DEPRECATED */
        char name[48];
        struct completion dev_released;
 };
@@ -392,11 +393,16 @@ struct i2c_client_address_data {
 /* The numbers to use to set I2C bus address */
 #define ANY_I2C_BUS            0xffff
 
+/* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
+#define I2C_ADDRS(addr, addrs...) \
+       ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
+
 
 /* ----- functions exported by i2c.o */
 
 /* administration...
  */
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 extern int i2c_add_adapter(struct i2c_adapter *);
 extern int i2c_del_adapter(struct i2c_adapter *);
 extern int i2c_add_numbered_adapter(struct i2c_adapter *);
@@ -438,6 +444,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
 {
        return adap->nr;
 }
+#endif /* I2C */
 #endif /* __KERNEL__ */
 
 /**