From f3557e8748785f4d92bcfad80becf953561bb2e7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 17 Jun 2006 08:45:59 -0300 Subject: Hex handling is different from int From: Mauro Carvalho Chehab Kernel handling of hex type passes those values prefixed with 0x to the modules. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_kconfig.pl | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'v4l') diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl index 228e0aa48..4511f0def 100755 --- a/v4l/scripts/make_kconfig.pl +++ b/v4l/scripts/make_kconfig.pl @@ -5,6 +5,7 @@ my %depend = (); my %minver = (); my %config = (); my %intopt = (); +my %hexopt = (); my %tristate = (); my $version, $level, $sublevel; @@ -32,19 +33,36 @@ sub add_int($) { my $arg=shift; - exists $config{$arg} or die "Adding unknown int/hex '$arg'"; + exists $config{$arg} or die "Adding unknown int '$arg'"; $intopt{$arg} = 0; } +sub add_hex($) +{ + my $arg=shift; + + exists $config{$arg} or die "Adding unknown hex '$arg'"; + $hexopt{$arg} = 0; +} + sub set_int_value($$) { my $key = shift; my $val = shift; - exists $intopt{$key} or die "Default for unknown int/hex option '$key'"; + exists $intopt{$key} or die "Default for unknown int option '$key'"; $intopt{$key} = $val; } +sub set_hex_value($$) +{ + my $key = shift; + my $val = shift; + + exists $hexopt{$key} or die "Default for unknown hex option '$key'"; + $hexopt{$key} = "0x".$val; +} + sub add_config($) { my $arg=shift; @@ -121,12 +139,16 @@ sub open_kconfig($$) { add_int($key); } if (m|^\s+hex\s|) { - add_int($key); + add_hex($key); } # Get default for int options - if (m|^\s+default "([[:xdigit:]]+)"| && exists $intopt{$key}) { + if (m|^\s+default "(\d+)"| && exists $intopt{$key}) { set_int_value($key, $1); } + # Get default for hex options + if (m|^\s+default "([[:xdigit:]]+)"| && exists $hexopt{$key}) { + set_hex_value($key, $1); + } # Override default for disabled tri/bool options if (m/^\s+default (y|n|m|"yes"|"no")\s+(if .*)?$/ && exists $tristate{$key} && $disabled) { @@ -281,5 +303,8 @@ if (($force_kconfig eq 1) || !open IN,".config") { while ( my ($key,$value) = each(%intopt) ) { print OUT "CONFIG_$key=$value\n"; } + while ( my ($key,$value) = each(%hexopt) ) { + print OUT "CONFIG_$key=$value\n"; + } close OUT; } -- cgit v1.2.3