summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-02-24 09:05:23 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-24 09:05:23 -0200
commitc1ad9834d2d8678d26d3ce2a6cf39038345c33f7 (patch)
tree4f0ef2cd6728a226c78d62abf7c463ffd3a3d403 /v4l
parent9047bbc89eed91f91b8e0e7b3341bf696515889a (diff)
parent0c10299d80fe45160d3c79fd58634ae3b1c025db (diff)
downloadmediapointer-dvb-s2-c1ad9834d2d8678d26d3ce2a6cf39038345c33f7.tar.gz
mediapointer-dvb-s2-c1ad9834d2d8678d26d3ce2a6cf39038345c33f7.tar.bz2
merge: http://linuxtv.org/hg/~hhackmann/v4l-dvb
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l')
-rw-r--r--v4l/Makefile4
-rw-r--r--v4l/compat.h49
-rwxr-xr-xv4l/scripts/gentree.pl461
-rw-r--r--v4l/versions.txt9
4 files changed, 214 insertions, 309 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index b07b592b1..f08143def 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -102,8 +102,12 @@ EXTRA_CFLAGS += -g
EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)
+# Make sure kernel's options are overridden by v4l-dvb options
EXTRA_CFLAGS += -include $(obj)/config-compat.h
+# Allow kernel version compat tests without adding #include's
+EXTRA_CFLAGS += -include linux/version.h
+
#################################################
# Kernel 2.4/2.6 specific rules
diff --git a/v4l/compat.h b/v4l/compat.h
index 6ba49e825..2b2de93a7 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -5,23 +5,14 @@
#ifndef _COMPAT_H
#define _COMPAT_H
-#include <linux/i2c-id.h>
-#include <linux/pm.h>
-#include <linux/version.h>
-#include <linux/utsname.h>
-#include <linux/sched.h>
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
# define minor(x) MINOR(x)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/delay.h>
+# include <linux/delay.h>
# define need_resched() (current->need_resched)
-
-#define work_struct tq_struct
-#else
-#include <linux/device.h>
+# define work_struct tq_struct
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
@@ -58,6 +49,10 @@
# define PCI_D0 (0)
# define assert_spin_locked(foobar)
#endif
+
+/* Since v4l-dvb now includes it's own copy of linux/i2c-id.h these
+ are no longer necessary */
+/*
#if !defined(I2C_ALGO_SAA7134)
#define I2C_ALGO_SAA7134 I2C_HW_B_BT848
#endif
@@ -70,15 +65,21 @@
#if !defined(I2C_HW_SAA7146)
# define I2C_HW_SAA7146 I2C_ALGO_SAA7146
#endif
-
#if !defined(I2C_HW_B_EM2820)
#define I2C_HW_B_EM2820 0x99
#endif
+*/
#ifndef I2C_M_IGNORE_NAK
# define I2C_M_IGNORE_NAK 0x1000
#endif
+/* v4l-dvb uses an out of kernel copy of i2c-id.h, which does not have
+ some stuff that previous versions of i2c-id.h defined. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(LINUX_I2C_ID_H)
+# define I2C_ALGO_BIT 0x010000
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
#define __le32 __u32
#endif
@@ -223,6 +224,16 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#endif
+/* vm_insert_page() was added in 2.6.15 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && defined(_LINUX_MM_H)
+static inline int vm_insert_page(struct vm_area_struct *vma,
+ unsigned long addr, struct page *page)
+{
+ return remap_pfn_range(vma, addr, page_to_pfn(page), PAGE_SIZE,
+ vma->vm_page_prot);
+}
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
#ifndef kcalloc
#define kcalloc(n,size,flags) \
@@ -236,6 +247,15 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#endif
#endif
+/* try_to_freeze() lost its argument. Must appear after linux/sched.h */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(_LINUX_SCHED_H)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+# define try_to_freeze() try_to_freeze(PF_FREEZE)
+# else
+# define try_to_freeze() (0)
+# endif
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
#ifndef kzalloc
#define kzalloc(size, flags) \
@@ -282,7 +302,7 @@ static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
#define mutex_trylock(a) down_trylock(a)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(_LINUX_SCHED_H)
static inline signed long __sched
schedule_timeout_interruptible(signed long timeout)
{
@@ -318,7 +338,8 @@ static inline void setup_timer(struct timer_list * timer,
turned on. We can not just include usb.h here, because there is a
lot of code which will not compile if it has usb.h included, due to
conflicts with symbol names. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(__LINUX_USB_H)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && \
+ defined(__LINUX_USB_H) && defined(_INPUT_H)
#include <linux/input.h>
/* Found in linux/usb_input.h in 2.6.13 */
/* Moved to linux/usb/input.h in 2.6.18 */
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index bd1ee94e2..4d27fd789 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -1,45 +1,96 @@
#!/usr/bin/perl
+#
+# Original version were part of Gerd Knorr's v4l scripts.
+#
+# Several improvements by (c) 2005-2007 Mauro Carvalho Chehab
+#
+# Largely re-written (C) 2007 Trent Piepho <xyzzy@speakeasy.org>
+#
+# Theory of Operation
+#
+# This acts as a sort of mini version of cpp, which will process
+# #if/#elif/#ifdef/etc directives to strip out code used to support
+# multiple kernel versions or otherwise not wanted to be sent upstream to
+# git.
+#
+# Conditional compilation directives fall into two catagories,
+# "processed" and "other". The "other" directives are ignored and simply
+# output as they come in without changes (see 'keep' exception). The
+# "processed" variaty are evaluated and only the lines in the 'true' part
+# are kept, like cpp would do.
+#
+# If gentree knows the result of an expression, that directive will be
+# "processed", otherwise it will be an "other". gentree knows the value
+# of LINUX_VERSION_CODE, BTTV_VERSION_CODE, the KERNEL_VERSION(x,y,z)
+# macro, numeric constants like 0 and 1, and a few defines like MM_KERNEL
+# and STV0297_CS2.
+#
+# An exception is if the comment "/*KEEP*/" appears after the expression,
+# in which case that directive will be considered an "other" and not
+# processed, other than to remove the keep comment.
+#
+# Known bugs:
+# don't specify the root directory e.g. '/' or even '////'
+# directives continued with a back-slash will always be ignored
+# you can't modify a source tree in-place, i.e. source dir == dest dir
+
use strict;
use File::Find;
use Fcntl ':mode';
-my $VER = shift;
+my $VERSION = shift;
my $SRC = shift;
my $DESTDIR = shift;
-my $extra;
-
-
-#$VER = "2.6.14" if !defined($VER);
-#$SRC = "../linux" if !defined($SRC);
-#$DESTDIR = "/tmp/linux" if !defined($DESTDIR);
if (!defined($DESTDIR)) {
print "Usage:\ngentree.pl\t<version> <source dir> <dest dir>\n\n";
exit;
}
-my ($VERSION,$CODE) = &kernel_version;
+my $BTTVCODE = KERNEL_VERSION(0,9,17);
+my ($LINUXCODE, $extra) = kernel_version($VERSION);
my $DEBUG = 0;
+my %defs = (
+ 'LINUX_VERSION_CODE' => $LINUXCODE,
+ 'BTTV_VERSION_CODE' => $BTTVCODE,
+ '_COMPAT_H' => 0,
+ 'MM_KERNEL' => ($extra =~ /-mm/)?1:0,
+ 'BROKEN_XAWTV' => 0,
+ 'STV0297_CS2' => 0,
+ 'HAVE_VIDEO_BUF_DVB' => 1,
+ 'I2C_PEC' => 1,
+ 'I2C_DF_DUMMY' => 0,
+ 'CONFIG_XC3028' => 0,
+ 'I2C_CLASS_TV_ANALOG' => 1,
+ 'I2C_CLASS_TV_DIGITAL' => 1);
#################################################################
# helpers
-sub kernel_version() {
- my ($ver,$code);
-
- $code = 0;
- $ver = $VER;
-
- $ver =~ m/(\d)\.(\d)\.([0-9]*(.*))/;
- my $v1 = $1;
- my $v2 = $2;
- my $v3 = $3;
- $extra = $4;
-
- $code = $v1*65536 + $v2*256 + $v3;
+sub kernel_version($) {
+ $_[0] =~ m/(\d+)\.(\d+)\.(\d+)(.*)/;
+ return ($1*65536 + $2*256 + $3, $4);
+}
- return ($ver,$code);
+# used in eval()
+sub KERNEL_VERSION($$$) { return $_[0]*65536 + $_[1]*256 + $_[2]; }
+
+sub evalexp($) {
+ local $_ = shift;
+ s|/\*.*?\*/||go; # delete /* */ comments
+ s|//.*$||o; # delete // comments
+ s/\bdefined\s*\(/(/go; # defined(foo) to (foo)
+ while (/\b([_A-Za-z]\w*)\b/go) {
+ if (exists $defs{$1}) {
+ my $id = $1; my $pos = $-[0];
+ s/$id/$defs{$id}/;
+ pos = $-[0];
+ } elsif ($1 ne 'KERNEL_VERSION') {
+ return(undef);
+ }
+ }
+ return(eval($_) ? 1 : 0);
}
#################################################################
@@ -47,270 +98,116 @@ sub kernel_version() {
sub filter_source ($$) {
my ($in,$out) = @_;
- my ($line,$mmkernel);
+ my $line;
my $level=0;
my %if = ();
- my %state =();
- my $print=0;
+ my %state = ();
- if ($extra =~ m/\-mm/) {
- $mmkernel = 1;
- } else {
- $mmkernel = 0;
+ my @dbgargs = \($level, %state, %if, $line);
+ sub dbgline($\@) {
+ my $level = ${$_[1][0]};
+ printf STDERR ("/* BP %4d $_[0] state=$_[1][1]->{$level} if=$_[1][2]->{$level} level=$level (${$_[1][3]}) */\n", $.) if $DEBUG;
}
- open IN, "<$in";
- open OUT, ">$out";
+ open IN, '<', $in or die "Error opening $in: $!\n";
+ open OUT, '>', $out or die "Error opening $out: $!\n";
- print STDERR "File: $in, for kernel $VERSION($CODE)/\n" if $DEBUG;
+ print STDERR "File: $in, for kernel $VERSION($LINUXCODE)/\n" if $DEBUG;
while ($line = <IN>) {
- if ($line =~ m/^#include \"compat.h\"/) {
- next;
- }
-# if ($line =~ m/[\$]Id:/) {
-# next;
-# }
- if ($line =~ /^\s*#\s*ifdef\s+MM_KERNEL/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = $mmkernel;
- print STDERR "/* BP #if MM_KERNEL state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifdef\s+_COMPAT_H/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if MM_KERNEL state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ m|^\s*\#if\s+0\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
- if ($1 eq ";") {
- print OUT "#if 0\n";
- } else {
- print OUT "#if 0$1\n";
- }
- chomp($line);
- $state{$level} = "ifother";
- $if{$level} = 0;
- print STDERR "/* BP #if 0 (keep) state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifdef\s+STV0297_CS2/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifndef\s+BROKEN_XAWTV/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifndef\s+STV0297_CS2/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if\s+0/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ m|^\s*\#if\s+1\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
- print OUT "#if 1$1\n";
- $state{$level} = "ifother";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 (keep) state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if\s+1/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*HAVE_VIDEO_BUF_DVB/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*CONFIG_XC3028/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*I2C_CLASS_TV_ANALOG/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifndef.\s*I2C_DF_DUMMY/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifndef.\s*I2C_PEC/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*ifdef.\s*I2C_PEC/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*I2C_CLASS_TV_DIGITAL/) {
- chomp($line);
- $state{$level} = "if";
- $if{$level} = 1;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*BTTV_VERSION_CODE/) {
- chomp($line);
- $line =~ s@^#if\s*@@;
- $line =~ s@BTTV_VERSION_CODE@\$CODE@;
- $line =~ s@KERNEL_VERSION\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)@
- sprintf("%d",$1*65536 + $2*256 + $3) @eg;
- $if{$level} = eval $line;
- $state{$level} = "if";
- print STDERR "/* BP #if BTTV_VERSION_CODE state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if.*LINUX_VERSION_CODE/) {
- chomp($line);
- $line =~ s@^#if\s*@@;
- $line =~ s@LINUX_VERSION_CODE@\$CODE@;
-print STDERR "/* BP orig: ($line) */\n" if $DEBUG;
-
- $line =~ s@KERNEL_VERSION\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)@
- sprintf("%d",$1*65536 + $2*256 + $3) @eg;
- $if{$level} = eval $line;
- $state{$level} = "if";
- print STDERR "/* BP #if LINUX_VERSION_CODE state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- next;
- }
- if ($line =~ /^\s*#\s*if\s/) {
- $state{$level} = "ifother";
- $if{$level} = 1;
- print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
- $level++;
- }
+ chomp $line;
+ next if ($line =~ m/^#include \"compat.h\"/o);
+# next if ($line =~ m/[\$]Id:/);
- if ($line =~ /^\s*#\s*ifdef/) {
+ # For "#if 0 /*KEEP*/;" the ; should be dropped too
+ if ($line =~ m@^\s*#\s*if(n?def)?\s.*?(\s*/\*\s*(?i)keep\s*\*/;?)@) {
$state{$level} = "ifother";
$if{$level} = 1;
- print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ dbgline "#if$1 (keep)", @dbgargs;
+ $line =~ s/\Q$2\E//;
$level++;
}
-
- if ($line =~ /^\s*#\s*ifndef/) {
+ # handle all ifdef/ifndef lines
+ elsif ($line =~ /^\s*#\s*if(n?)def\s*(\w+)/o) {
+ if (exists $defs{$2}) {
+ $state{$level} = 'if';
+ $if{$level} = ($1 eq 'n') ? !$defs{$2} : $defs{$2};
+ dbgline "#if$1def $2", @dbgargs;
+ $level++;
+ next;
+ }
$state{$level} = "ifother";
$if{$level} = 1;
- print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ dbgline "#if$1def (other)", @dbgargs;
$level++;
}
-
- if ($level) {
- if ($state{$level-1} eq "if" && $line =~ /^\s*#\s*else/) {
- $state{$level-1} = "else";
- print STDERR "/* BP #else state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ # handle all ifs
+ elsif ($line =~ /^\s*#\s*if\s+(.*)$/o) {
+ my $res = evalexp($1);
+ if (defined $res) {
+ $state{$level} = 'if';
+ $if{$level} = $res;
+ dbgline '#if '.($res?'(yes)':'(no)'), @dbgargs;
+ $level++;
next;
- }
- }
- if ($line =~ /^\s*#\s*endif/) {
- if ($level) {
- $level--;
-
- print STDERR "/* BP #endif state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
} else {
- die "more endifs than ifs";
+ $state{$level} = 'ifother';
+ $if{$level} = 1;
+ dbgline '#if (other)', @dbgargs;
+ $level++;
}
- if ($state{$level} ne "ifother") {
+ }
+ # handle all elifs
+ elsif ($line =~ /^\s*#\s*elif\s+(.*)$/o) {
+ my $exp = $1;
+ $level--;
+ $level < 0 and die "more elifs than ifs";
+ $state{$level} =~ /if/ or die "unmatched elif";
+
+ if ($state{$level} eq 'if' && !$if{$level}) {
+ my $res = evalexp($exp);
+ defined $res or die 'moving from if to ifother';
+ $state{$level} = 'if';
+ $if{$level} = $res;
+ dbgline '#elif1 '.($res?'(yes)':'(no)'), @dbgargs;
+ $level++;
+ next;
+ } elsif ($state{$level} ne 'ifother') {
+ $if{$level} = 0;
+ $state{$level} = 'elif';
+ dbgline '#elif0', @dbgargs;
+ $level++;
next;
}
+ $level++;
}
- if ($level == 0) {
- print OUT $line;
- } else {
- my $i=0,$print=1;
- for ($i=0;$i<$level;$i++) {
- if (!($state{$i} eq "if" && $if{$i} ||
- $state{$i} eq "else" && !$if{$i}) &&
- $state{$i} ne "ifother" ) {
- $print=0;
- chomp($line);
- print STDERR "/* BP DEL $line state=$state{$i} if=$if{$i} level=$i */\n" if $DEBUG;
- }
- }
-
- if ($print) {
- print OUT $line;
- }
+ elsif ($line =~ /^\s*#\s*else/o) {
+ $level--;
+ $level < 0 and die "more elses than ifs";
+ $state{$level} =~ /if/ or die "unmatched else";
+ $if{$level} = !$if{$level} if ($state{$level} eq 'if');
+ $state{$level} =~ s/^if/else/o; # if -> else, ifother -> elseother, elif -> elif
+ dbgline '#else', @dbgargs;
+ $level++;
+ next if $state{$level-1} !~ /other$/o;
+ }
+ elsif ($line =~ /^\s*#\s*endif/o) {
+ $level--;
+ $level < 0 and die "more endifs than ifs";
+ dbgline '#endif', @dbgargs;
+ next if $state{$level} !~ /other$/o;
}
- }
- close IN;
- close OUT;
-}
-
-sub filter_dest ($$) {
- my ($in,$out) = @_;
- my ($line,$if,$state,$mmkernel);
-
- if ($extra =~ "/\-mm/") {
- $mmkernel = 1;
- } else {
- $mmkernel = 0;
- }
-
- open IN, "<$in";
- open OUT, ">$out";
- while ($line = <IN>) {
- if ($line =~ m/[\$]Id:.*/) {
- next;
+ my $print = 1;
+ for (my $i=0;$i<$level;$i++) {
+ next if $state{$i} =~ /other$/o; # keep code in ifother/elseother blocks
+ if (!$if{$i}) {
+ $print = 0;
+ dbgline 'DEL', @{[\$i, \%state, \%if, \$line]};
+ last;
+ }
}
- print OUT $line;
+ print OUT "$line\n" if $print;
}
close IN;
close OUT;
@@ -320,54 +217,36 @@ sub filter_dest ($$) {
sub parse_dir {
my $file = $File::Find::name;
- my $srcdir=$SRC;
- if ($file =~ /CVS/) {
- return;
- }
+ return if ($file =~ /CVS/);
+ return if ($file =~ /~$/);
- if ($file =~ /\~$/) {
- return;
- }
-
- my $mode = (lstat("$file"))[2];
+ my $f2 = $file;
+ $f2 =~ s/^\Q$SRC\E/$DESTDIR/;
+ my $mode = (stat($file))[2];
if ($mode & S_IFDIR) {
+ print("mkdir -p '$f2'\n");
+ system("mkdir -p '$f2'"); # should check for error
return;
}
-
- $srcdir =~ s/(.)/\[$1\]/g;
- my $f2 = $file;
-
- $f2 =~ s,^$srcdir,$DESTDIR/,;
print "from $file to $f2\n";
- my $tmp = "/tmp/src.$$";
if ($file =~ m/.*\.[ch]$/) {
- filter_source("$file","$tmp");
+ filter_source($file, $f2);
} else {
- system("cp $file $tmp");
+ system("cp $file $f2");
}
-
- my $dir = $f2;
- $dir =~ s,(.*)[/][^/]*$,$1,;
-
- print("mkdir -p $dir\n");
- system("mkdir -p $dir\n");
- system("cp $tmp $f2");
- unlink $tmp;
}
# main
-my $patchtmploc = "/tmp/temp.patch";
+printf "kernel is %s (0x%x)\n",$VERSION,$LINUXCODE;
-printf <<EOF,$VER,$CODE;
-kernel is %s (0x%x)
-EOF
+# remove any trailing slashes from dir names. don't pass in just '/'
+$SRC =~ s|/*$||; $DESTDIR =~ s|/*$||;
print "finding files at $SRC\n";
-
-find(\&parse_dir, $SRC);
+find({wanted => \&parse_dir, no_chdir => 1}, $SRC);
diff --git a/v4l/versions.txt b/v4l/versions.txt
index e30a74e85..f29387417 100644
--- a/v4l/versions.txt
+++ b/v4l/versions.txt
@@ -36,13 +36,9 @@ TUNER_3036
# Changes to usb_input.h, struct input_dev
[2.6.15]
-USB_KONICAWC
-USB_QUICKCAM_MESSENGER
# Uses vm_insert_page()
[2.6.15]
-USB_ZC0301
-USB_ET61X251
[2.6.12]
VIDEO_VIVI
@@ -215,3 +211,8 @@ RADIO_ZOLTRIX
USB_SN9C102
VIDEO_SAA7110
SOUND_ACI_MIXER
+USB_KONICAWC
+USB_QUICKCAM_MESSENGER
+USB_ZC0301
+USB_ET61X251
+USB_ZR364XX