diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-07-01 16:38:18 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-07-01 16:38:18 -0400 |
commit | 2260e63a2f313f416b31af80d02f02ef92d20d78 (patch) | |
tree | 77a9bd6532218f061328daaef4e54291623b40a7 | |
parent | e1441b9a41c33aa9236008a7cfe49a8e723fb397 (diff) |
i2c: Documentation: fix device matching description
The matching process described for new style clients in
Documentation/i2c/writing-clients is classed as out-of-date
as it requires the presence of an .id_table entry in the
driver's i2c_driver entry.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | Documentation/i2c/writing-clients | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index ee75cbace28d..d4cd4126d1ad 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 | |||
25 | provide. A client structure holds device-specific information like the | 25 | provide. A client structure holds device-specific information like the |
26 | driver model device node, and its I2C address. | 26 | driver model device node, and its I2C address. |
27 | 27 | ||
28 | /* iff driver uses driver model ("new style") binding model: */ | ||
29 | |||
30 | static struct i2c_device_id foo_idtable[] = { | ||
31 | { "foo", my_id_for_foo }, | ||
32 | { "bar", my_id_for_bar }, | ||
33 | { } | ||
34 | }; | ||
35 | |||
36 | MODULE_DEVICE_TABLE(i2c, foo_idtable); | ||
37 | |||
28 | static struct i2c_driver foo_driver = { | 38 | static 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 |
174 | foo_remove() returns. That binding model is used by most Linux drivers. | 185 | foo_remove() returns. That binding model is used by most Linux drivers. |
175 | 186 | ||
176 | Drivers match devices when i2c_client.driver_name and the driver name are | 187 | The probe function is called when an entry in the id_table name field |
177 | the same; this approach is used in several other busses that don't have | 188 | matches the device's name. It is passed the entry that was matched so |
178 | device typing support in the hardware. The driver and module name should | 189 | the driver knows which one in the table matched. |
179 | match, so hotplug/coldplug mechanisms will modprobe the driver. | ||
180 | 190 | ||
181 | 191 | ||
182 | Device Creation (Standard driver model) | 192 | Device Creation (Standard driver model) |