aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-01 17:26:30 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-01 17:26:30 -0400
commit7b4fbc50fabb810523be522fe7ec5cc40f85c7a1 (patch)
tree688fa45d9b8067d72eb462e6863cad6d2e6b84cd /include/linux/i2c.h
parent5cedb05db3c3084c9641403dd24c310a6b3ea19f (diff)
i2c: i2c stack can probe()
One of a series of I2C infrastructure updates to support enumeration using the standard Linux driver model. This patch updates probe() and associated hotplug/coldplug support, but not remove(). Nothing yet _uses_ it to create I2C devices, so those hotplug/coldplug mechanisms will be the only externally visible change. This patch will be an overall NOP since the I2C stack doesn't yet create clients/devices except as part of binding them to legacy drivers. Some code is moved earlier in the source code, helping group more of the per-device infrastructure in one place and simplifying handling per-device attributes. Terminology being adopted: "legacy drivers" create devices (i2c_client) themselves, while "new style" ones follow the driver model (the i2c_client is handed to the probe routine). It's an either/or thing; the two models don't mix, and drivers that try mixing them won't even be registered. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 563c9651dd37..8dcccc0f4822 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -113,7 +113,7 @@ struct i2c_driver {
113 * can be used by the driver to test if the bus meets its conditions 113 * can be used by the driver to test if the bus meets its conditions
114 * & seek for the presence of the chip(s) it supports. If found, it 114 * & seek for the presence of the chip(s) it supports. If found, it
115 * registers the client(s) that are on the bus to the i2c admin. via 115 * registers the client(s) that are on the bus to the i2c admin. via
116 * i2c_attach_client. 116 * i2c_attach_client. (LEGACY I2C DRIVERS ONLY)
117 */ 117 */
118 int (*attach_adapter)(struct i2c_adapter *); 118 int (*attach_adapter)(struct i2c_adapter *);
119 int (*detach_adapter)(struct i2c_adapter *); 119 int (*detach_adapter)(struct i2c_adapter *);
@@ -121,10 +121,16 @@ struct i2c_driver {
121 /* tells the driver that a client is about to be deleted & gives it 121 /* tells the driver that a client is about to be deleted & gives it
122 * the chance to remove its private data. Also, if the client struct 122 * the chance to remove its private data. Also, if the client struct
123 * has been dynamically allocated by the driver in the function above, 123 * has been dynamically allocated by the driver in the function above,
124 * it must be freed here. 124 * it must be freed here. (LEGACY I2C DRIVERS ONLY)
125 */ 125 */
126 int (*detach_client)(struct i2c_client *); 126 int (*detach_client)(struct i2c_client *);
127 127
128 /* Standard driver model interfaces, for "new style" i2c drivers.
129 * With the driver model, device enumeration is NEVER done by drivers;
130 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY)
131 */
132 int (*probe)(struct i2c_client *);
133
128 /* driver model interfaces that don't relate to enumeration */ 134 /* driver model interfaces that don't relate to enumeration */
129 void (*shutdown)(struct i2c_client *); 135 void (*shutdown)(struct i2c_client *);
130 int (*suspend)(struct i2c_client *, pm_message_t mesg); 136 int (*suspend)(struct i2c_client *, pm_message_t mesg);
@@ -148,6 +154,8 @@ struct i2c_driver {
148 * @name: Indicates the type of the device, usually a chip name that's 154 * @name: Indicates the type of the device, usually a chip name that's
149 * generic enough to hide second-sourcing and compatible revisions. 155 * generic enough to hide second-sourcing and compatible revisions.
150 * @dev: Driver model device node for the slave. 156 * @dev: Driver model device node for the slave.
157 * @driver_name: Identifies new-style driver used with this device; also
158 * used as the module name for hotplug/coldplug modprobe support.
151 * 159 *
152 * An i2c_client identifies a single device (i.e. chip) connected to an 160 * An i2c_client identifies a single device (i.e. chip) connected to an
153 * i2c bus. The behaviour is defined by the routines of the driver. 161 * i2c bus. The behaviour is defined by the routines of the driver.
@@ -163,6 +171,7 @@ struct i2c_client {
163 int usage_count; /* How many accesses currently */ 171 int usage_count; /* How many accesses currently */
164 /* to the client */ 172 /* to the client */
165 struct device dev; /* the device structure */ 173 struct device dev; /* the device structure */
174 char driver_name[KOBJ_NAME_LEN];
166 struct list_head list; 175 struct list_head list;
167 struct completion released; 176 struct completion released;
168}; 177};