diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-02 19:00:29 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-02 19:00:29 -0700 |
commit | f7572da502916e6abac06d698c0b6a7119cea0c1 (patch) | |
tree | 5c6d729ed7bb6cc06a1f5f7bd3cfa81e1eff1337 /Documentation | |
parent | c000131c711f68cb68712e6553ddce5fa6ad5c5c (diff) | |
parent | 8e29da9ee8958cc17e27f4053420f1c982614793 (diff) | |
download | linux-f7572da502916e6abac06d698c0b6a7119cea0c1.tar.gz linux-f7572da502916e6abac06d698c0b6a7119cea0c1.tar.bz2 linux-f7572da502916e6abac06d698c0b6a7119cea0c1.zip |
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
Diffstat (limited to 'Documentation')
-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 provide. A client structure holds device-specific information like the driver model device node, and its I2C address. +/* iff driver uses driver model ("new style") binding model: */ + +static struct i2c_device_id foo_idtable[] = { + { "foo", my_id_for_foo }, + { "bar", my_id_for_bar }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, foo_idtable); + static struct i2c_driver foo_driver = { .driver = { .name = "foo", }, /* iff driver uses driver model ("new style") binding model: */ + .id_table = foo_ids, .probe = foo_probe, .remove = foo_remove, @@ -173,10 +184,9 @@ handle may be used during foo_probe(). If foo_probe() reports success (zero not a negative status code) it may save the handle and use it until foo_remove() returns. That binding model is used by most Linux drivers. -Drivers match devices when i2c_client.driver_name and the driver name are -the same; this approach is used in several other busses that don't have -device typing support in the hardware. The driver and module name should -match, so hotplug/coldplug mechanisms will modprobe the driver. +The probe function is called when an entry in the id_table name field +matches the device's name. It is passed the entry that was matched so +the driver knows which one in the table matched. Device Creation (Standard driver model) |