From 3ee60a6facca671e45e4fd634f13355b35047c0c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 27 Nov 2008 17:53:36 +0000 Subject: [PATCH] Don't create module options for bus drivers we don't even need to load. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5443 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index dfc2f192..1b89d3fc 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -5141,31 +5141,6 @@ sub generate_modprobes my ($isa, $ipmi); my ($modprobes, $configfile); - # Handle aliases - # As of kernel 2.6.28, alias detection is handled by kernel drivers - # directly, so module options are no longer needed. - unless (kernel_version_at_least(2, 6, 28)) { - foreach $chip (@chips_detected) { - @optionlist = (); - foreach $detection (@{$chip->{detected}}) { - if (exists $detection->{i2c_driver} and - exists $detection->{isa_addr}) { - push @optionlist, $detection->{i2c_devnr}, - $detection->{i2c_addr}; - } - } - - next if not @optionlist; - $configfile = "# hwmon module options\n" unless defined $configfile; - $configfile .= "options $chip->{driver}"; - $configfile .= sprintf(" ignore=%d,0x%02x", shift @optionlist, - shift @optionlist); - $configfile .= sprintf(",%d,0x%02x", shift @optionlist, - shift @optionlist) while @optionlist; - $configfile .= "\n"; - } - } - foreach $chip (@chips_detected) { foreach $detection (@{$chip->{detected}}) { # Tag adapters which host hardware monitoring chips we want to access @@ -5183,6 +5158,32 @@ sub generate_modprobes } } + # Handle aliases + # As of kernel 2.6.28, alias detection is handled by kernel drivers + # directly, so module options are no longer needed. + unless (kernel_version_at_least(2, 6, 28)) { + foreach $chip (@chips_detected) { + @optionlist = (); + foreach $detection (@{$chip->{detected}}) { + if (exists $detection->{i2c_driver} and + exists $detection->{isa_addr} and + $i2c_adapters[$detection->{i2c_devnr}]->{used}) { + push @optionlist, $detection->{i2c_devnr}, + $detection->{i2c_addr}; + } + } + + next if not @optionlist; + $configfile = "# hwmon module options\n" unless defined $configfile; + $configfile .= "options $chip->{driver}"; + $configfile .= sprintf(" ignore=%d,0x%02x", shift @optionlist, + shift @optionlist); + $configfile .= sprintf(",%d,0x%02x", shift @optionlist, + shift @optionlist) while @optionlist; + $configfile .= "\n"; + } + } + # If we added any module option to handle aliases, we need to load all # the adapter drivers so that the numbers will be the same. If not, then # we only load the adapter drivers which are useful.