diff options
author | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2008-12-01 15:35:10 +0000 |
---|---|---|
committer | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2008-12-01 15:35:10 +0000 |
commit | cf7575df261a74c2af81d23c395419b5167dfc40 (patch) | |
tree | 7abe74780367303adf6e926586b0b26fd5d49e1c | |
parent | d611760233c56448222cf47b0c7ad4b99653d62a (diff) | |
download | lm-sensors-cf7575df261a74c2af81d23c395419b5167dfc40.tar.gz |
Simplify the generation of module options.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5491 7894878c-1315-0410-8ee3-d5d059ff63e0
-rwxr-xr-x | prog/detect/sensors-detect | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 46bb7221..caa336ee 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -4794,7 +4794,7 @@ sub print_chips_report sub generate_modprobes { - my ($chip, $detection, @optionlist, $adap); + my ($chip, $detection, $adap); my ($isa, $ipmi); my ($modprobes, $configfile); @@ -4820,27 +4820,22 @@ sub generate_modprobes # directly, so module options are no longer needed. unless (kernel_version_at_least(2, 6, 28)) { foreach $chip (@chips_detected) { - @optionlist = (); + my @optionlist = (); foreach $detection (@{$chip->{detected}}) { - if (exists $detection->{i2c_addr} and - exists $detection->{isa_addr} and - $i2c_adapters[$detection->{i2c_devnr}]->{used}) { - push @optionlist, - $detection->{i2c_devnr}, - $detection->{i2c_addr}; - } + next unless exists $detection->{i2c_addr} + && exists $detection->{isa_addr} + && $i2c_adapters[$detection->{i2c_devnr}]->{used}; + + push @optionlist, sprintf("%d,0x%02x", + $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"; + $configfile .= "options $chip->{driver} ignore=". + (join ",", @optionlist)."\n"; } } |