aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/i2c/writing-clients
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-31 15:42:02 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:20 -0400
commit2ed2dc3c116d26fc6a9384e83d136b15cc203b6c (patch)
treec79308b2cfe55eaddc95c47cbcafa6e0cae27413 /Documentation/i2c/writing-clients
parentb78ec31582c60578ee1d3bb470791d6dde96ccf7 (diff)
[PATCH] hwmon: hwmon vs i2c, second round (04/11)
i2c_probe and i2c_detect now do the exact same thing and operate on the same data structure, so we can have everyone call i2c_probe. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/i2c/writing-clients')
-rw-r--r--Documentation/i2c/writing-clients19
1 files changed, 5 insertions, 14 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index 7e2a8f11c220..43d7928056ae 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -148,7 +148,7 @@ are defined in i2c.h to help you support them, as well as a generic
148detection algorithm. 148detection algorithm.
149 149
150You do not have to use this parameter interface; but don't try to use 150You do not have to use this parameter interface; but don't try to use
151function i2c_probe() (or i2c_detect()) if you don't. 151function i2c_probe() if you don't.
152 152
153NOTE: If you want to write a `sensors' driver, the interface is slightly 153NOTE: If you want to write a `sensors' driver, the interface is slightly
154 different! See below. 154 different! See below.
@@ -259,17 +259,10 @@ detected at a specific address, another callback is called.
259 return i2c_probe(adapter,&addr_data,&foo_detect_client); 259 return i2c_probe(adapter,&addr_data,&foo_detect_client);
260 } 260 }
261 261
262For `sensors' drivers, use the i2c_detect function instead:
263
264 int foo_attach_adapter(struct i2c_adapter *adapter)
265 {
266 return i2c_detect(adapter,&addr_data,&foo_detect_client);
267 }
268
269Remember, structure `addr_data' is defined by the macros explained above, 262Remember, structure `addr_data' is defined by the macros explained above,
270so you do not have to define it yourself. 263so you do not have to define it yourself.
271 264
272The i2c_probe or i2c_detect function will call the foo_detect_client 265The i2c_probe function will call the foo_detect_client
273function only for those i2c addresses that actually have a device on 266function only for those i2c addresses that actually have a device on
274them (unless a `force' parameter was used). In addition, addresses that 267them (unless a `force' parameter was used). In addition, addresses that
275are already in use (by some other registered client) are skipped. 268are already in use (by some other registered client) are skipped.
@@ -278,11 +271,9 @@ are already in use (by some other registered client) are skipped.
278The detect client function 271The detect client function
279-------------------------- 272--------------------------
280 273
281The detect client function is called by i2c_probe or i2c_detect. 274The detect client function is called by i2c_probe. The `kind' parameter
282The `kind' parameter contains 0 if this call is due to a `force' 275contains -1 for a probed detection, 0 for a forced detection, or a positive
283parameter, and -1 otherwise (for i2c_detect, it contains 0 if 276number for a forced detection with a chip type forced.
284this call is due to the generic `force' parameter, and the chip type
285number if it is due to a specific `force' parameter).
286 277
287Below, some things are only needed if this is a `sensors' driver. Those 278Below, some things are only needed if this is a `sensors' driver. Those
288parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ 279parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */