diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-08-09 14:17:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-05 12:14:25 -0400 |
commit | a89ba0bc02e82920a0f4137aa5d655ac0366cc28 (patch) | |
tree | 98489ed77a287a81ff4ad7233fd543e59e58c328 /Documentation/i2c | |
parent | 3b6c0634cc989f0735a1541ccf9288947685cab5 (diff) |
[PATCH] I2C: Rewrite i2c_probe
i2c_probe was quite complex and slow, so I rewrote it in a more
efficient and hopefully clearer way.
Note that this slightly changes the way the module parameters are
handled. This shouldn't change anything for the most common cases
though.
For one thing, the function now respects the order of the parameters
for address probing. It used to always do lower addresses first. The
new approach gives the user more control.
For another, ignore addresses don't overrule probe addresses anymore.
This could have been restored the way it was at the cost of a few more
lines of code, but I don't think it's worth it. Both lists are given
as module parameters, so a user would be quite silly to specify the
same addresses in both lists. The normal addresses list is the only
one that isn't controlled by a module parameter, thus is the only one
the user may reasonably want to remove an address from.
Another significant change is the fact that i2c_probe() will no more
stop when a detection function returns -ENODEV. Just because a driver
found a chip it doesn't support isn't a valid reason to stop all
probings for this one driver. This closes the long standing lm_sensors
ticket #1807.
http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=1807
I updated the documentation accordingly.
In terms of algorithmic complexity, the new code is way better. If
I is the ignore address count, P the probe address count, N the
normal address count and F the force address count, the old code
was doing 128 * (F + I + P + N) iterations max, while the new code
does F + P + ((I+1) * N) iterations max. For the most common case
where F, I and P are empty, this is down from 128 * N to N.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/i2c')
-rw-r--r-- | Documentation/i2c/writing-clients | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 97e138cbb2a9..077275722a7c 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -241,9 +241,10 @@ Below, some things are only needed if this is a `sensors' driver. Those | |||
241 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ | 241 | parts are between /* SENSORS ONLY START */ and /* SENSORS ONLY END */ |
242 | markers. | 242 | markers. |
243 | 243 | ||
244 | This function should only return an error (any value != 0) if there is | 244 | Returning an error different from -ENODEV in a detect function will cause |
245 | some reason why no more detection should be done anymore. If the | 245 | the detection to stop: other addresses and adapters won't be scanned. |
246 | detection just fails for this address, return 0. | 246 | This should only be done on fatal or internal errors, such as a memory |
247 | shortage or i2c_attach_client failing. | ||
247 | 248 | ||
248 | For now, you can ignore the `flags' parameter. It is there for future use. | 249 | For now, you can ignore the `flags' parameter. It is there for future use. |
249 | 250 | ||