From 6c15d67bf751e01d956251cd14219a5559041056 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Mar 2009 14:08:17 +0000 Subject: [PATCH] Move dimm list creation to a separate function. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5690 7894878c-1315-0410-8ee3-d5d059ff63e0 --- eeprom/decode-dimms | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms index f6be2f8..4a3d9cb 100755 --- a/eeprom/decode-dimms +++ b/eeprom/decode-dimms @@ -1612,8 +1612,11 @@ Jean Delvare, Trent Piepho and others'); my $dimm_count = 0; -my $dir; -if (!$use_hexdump) { + +sub get_dimm_list +{ + my $dir; + if ($use_sysfs) { $dir = '/sys/bus/i2c/drivers/eeprom'; } else { @@ -1621,13 +1624,15 @@ if (!$use_hexdump) { } if (-d $dir) { - @dimm_list = split(/\s+/, `ls $dir`); + return split(/\s+/, `ls $dir`); } elsif (! -d '/sys/module/eeprom') { print "No EEPROM found, are you sure the eeprom module is loaded?\n"; exit; } } +@dimm_list = get_dimm_list() unless $use_hexdump; + for my $i (0 .. $#dimm_list) { $_ = $dimm_list[$i]; if (($use_sysfs && /^\d+-\d+$/)