From c1755fab0a585fd0fd7f84c38d8ccd395fdfcbba Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 24 Nov 2009 16:44:47 +0000 Subject: (format_bus_ids) extract it (needed for next commit) --- perl-install/standalone/harddrake2 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index 6763f77a1..02b0d08ce 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -474,10 +474,7 @@ foreach (@classes) { foreach my $field (qw(device)) { $_->{$field} = "/dev/$_->{$field}" if $_->{$field}; } - foreach my $field (qw(vendor id subvendor subid)) { - $_->{$field} = sprintf("0x%04x", $_->{$field}); - delete $_->{$field} if $_->{$field} eq "0xffff"; # 0xffff equals to '*' - } + format_bus_ids($_); if ($_->{pci_revision}) { $_->{pci_revision} = sprintf("0x%02x", $_->{pci_revision}); } else { @@ -492,6 +489,15 @@ foreach (@classes) { undef $flush_guard; +sub format_bus_ids { + my ($device) = $_; + foreach my $field (qw(vendor id subvendor subid)) { + next if !$device->{$field}; + $device->{$field} = sprintf("0x%04x", $device->{$field}); + delete $device->{$field} if $device->{$field} eq "0xffff"; # 0xffff equals to '*' + } +} + sub reap_children() { # reap zombies my $child_pid; -- cgit v1.2.1