aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-02 22:00:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-02 22:00:29 -0400
commitf7572da502916e6abac06d698c0b6a7119cea0c1 (patch)
tree5c6d729ed7bb6cc06a1f5f7bd3cfa81e1eff1337
parentc000131c711f68cb68712e6553ddce5fa6ad5c5c (diff)
parent8e29da9ee8958cc17e27f4053420f1c982614793 (diff)
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: i2c: Fix bad hint about irqs in i2c.h i2c: Documentation: fix device matching description
-rw-r--r--Documentation/i2c/writing-clients18
-rw-r--r--include/linux/i2c.h2
2 files changed, 15 insertions, 5 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index ee75cbace28..d4cd4126d1a 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -25,12 +25,23 @@ routines, and should be zero-initialized except for fields with data you
25provide. A client structure holds device-specific information like the 25provide. A client structure holds device-specific information like the
26driver model device node, and its I2C address. 26driver model device node, and its I2C address.
27 27
28/* iff driver uses driver model ("new style") binding model: */
29
30static struct i2c_device_id foo_idtable[] = {
31 { "foo", my_id_for_foo },
32 { "bar", my_id_for_bar },
33 { }
34};
35
36MODULE_DEVICE_TABLE(i2c, foo_idtable);
37
28static struct i2c_driver foo_driver = { 38static struct i2c_driver foo_driver = {
29 .driver = { 39 .driver = {
30 .name = "foo", 40 .name = "foo",
31 }, 41 },
32 42
33 /* iff driver uses driver model ("new style") binding model: */ 43 /* iff driver uses driver model ("new style") binding model: */
44 .id_table = foo_ids,
34 .probe = foo_probe, 45 .probe = foo_probe,
35 .remove = foo_remove, 46 .remove = foo_remove,
36 47
@@ -173,10 +184,9 @@ handle may be used during foo_probe(). If foo_probe() reports success
173(zero not a negative status code) it may save the handle and use it until 184(zero not a negative status code) it may save the handle and use it until
174foo_remove() returns. That binding model is used by most Linux drivers. 185foo_remove() returns. That binding model is used by most Linux drivers.
175 186
176Drivers match devices when i2c_client.driver_name and the driver name are 187The probe function is called when an entry in the id_table name field
177the same; this approach is used in several other busses that don't have 188matches the device's name. It is passed the entry that was matched so
178device typing support in the hardware. The driver and module name should 189the driver knows which one in the table matched.
179match, so hotplug/coldplug mechanisms will modprobe the driver.
180 190
181 191
182Device Creation (Standard driver model) 192Device Creation (Standard driver model)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fb9af6a0fe9..8dc73013219 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -171,7 +171,7 @@ struct i2c_client {
171 struct i2c_adapter *adapter; /* the adapter we sit on */ 171 struct i2c_adapter *adapter; /* the adapter we sit on */
172 struct i2c_driver *driver; /* and our access routines */ 172 struct i2c_driver *driver; /* and our access routines */
173 struct device dev; /* the device structure */ 173 struct device dev; /* the device structure */
174 int irq; /* irq issued by device (or -1) */ 174 int irq; /* irq issued by device */
175 struct list_head list; /* DEPRECATED */ 175 struct list_head list; /* DEPRECATED */
176 struct completion released; 176 struct completion released;
177}; 177};