The patch number 10841 was added via Mauro Carvalho Chehab <mche...@redhat.com>
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:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Mauro Carvalho Chehab  <mche...@redhat.com>
Improve script to automatically adjust the Kconfig files


There are still some more hacking to do, in order to use this automatically, 
since
more logic is needed for dibcom and av7110 stuff.

Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 v4l/scripts/fix_dvb_customise.pl |   89 ++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 6 deletions(-)

diff -r e2c92027e556 -r eca111e0372e v4l/scripts/fix_dvb_customise.pl
--- a/v4l/scripts/fix_dvb_customise.pl  Sun Mar 08 12:55:29 2009 -0300
+++ b/v4l/scripts/fix_dvb_customise.pl  Sun Mar 08 13:10:43 2009 -0300
@@ -110,10 +110,6 @@ sub get_header_deps()
                print "$_ " foreach %header_deps;
                print "\n";
        }
-
-print "Header deps for av7110.h: ";
-print "$_ " foreach $header_deps{"av7110.h"};
-print "\n";
 }
 
 
@@ -161,6 +157,8 @@ sub parse_makefiles()
 ########################
 # Seeks files for header
 #
+my %select;
+
 sub found_ref($$)
 {
        my $file = shift;
@@ -170,7 +168,7 @@ sub found_ref($$)
        $name =~ s|.*/||;
 
        $name =~ s/flexcop-fe-tuner.c/b2c2-flexcop/;
-       $name =~ s/av7110.c/av7110/;
+       $name =~ s/av7110.c/av7110.h/;
 
        if (defined ($header_deps{$name})) {
                $name = $header_deps{$name};
@@ -182,7 +180,17 @@ sub found_ref($$)
        foreach my $n (@files) {
                if (defined($driver_config{$n})) {
                        my $ref = $driver_config{$n};
-                       printf "$ref needs %s\n", $header;
+                       printf "$ref needs %s\n", $header if ($debug);
+
+                       if ($ref =~ m/(PVRUSB2|CX23885|CX88|EM28XX|SAA3134)/) {
+                               $ref .="_DVB";
+                       }
+
+                       if (!defined($select{$ref})) {
+                               $select{$ref} = $header;
+                       } else {
+                               $select{$ref} .= " " . $header;
+                       }
                        $found = 1;
                }
        }
@@ -215,6 +223,74 @@ sub parse_headers()
                }
        }
        close IN;
+}
+
+########################
+# Rewrite Kconfig's
+#
+
+sub parse_kconfigs()
+{
+       my $file = $File::Find::name;
+       my $conf;
+       my $out = "";
+       my $tmp = "";
+       my $all_sels;
+
+       return if !($file =~ m/Kconfig$/);
+       return if ($file =~ m|drivers/media/dvb/frontends/|);
+
+       open IN, $file or die "Can't open $file\n";
+       while (<IN>) {
+               if (m/^config\s([A-Za-z_\-\d]+)/) {
+                       $out .= $tmp;
+                       if (defined($select{$1})) {
+                               $conf = $select{$1};
+                               $all_sels = " ". $conf. " ";
+                               $tmp = $_;
+
+                               printf "$file: rewriting headers for $1. It 
should select: %s\n", $all_sels if ($debug);
+                       } else {
+                               $conf = "";
+                               $out .= $_;
+                               $tmp = "";
+                       }
+                       next;
+               }
+               if (!$conf) {
+                       $out .= $_;
+                       next;
+               }
+
+               if (m/^\s*select\s+([A-Za-z_\-\d]+)/) {
+                       my  $op = $1;
+
+                       if (!$all_sels =~ m/\s($op)\s/) {
+                               # Drops line
+                               printf "$file: droppingg line $_\n";
+
+                               next;
+                       } else {
+                               $all_sels =~ s/\s($op)\s/ /;
+                       }
+               }
+               if (m/^[\s\-]*help/) {
+                       my @sel = split(/\s/, $all_sels);
+                       foreach my $s (@sel) {
+                               if ($s ne "") {
+                                       printf "$file: Adding select for $s\n";
+                                       $tmp .= "\tselect $s if 
!DVB_FE_CUSTOMISE\n";
+                               }
+                       }
+               }
+               $tmp .= $_;
+       }
+       close IN;
+
+       $out .=$tmp;
+       open OUT, ">$file" or die "Can't open $file\n";
+       print OUT $out;
+       close OUT;
 }
 
 #####
@@ -255,3 +331,4 @@ foreach my $fe (keys %$FEs) {
 
 find({wanted => \&parse_makefiles, no_chdir => 1}, $SRC);
 find({wanted => \&parse_headers, no_chdir => 1}, $SRC);
+find({wanted => \&parse_kconfigs, no_chdir => 1}, $SRC);


---

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

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

Reply via email to