summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-06-01 20:27:57 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-06-01 20:27:57 -0300
commit4beebf752c257b99d8df832083d0ce9655ed017c (patch)
tree7f53c9a5cd78fa81641a5b60c6d6806f10600419 /v4l/scripts
parent6eb2e602a08b4a3d2b9bd63cde2c01716957ffca (diff)
downloadmediapointer-dvb-s2-4beebf752c257b99d8df832083d0ce9655ed017c.tar.gz
mediapointer-dvb-s2-4beebf752c257b99d8df832083d0ce9655ed017c.tar.bz2
Improve compatibility handling
From: Mauro Carvalho Chehab <mchehab@infradead.org> V4L/DVB tree keeps backward compatibility with vanilla 2.6.x kernels. However, if some API changes happens on 2.6.x.y, this wouldn't be handled. This patch improves the compatibility capabilities of the tree by allowing customized scripts to be added on make_config_compat.pl. So, when generating config-compat.h, some compat checks can be done against the kernel tree. The practical effect is allowing compilation on 2.6.17.x trees, used by several distros, where some changes on netdevice.h affects dvb-net, stopping its compilation. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-xv4l/scripts/gentree.pl5
-rw-r--r--v4l/scripts/make_config_compat.pl60
2 files changed, 64 insertions, 1 deletions
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index f9f56bd7c..08969dab3 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -64,7 +64,10 @@ my %defs = (
'CONFIG_XC3028' => 0,
'CONFIG_TUNER_TEA5761' => 0,
'I2C_CLASS_TV_ANALOG' => 1,
- 'I2C_CLASS_TV_DIGITAL' => 1);
+ 'I2C_CLASS_TV_DIGITAL' => 1,
+ 'OLD_XMIT_LOCK' => 0,
+ 'CONFIG_VIVI_SCATTER' => 0,
+);
#################################################################
# helpers
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
new file mode 100644
index 000000000..be577d247
--- /dev/null
+++ b/v4l/scripts/make_config_compat.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+use strict;
+
+my $kdir=shift or die "should specify a kernel dir";
+my $infile=shift or die "should specify an input config file";
+my $outfile=shift or die "should specify an output config file";
+
+my $out;
+
+sub check_spin_lock()
+{
+ my $file = "$kdir/include/linux/netdevice.h";
+ my $old_syntax = 1;
+
+ open INNET, "<$file" or die "File not found: $file";
+ while (<INNET>) {
+ if (m/netif_tx_lock_bh/) {
+ $old_syntax = 0;
+ last;
+ }
+ }
+
+ if ($old_syntax) {
+ $out.= "\n#define OLD_XMIT_LOCK 1\n";
+ }
+ close INNET;
+}
+
+sub check_other_dependencies()
+{
+ check_spin_lock();
+}
+
+# Do the basic rules
+open IN, "<$infile" or die "File not found: $infile";
+
+$out.= "#ifndef __CONFIG_COMPAT_H__\n";
+$out.= "#define __CONFIG_COMPAT_H__\n\n";
+$out.= "#include <linux/autoconf.h>\n\n";
+while(<IN>) {
+ next unless /^(\S+)\s*:= (\S+)$/;
+ $out.= "#undef $1\n";
+ $out.= "#undef $1_MODULE\n";
+ if($2 eq "n") {
+ next;
+ } elsif($2 eq "m") {
+ $out.= "#define $1_MODULE 1\n";
+ } elsif($2 eq "y") {
+ $out.= "#define $1 1\n";
+ } else {
+ $out.= "#define $1 $2\n";
+ }
+}
+close IN;
+
+check_other_dependencies();
+
+open OUT, ">$outfile" or die 'Unable to write $outfile';
+print OUT "$out\n#endif\n";
+close OUT