From a47b1c2de03e33b119325317c19474432eabdf0b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 7 Apr 2011 14:17:37 +0000 Subject: [PATCH] Refactor the detection of AMD CPU sensors. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5957 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 2e56e79f..2c0c4ee6 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2177,7 +2177,7 @@ use vars qw(@cpu_ids); }, { name => "AMD K8 thermal sensors", driver => "k8temp", - detect => \&k8temp_pci_detect, + detect => sub { amd_pci_detect('1103') }, }, { name => "AMD Family 10h thermal sensors", driver => "k10temp", @@ -2185,15 +2185,15 @@ use vars qw(@cpu_ids); }, { name => "AMD Family 11h thermal sensors", driver => "k10temp", - detect => \&fam11h_pci_detect, + detect => sub { amd_pci_detect('1303') }, }, { name => "AMD Family 12h and 14h thermal sensors", driver => "k10temp", - detect => \&fam12h_14h_pci_detect, + detect => sub { amd_pci_detect('1703') }, }, { name => "AMD Family 15h thermal sensors", driver => "k10temp", - detect => \&fam15h_pci_detect, + detect => sub { amd_pci_detect('1603') }, }, { name => "Intel digital thermal sensor", driver => "coretemp", @@ -6110,9 +6110,10 @@ sub via8231_pci_detect return 9; } -sub k8temp_pci_detect +sub amd_pci_detect { - return unless exists $pci_list{'1022:1103'}; + my $f3_id = shift; + return unless exists $pci_list{"1022:$f3_id"}; return 9; } @@ -6142,24 +6143,6 @@ sub fam10h_pci_detect return; } -sub fam11h_pci_detect -{ - return unless exists $pci_list{'1022:1303'}; - return 9; -} - -sub fam12h_14h_pci_detect -{ - return unless exists $pci_list{'1022:1703'}; - return 9; -} - -sub fam15h_pci_detect -{ - return unless exists $pci_list{'1022:1603'}; - return 9; -} - sub intel_amb_detect { if ((exists $pci_list{'8086:25f0'}) || # Intel 5000