The patch number 8391 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
Improve make_config.pl script


This patch adds the capability of processing some tags that contains "if",
like:
        menuconfig foo if bar
        boolean foo if bar
        tristate foo if bar
        default foo if bar


Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 v4l/scripts/make_kconfig.pl |   47 +++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 6 deletions(-)

diff -r 1edf5aa98f5c -r a569b4afe21a v4l/scripts/make_kconfig.pl
--- a/v4l/scripts/make_kconfig.pl       Thu Jul 17 19:48:38 2008 +0200
+++ b/v4l/scripts/make_kconfig.pl       Thu Jul 17 19:18:52 2008 -0300
@@ -276,6 +276,7 @@ sub open_kconfig($$) {
        my $disabled = 0;
        my $in_help = 0;
        my $default_seen = 0;
+       my $if;
 
        print "Opening $file\n" if $debug;
        open $in, '<', $file or die "File not found: $file";
@@ -314,6 +315,7 @@ sub open_kconfig($$) {
                        $disabled = 0;
                        $default_seen = 0;
                        $key = undef;
+                       $if = "";
                }
                next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines
 
@@ -327,6 +329,7 @@ sub open_kconfig($$) {
                my $nothandled = 0;
                if (m|^\s*(?:menu)?config (\w+)\s*$|) {
                        $key = $1;
+                       $if = "";
                        print "Found config '$key' at $file:$.\n" if $debug;
                        add_config($key);
 
@@ -382,8 +385,24 @@ sub open_kconfig($$) {
                # config type
                if(/^\s*bool(ean)?\s/) {
                        add_bool($key);
+                       if (m|if (.*)\s*$|) {
+                               printf("Boolean $key with if '$1'\n") if $debug;
+                               if ($if eq "") {
+                                       $if = "($1)";
+                               } else {
+                                       $if .= " && ($1)";
+                               }
+                       }
                } elsif (/^\s*tristate\s/) {
                        add_tristate($key);
+                       if (m|if (.*)\s*$|) {
+                               printf("Boolean $key with if '$1'\n") if $debug;
+                               if ($if eq "") {
+                                       $if = "($1)";
+                               } else {
+                                       $if .= " && ($1)";
+                               }
+                       }
                } elsif (/^\s*int\s/) {
                        add_int($key);
                } elsif (/^\s*hex\s/) {
@@ -400,6 +419,14 @@ sub open_kconfig($$) {
                # default lines
                } elsif (m|^\s*default\s+(.+?)(?:\s+if .*)?\s*$|) {
                        my $o = $1;
+                       if ($2 ne "") {
+                               if ($if eq "") {
+                                       $if = "($2)";
+                               } else {
+                                       $if .= " && ($2)";
+                               }
+                       }
+
                        # Get default for int options
                        if ($o =~ m|^"(\d+)"$| && exists $intopt{$key}) {
                                set_int_value($key, $1);
@@ -412,13 +439,21 @@ sub open_kconfig($$) {
 
                        # Override default for disabled tri/bool options
                        # We don't care about the default for tri/bool options 
otherwise
-                       } elsif ($o =~ /^(y|n|m|"yes"|"no")$/i && exists 
$tristate{$key}) {
-                               if ($disabled) {
-                                       $default_seen = 1;
-                                       $_ = "\tdefault n\n";
+                       } elsif (!$o =~ /^(y|n|m|"yes"|"no")$/i && exists 
$tristate{$key}) {
+                               print "Default is an expression at $file:$. 
$_\n" if $debug;
+                               if ($if eq "") {
+                                       depends($key, "$o");
                                }
-                       } else {
-                               print "Unknown default at $file:$. $_\n" if 
$debug;
+                       }
+                       if ($if ne "") {
+                               # FIXME: What happens if no default clause 
exists?
+                               # the $if won't be handled
+                               depends($key, "$if || $o");
+                       }
+
+                       if ($disabled) {
+                               $default_seen = 1;
+                               $_ = "\tdefault n\n";
                        }
                } else {
                        print "Skipping $file:$. $_" if $debug;


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/a569b4afe21a8d1431f36e3a76c10ff5dd538c0a

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to