Fix r5847 was incomplete. Handling misdetections that happen after

correct detections isn't sufficient, we also have to handle
misdetections which happen first. In that case, we must delete the
driver entry as we remove the last misdetection from it.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5849 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2010-07-05 18:40:44 +00:00
1 parent f11a2a6d3a
commit 96ff880b93
1 file changed
+5 -2
+5 -2
View File
@@ -2951,7 +2951,7 @@ use vars qw(%chips_detected);
sub add_i2c_to_chips_detected
{
my ($chipdriver, $datahash) = @_;
my ($i, $detected_ref, $detected_entry,
my ($i, $detected_ref, $detected_entry, $driver,
$put_in_detected, @hash_addrs, @entry_addrs);
# Find out whether our new entry should go into the detected list
@@ -2984,7 +2984,8 @@ sub add_i2c_to_chips_detected
# Here, we discard all entries which match at least in one main or
# sub address. This may not be the best idea to do, as it may remove
# detections without replacing them with second-best ones. Too bad.
foreach $detected_ref (values %chips_detected) {
foreach $driver (keys %chips_detected) {
$detected_ref = $chips_detected{$driver};
for ($i = @$detected_ref-1; $i >=0; $i--) {
next unless defined $detected_ref->[$i]->{i2c_addr};
@entry_addrs = ($detected_ref->[$i]->{i2c_addr});
@@ -2993,6 +2994,8 @@ sub add_i2c_to_chips_detected
if ($detected_ref->[$i]->{i2c_devnr} == $datahash->{i2c_devnr} &&
any_list_match(\@entry_addrs, \@hash_addrs)) {
splice @$detected_ref, $i, 1;
delete $chips_detected{$driver}
if (!@$detected_ref);
}
}
}