[linux-dvb] [PATCH] Fix for hex config options in make_kconfig.pl

Trent Piepho xyzzy at speakeasy.org
Fri Jun 9 07:11:19 CEST 2006


The regex for int and hex option defaults was only correct for int
options, it didn't handle hex characters.

The kernel version code was outputing "default n" lines for disabled hex
and int options, it should only be done for boolean and tristate options.
-------------- next part --------------
# HG changeset patch
# User Trent Piepho <xyzzy at speakeasy.org>
# Node ID 8c8cbdc3f374eb552384b5a109c93260a8ce3fd9
# Parent  be3193295e155021465e3949abe84ad046eaa0a7
Hex option defaults weren't handled correct in make_kconfig

From: Trent Piepho <xyzzy at speakeasy.org>

The regex for int and hex option defaults was only correct for int
options, it didn't handle hex characters.

The kernel version code was outputing "default n" lines for disabled hex
and int options, it should only be done for boolean and tristate options.

Signed-off-by: Trent Piepho <xyzzy at speakeasy.org>

diff -r be3193295e15 -r 8c8cbdc3f374 v4l/scripts/make_kconfig.pl
--- a/v4l/scripts/make_kconfig.pl	Thu Jun  8 21:53:07 2006 -0700
+++ b/v4l/scripts/make_kconfig.pl	Thu Jun  8 22:08:15 2006 -0700
@@ -32,7 +32,7 @@ sub add_int($)
 {
 	my $arg=shift;
 
-	exists $config{$arg} or die "Adding unknown int '$arg'";
+	exists $config{$arg} or die "Adding unknown int/hex '$arg'";
 	$intopt{$arg} = 0;
 }
 
@@ -41,7 +41,7 @@ sub set_int_value($$)
 	my $key = shift;
 	my $val = shift;
 
-	exists $intopt{$key} or die "Default for unknown int option '$key'";
+	exists $intopt{$key} or die "Default for unknown int/hex option '$key'";
 	$intopt{$key} = $val;
 }
 
@@ -124,7 +124,7 @@ sub open_kconfig($$) {
 			add_int($key);
 		}
 		# Get default for int options
-		if (m|^\s+default "(\d+)"| && exists $intopt{$key}) {
+		if (m|^\s+default "([[:xdigit:]]+)"| && exists $intopt{$key}) {
 			set_int_value($key, $1);
 		}
 		# Override default for disabled tri/bool options
@@ -138,7 +138,9 @@ sub open_kconfig($$) {
 		# we need to make sure we've disabled it, and add a bit
 		# to the help text
 		if (m|^\s*(---)?help(---)?\s*$| && $disabled) {
-			print OUT "\tdefault n\n" unless($default_seen);
+		    	if(exists $tristate{$key} && !$default_seen) {
+				print OUT "\tdefault n\n";
+			}
 			print OUT <<"EOF";
 	depends on VIDEO_KERNEL_VERSION
 	help


More information about the linux-dvb mailing list