diff options
Diffstat (limited to 'v4l/scripts/make_config_compat.pl')
-rwxr-xr-x | v4l/scripts/make_config_compat.pl | 129 |
1 files changed, 119 insertions, 10 deletions
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index 423dcff77..1f5b8bae6 100755 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -218,40 +218,144 @@ sub check_net_dev() sub check_usb_endpoint_type() { - my $file = "$kdir/include/linux/usb.h"; + my $nfiles = 0; + my @files = ( "$kdir/include/linux/usb.h", "$kdir/include/linux/usb/ch9.h" ); + + foreach my $file ( @files ) { + open IN, "<$file" or next; + $nfiles++; + while (<IN>) { + if (m/usb_endpoint_type/) { + close IN; + # definition found. No need for compat + return; + } + } + close IN; + } + + die "Usb headers not found" if (!$nfiles); + + # definition not found. This means that we need compat + $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n"; +} + +sub check_pci_ioremap_bar() +{ + my $file = "$kdir/include/linux/pci.h"; my $need_compat = 1; open INNET, "<$file" or die "File not found: $file"; while (<INNET>) { - if (m/usb_endpoint_type/) { + if (m/pci_ioremap_bar/) { $need_compat = 0; last; } } if ($need_compat) { - $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n"; + $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n"; } close INNET; } -sub check_pci_ioremap_bar() +sub check_snd_card_create() { - my $file = "$kdir/include/linux/pci.h"; + my $file = "$kdir/include/sound/core.h"; my $need_compat = 1; - open INNET, "<$file" or die "File not found: $file"; - while (<INNET>) { - if (m/pci_ioremap_bar/) { + open IN, "<$file" or die "File not found: $file"; + while (<IN>) { + if (m/snd_card_create/) { $need_compat = 0; last; } } if ($need_compat) { - $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n"; + $out.= "\n#define NEED_SND_CARD_CREATE\n"; } - close INNET; + close IN; +} + +sub check_poll_schedule() +{ + my @files = ( "$kdir/include/linux/poll.h" ); + + foreach my $file ( @files ) { + open IN, "<$file" or die "File not found: $file"; + while (<IN>) { + if (m/poll_schedule/) { + close IN; + # definition found. No need for compat + return; + } + } + close IN; + } + + # definition not found. This means that we need compat + $out.= "\n#define NEED_POLL_SCHEDULE 1\n"; +} + +sub check_snd_BUG_ON() +{ + my @files = ( "$kdir/include/sound/core.h" ); + + foreach my $file ( @files ) { + open IN, "<$file" or die "File not found: $file"; + while (<IN>) { + if (m/snd_BUG_ON/) { + close IN; + # definition found. No need for compat + return; + } + } + close IN; + } + + # definition not found. This means that we need compat + $out.= "\n#define NEED_SND_BUG_ON 1\n"; +} + +sub check_bitops() +{ + my @files = ( "$kdir/include/linux/bitops.h" ); + + foreach my $file ( @files ) { + open IN, "<$file" or next; + while (<IN>) { + if (m/#define\s+BIT\(/) { + close IN; + # definition found. No need for compat + return; + } + } + close IN; + } + + # definition not found. This means that we need compat + $out.= "\n#define NEED_BITOPS 1\n"; +} + +sub check_delayed_work() +{ + my @files = ( "$kdir//include/linux/workqueue.h" ); + + foreach my $file ( @files ) { + open IN, "<$file" or die "File not found: $file"; + while (<IN>) { + if (m/struct\s+delayed_work/) { + close IN; + # definition found. No need for compat + return; + } + } + close IN; + } + + # definition not found. This means that we need compat + $out.= "\n#define NEED_DELAYED_WORK 1\n"; } sub check_other_dependencies() @@ -269,6 +373,11 @@ sub check_other_dependencies() check_net_dev(); check_usb_endpoint_type(); check_pci_ioremap_bar(); + check_snd_card_create(); + check_poll_schedule(); + check_snd_BUG_ON(); + check_bitops(); + check_delayed_work(); } # Do the basic rules |