Commit 2ed2dc3c116d26fc6a9384e83d136b15cc203b6c
Committed by
Greg Kroah-Hartman
1 parent
b78ec31582
Exists in
master
and in
7 other branches
[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>
Showing 35 changed files with 50 additions and 58 deletions Side-by-side Diff
- Documentation/i2c/porting-clients
- Documentation/i2c/writing-clients
- drivers/hwmon/adm1021.c
- drivers/hwmon/adm1025.c
- drivers/hwmon/adm1026.c
- drivers/hwmon/adm1031.c
- drivers/hwmon/adm9240.c
- drivers/hwmon/asb100.c
- drivers/hwmon/atxp1.c
- drivers/hwmon/ds1621.c
- drivers/hwmon/fscher.c
- drivers/hwmon/fscpos.c
- drivers/hwmon/gl518sm.c
- drivers/hwmon/gl520sm.c
- drivers/hwmon/it87.c
- drivers/hwmon/lm63.c
- drivers/hwmon/lm75.c
- drivers/hwmon/lm77.c
- drivers/hwmon/lm78.c
- drivers/hwmon/lm80.c
- drivers/hwmon/lm83.c
- drivers/hwmon/lm85.c
- drivers/hwmon/lm87.c
- drivers/hwmon/lm90.c
- drivers/hwmon/lm92.c
- drivers/hwmon/max1619.c
- drivers/hwmon/w83781d.c
- drivers/hwmon/w83792d.c
- drivers/hwmon/w83l785ts.c
- drivers/i2c/chips/ds1337.c
- drivers/i2c/chips/eeprom.c
- drivers/i2c/chips/max6875.c
- drivers/i2c/chips/pca9539.c
- drivers/i2c/chips/pcf8574.c
- drivers/i2c/chips/pcf8591.c
Documentation/i2c/porting-clients
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | if (!(adapter->class & I2C_CLASS_HWMON)) |
67 | 67 | return 0; |
68 | 68 | ISA-only drivers of course don't need this. |
69 | + Call i2c_probe() instead of i2c_detect(). | |
69 | 70 | |
70 | 71 | * [Detect] As mentioned earlier, the flags parameter is gone. |
71 | 72 | The type_name and client_name strings are replaced by a single |
Documentation/i2c/writing-clients
... | ... | @@ -148,7 +148,7 @@ |
148 | 148 | detection algorithm. |
149 | 149 | |
150 | 150 | You do not have to use this parameter interface; but don't try to use |
151 | -function i2c_probe() (or i2c_detect()) if you don't. | |
151 | +function i2c_probe() if you don't. | |
152 | 152 | |
153 | 153 | NOTE: If you want to write a `sensors' driver, the interface is slightly |
154 | 154 | different! See below. |
155 | 155 | |
... | ... | @@ -259,17 +259,10 @@ |
259 | 259 | return i2c_probe(adapter,&addr_data,&foo_detect_client); |
260 | 260 | } |
261 | 261 | |
262 | -For `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 | - | |
269 | 262 | Remember, structure `addr_data' is defined by the macros explained above, |
270 | 263 | so you do not have to define it yourself. |
271 | 264 | |
272 | -The i2c_probe or i2c_detect function will call the foo_detect_client | |
265 | +The i2c_probe function will call the foo_detect_client | |
273 | 266 | function only for those i2c addresses that actually have a device on |
274 | 267 | them (unless a `force' parameter was used). In addition, addresses that |
275 | 268 | are already in use (by some other registered client) are skipped. |
... | ... | @@ -278,11 +271,9 @@ |
278 | 271 | The detect client function |
279 | 272 | -------------------------- |
280 | 273 | |
281 | -The detect client function is called by i2c_probe or i2c_detect. | |
282 | -The `kind' parameter contains 0 if this call is due to a `force' | |
283 | -parameter, and -1 otherwise (for i2c_detect, it contains 0 if | |
284 | -this call is due to the generic `force' parameter, and the chip type | |
285 | -number if it is due to a specific `force' parameter). | |
274 | +The detect client function is called by i2c_probe. The `kind' parameter | |
275 | +contains -1 for a probed detection, 0 for a forced detection, or a positive | |
276 | +number for a forced detection with a chip type forced. | |
286 | 277 | |
287 | 278 | Below, some things are only needed if this is a `sensors' driver. Those |
288 | 279 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ |
drivers/hwmon/adm1021.c
... | ... | @@ -187,7 +187,7 @@ |
187 | 187 | { |
188 | 188 | if (!(adapter->class & I2C_CLASS_HWMON)) |
189 | 189 | return 0; |
190 | - return i2c_detect(adapter, &addr_data, adm1021_detect); | |
190 | + return i2c_probe(adapter, &addr_data, adm1021_detect); | |
191 | 191 | } |
192 | 192 | |
193 | 193 | static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/adm1025.c
drivers/hwmon/adm1026.c
... | ... | @@ -321,7 +321,7 @@ |
321 | 321 | if (!(adapter->class & I2C_CLASS_HWMON)) { |
322 | 322 | return 0; |
323 | 323 | } |
324 | - return i2c_detect(adapter, &addr_data, adm1026_detect); | |
324 | + return i2c_probe(adapter, &addr_data, adm1026_detect); | |
325 | 325 | } |
326 | 326 | |
327 | 327 | int adm1026_detach_client(struct i2c_client *client) |
drivers/hwmon/adm1031.c
... | ... | @@ -727,10 +727,10 @@ |
727 | 727 | { |
728 | 728 | if (!(adapter->class & I2C_CLASS_HWMON)) |
729 | 729 | return 0; |
730 | - return i2c_detect(adapter, &addr_data, adm1031_detect); | |
730 | + return i2c_probe(adapter, &addr_data, adm1031_detect); | |
731 | 731 | } |
732 | 732 | |
733 | -/* This function is called by i2c_detect */ | |
733 | +/* This function is called by i2c_probe */ | |
734 | 734 | static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind) |
735 | 735 | { |
736 | 736 | struct i2c_client *new_client; |
drivers/hwmon/adm9240.c
... | ... | @@ -635,7 +635,7 @@ |
635 | 635 | { |
636 | 636 | if (!(adapter->class & I2C_CLASS_HWMON)) |
637 | 637 | return 0; |
638 | - return i2c_detect(adapter, &addr_data, adm9240_detect); | |
638 | + return i2c_probe(adapter, &addr_data, adm9240_detect); | |
639 | 639 | } |
640 | 640 | |
641 | 641 | static int adm9240_detach_client(struct i2c_client *client) |
drivers/hwmon/asb100.c
... | ... | @@ -621,7 +621,7 @@ |
621 | 621 | { |
622 | 622 | if (!(adapter->class & I2C_CLASS_HWMON)) |
623 | 623 | return 0; |
624 | - return i2c_detect(adapter, &addr_data, asb100_detect); | |
624 | + return i2c_probe(adapter, &addr_data, asb100_detect); | |
625 | 625 | } |
626 | 626 | |
627 | 627 | static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, |
drivers/hwmon/atxp1.c
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | |
255 | 255 | static int atxp1_attach_adapter(struct i2c_adapter *adapter) |
256 | 256 | { |
257 | - return i2c_detect(adapter, &addr_data, &atxp1_detect); | |
257 | + return i2c_probe(adapter, &addr_data, &atxp1_detect); | |
258 | 258 | }; |
259 | 259 | |
260 | 260 | static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/ds1621.c
... | ... | @@ -181,10 +181,10 @@ |
181 | 181 | |
182 | 182 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) |
183 | 183 | { |
184 | - return i2c_detect(adapter, &addr_data, ds1621_detect); | |
184 | + return i2c_probe(adapter, &addr_data, ds1621_detect); | |
185 | 185 | } |
186 | 186 | |
187 | -/* This function is called by i2c_detect */ | |
187 | +/* This function is called by i2c_probe */ | |
188 | 188 | int ds1621_detect(struct i2c_adapter *adapter, int address, |
189 | 189 | int kind) |
190 | 190 | { |
drivers/hwmon/fscher.c
... | ... | @@ -289,7 +289,7 @@ |
289 | 289 | { |
290 | 290 | if (!(adapter->class & I2C_CLASS_HWMON)) |
291 | 291 | return 0; |
292 | - return i2c_detect(adapter, &addr_data, fscher_detect); | |
292 | + return i2c_probe(adapter, &addr_data, fscher_detect); | |
293 | 293 | } |
294 | 294 | |
295 | 295 | static int fscher_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/fscpos.c
... | ... | @@ -436,7 +436,7 @@ |
436 | 436 | { |
437 | 437 | if (!(adapter->class & I2C_CLASS_HWMON)) |
438 | 438 | return 0; |
439 | - return i2c_detect(adapter, &addr_data, fscpos_detect); | |
439 | + return i2c_probe(adapter, &addr_data, fscpos_detect); | |
440 | 440 | } |
441 | 441 | |
442 | 442 | int fscpos_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/gl518sm.c
... | ... | @@ -348,7 +348,7 @@ |
348 | 348 | { |
349 | 349 | if (!(adapter->class & I2C_CLASS_HWMON)) |
350 | 350 | return 0; |
351 | - return i2c_detect(adapter, &addr_data, gl518_detect); | |
351 | + return i2c_probe(adapter, &addr_data, gl518_detect); | |
352 | 352 | } |
353 | 353 | |
354 | 354 | static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/gl520sm.c
... | ... | @@ -520,7 +520,7 @@ |
520 | 520 | { |
521 | 521 | if (!(adapter->class & I2C_CLASS_HWMON)) |
522 | 522 | return 0; |
523 | - return i2c_detect(adapter, &addr_data, gl520_detect); | |
523 | + return i2c_probe(adapter, &addr_data, gl520_detect); | |
524 | 524 | } |
525 | 525 | |
526 | 526 | static int gl520_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/it87.c
... | ... | @@ -698,7 +698,7 @@ |
698 | 698 | { |
699 | 699 | if (!(adapter->class & I2C_CLASS_HWMON)) |
700 | 700 | return 0; |
701 | - return i2c_detect(adapter, &addr_data, it87_detect); | |
701 | + return i2c_probe(adapter, &addr_data, it87_detect); | |
702 | 702 | } |
703 | 703 | |
704 | 704 | static int it87_isa_attach_adapter(struct i2c_adapter *adapter) |
... | ... | @@ -738,7 +738,7 @@ |
738 | 738 | return err; |
739 | 739 | } |
740 | 740 | |
741 | -/* This function is called by i2c_detect */ | |
741 | +/* This function is called by i2c_probe */ | |
742 | 742 | int it87_detect(struct i2c_adapter *adapter, int address, int kind) |
743 | 743 | { |
744 | 744 | int i; |
drivers/hwmon/lm63.c
drivers/hwmon/lm75.c
... | ... | @@ -109,10 +109,10 @@ |
109 | 109 | { |
110 | 110 | if (!(adapter->class & I2C_CLASS_HWMON)) |
111 | 111 | return 0; |
112 | - return i2c_detect(adapter, &addr_data, lm75_detect); | |
112 | + return i2c_probe(adapter, &addr_data, lm75_detect); | |
113 | 113 | } |
114 | 114 | |
115 | -/* This function is called by i2c_detect */ | |
115 | +/* This function is called by i2c_probe */ | |
116 | 116 | static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) |
117 | 117 | { |
118 | 118 | int i; |
drivers/hwmon/lm77.c
... | ... | @@ -209,10 +209,10 @@ |
209 | 209 | { |
210 | 210 | if (!(adapter->class & I2C_CLASS_HWMON)) |
211 | 211 | return 0; |
212 | - return i2c_detect(adapter, &addr_data, lm77_detect); | |
212 | + return i2c_probe(adapter, &addr_data, lm77_detect); | |
213 | 213 | } |
214 | 214 | |
215 | -/* This function is called by i2c_detect */ | |
215 | +/* This function is called by i2c_probe */ | |
216 | 216 | static int lm77_detect(struct i2c_adapter *adapter, int address, int kind) |
217 | 217 | { |
218 | 218 | struct i2c_client *new_client; |
drivers/hwmon/lm78.c
... | ... | @@ -478,7 +478,7 @@ |
478 | 478 | { |
479 | 479 | if (!(adapter->class & I2C_CLASS_HWMON)) |
480 | 480 | return 0; |
481 | - return i2c_detect(adapter, &addr_data, lm78_detect); | |
481 | + return i2c_probe(adapter, &addr_data, lm78_detect); | |
482 | 482 | } |
483 | 483 | |
484 | 484 | static int lm78_isa_attach_adapter(struct i2c_adapter *adapter) |
... | ... | @@ -486,7 +486,7 @@ |
486 | 486 | return lm78_detect(adapter, isa_address, -1); |
487 | 487 | } |
488 | 488 | |
489 | -/* This function is called by i2c_detect */ | |
489 | +/* This function is called by i2c_probe */ | |
490 | 490 | int lm78_detect(struct i2c_adapter *adapter, int address, int kind) |
491 | 491 | { |
492 | 492 | int i, err; |
drivers/hwmon/lm80.c
... | ... | @@ -391,7 +391,7 @@ |
391 | 391 | { |
392 | 392 | if (!(adapter->class & I2C_CLASS_HWMON)) |
393 | 393 | return 0; |
394 | - return i2c_detect(adapter, &addr_data, lm80_detect); | |
394 | + return i2c_probe(adapter, &addr_data, lm80_detect); | |
395 | 395 | } |
396 | 396 | |
397 | 397 | int lm80_detect(struct i2c_adapter *adapter, int address, int kind) |
drivers/hwmon/lm83.c
drivers/hwmon/lm85.c
... | ... | @@ -1012,7 +1012,7 @@ |
1012 | 1012 | { |
1013 | 1013 | if (!(adapter->class & I2C_CLASS_HWMON)) |
1014 | 1014 | return 0; |
1015 | - return i2c_detect(adapter, &addr_data, lm85_detect); | |
1015 | + return i2c_probe(adapter, &addr_data, lm85_detect); | |
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | int lm85_detect(struct i2c_adapter *adapter, int address, |
drivers/hwmon/lm87.c
drivers/hwmon/lm90.c
drivers/hwmon/lm92.c
... | ... | @@ -389,7 +389,7 @@ |
389 | 389 | { |
390 | 390 | if (!(adapter->class & I2C_CLASS_HWMON)) |
391 | 391 | return 0; |
392 | - return i2c_detect(adapter, &addr_data, lm92_detect); | |
392 | + return i2c_probe(adapter, &addr_data, lm92_detect); | |
393 | 393 | } |
394 | 394 | |
395 | 395 | static int lm92_detach_client(struct i2c_client *client) |
drivers/hwmon/max1619.c
drivers/hwmon/w83781d.c
drivers/hwmon/w83792d.c
drivers/hwmon/w83l785ts.c
drivers/i2c/chips/ds1337.c
drivers/i2c/chips/eeprom.c
... | ... | @@ -152,10 +152,10 @@ |
152 | 152 | |
153 | 153 | static int eeprom_attach_adapter(struct i2c_adapter *adapter) |
154 | 154 | { |
155 | - return i2c_detect(adapter, &addr_data, eeprom_detect); | |
155 | + return i2c_probe(adapter, &addr_data, eeprom_detect); | |
156 | 156 | } |
157 | 157 | |
158 | -/* This function is called by i2c_detect */ | |
158 | +/* This function is called by i2c_probe */ | |
159 | 159 | int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) |
160 | 160 | { |
161 | 161 | struct i2c_client *new_client; |
drivers/i2c/chips/max6875.c
... | ... | @@ -161,10 +161,10 @@ |
161 | 161 | |
162 | 162 | static int max6875_attach_adapter(struct i2c_adapter *adapter) |
163 | 163 | { |
164 | - return i2c_detect(adapter, &addr_data, max6875_detect); | |
164 | + return i2c_probe(adapter, &addr_data, max6875_detect); | |
165 | 165 | } |
166 | 166 | |
167 | -/* This function is called by i2c_detect */ | |
167 | +/* This function is called by i2c_probe */ | |
168 | 168 | static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) |
169 | 169 | { |
170 | 170 | struct i2c_client *real_client; |
drivers/i2c/chips/pca9539.c
... | ... | @@ -108,10 +108,10 @@ |
108 | 108 | |
109 | 109 | static int pca9539_attach_adapter(struct i2c_adapter *adapter) |
110 | 110 | { |
111 | - return i2c_detect(adapter, &addr_data, pca9539_detect); | |
111 | + return i2c_probe(adapter, &addr_data, pca9539_detect); | |
112 | 112 | } |
113 | 113 | |
114 | -/* This function is called by i2c_detect */ | |
114 | +/* This function is called by i2c_probe */ | |
115 | 115 | static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) |
116 | 116 | { |
117 | 117 | struct i2c_client *new_client; |
drivers/i2c/chips/pcf8574.c
... | ... | @@ -112,10 +112,10 @@ |
112 | 112 | |
113 | 113 | static int pcf8574_attach_adapter(struct i2c_adapter *adapter) |
114 | 114 | { |
115 | - return i2c_detect(adapter, &addr_data, pcf8574_detect); | |
115 | + return i2c_probe(adapter, &addr_data, pcf8574_detect); | |
116 | 116 | } |
117 | 117 | |
118 | -/* This function is called by i2c_detect */ | |
118 | +/* This function is called by i2c_probe */ | |
119 | 119 | int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind) |
120 | 120 | { |
121 | 121 | struct i2c_client *new_client; |
drivers/i2c/chips/pcf8591.c
... | ... | @@ -163,10 +163,10 @@ |
163 | 163 | */ |
164 | 164 | static int pcf8591_attach_adapter(struct i2c_adapter *adapter) |
165 | 165 | { |
166 | - return i2c_detect(adapter, &addr_data, pcf8591_detect); | |
166 | + return i2c_probe(adapter, &addr_data, pcf8591_detect); | |
167 | 167 | } |
168 | 168 | |
169 | -/* This function is called by i2c_detect */ | |
169 | +/* This function is called by i2c_probe */ | |
170 | 170 | int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind) |
171 | 171 | { |
172 | 172 | struct i2c_client *new_client; |