From 28f08f0ca6a628da637c6219169cf101958ba878 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 27 Aug 2006 19:00:09 -0700 Subject: Add compat code for usb_to_input_id() which appeared in 2.6.13 From: Trent Piepho Put static inline usb_to_input_id() inside compat.h for pre 2.6.13. This needs linux/usb.h to be included first! Drivers that need linux/usb_input.h compatibility must include linux/usb.h before they include compat.h. There is just no way around it. linux/usb.h cannot be unconditionally included in compat.h because that will break other, non-usb, drivers. Signed-off-by: Trent Piepho --- v4l/compat.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/v4l/compat.h b/v4l/compat.h index 9918f2e46..c1179a8c6 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -293,6 +293,24 @@ schedule_timeout_interruptible(signed long timeout) #define IRQF_DISABLED SA_INTERRUPT #endif +/* linux/usb.h must be included _before_ compat.h for this code to get + 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) +#include +/* Found in linux/usb_input.h in 2.6.13 */ +/* Moved to linux/usb/input.h in 2.6.18 */ +static inline void +usb_to_input_id(const struct usb_device *dev, struct input_id *id) +{ + id->bustype = BUS_USB; + id->vendor = le16_to_cpu(dev->descriptor.idVendor); + id->product = le16_to_cpu(dev->descriptor.idProduct); + id->version = le16_to_cpu(dev->descriptor.bcdDevice); +} +#endif + #endif /* * Local variables: -- cgit v1.2.3 From 83309226a2d2b934497122b49b6f8cbb3b6f224b Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 27 Aug 2006 19:01:24 -0700 Subject: Sync'ing dvb-usb-remote with changes in USB input subsystem From: Unai Uribarri This patch fixes the physical address and takes into account recent changes in the USB input subsystem. Signed-off-by: Unai Uribarri Acked-by: Dmitry Torokhov Signed-off-by: Trent Piepho --- linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index e5c6d9835..0dd4275f7 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -6,6 +6,13 @@ * This file contains functions for initializing the the input-device and for handling remote-control-queries. */ #include "dvb-usb-common.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +#include +#else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) +#include +#endif +#endif /* Remote-control poll function - called every dib->rc_query_interval ms to see * whether the remote control has received anything. @@ -96,7 +103,7 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) return 0; usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); - strlcpy(d->rc_phys, "/ir0", sizeof(d->rc_phys)); + strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); d->rc_input_dev = input_allocate_device(); if (!d->rc_input_dev) @@ -107,6 +114,10 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) d->rc_input_dev->keycodemax = KEY_MAX; d->rc_input_dev->name = "IR-receiver inside an USB DVB receiver"; d->rc_input_dev->phys = d->rc_phys; + usb_to_input_id(d->udev, &d->rc_input_dev->id); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + d->rc_input_dev->cdev.dev = &d->udev->dev; +#endif /* set the bits for the keys */ deb_rc("key map size: %d\n", d->props.rc_key_map_size); -- cgit v1.2.3 From 7c3113e3d39bea99091c178f4b0d58b9f89247e2 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 30 Aug 2006 14:36:58 -0700 Subject: Add Module.symvers to .hgignore file From: Trent Piepho Recently the name for the module symbol version file for external modules changed from Modules.symvers to Module.symvers. Add the new name to .hgignore. Signed-off-by: Trent Piepho --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index fef31c1bf..511e8828b 100644 --- a/.hgignore +++ b/.hgignore @@ -13,6 +13,7 @@ v4l/Kconfig.kern v4l/Makefile.media v4l/ivtv v4l/Modules.symvers +v4l/Module.symvers v4l/scripts/Kconfig v4l/scripts/Kconfig.kern v4l/config-compat.h -- cgit v1.2.3 From 3a1c5f0c1b20e6886120f2f42ef9a66cb5786fe4 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 30 Aug 2006 14:40:43 -0700 Subject: Add new script, analyze_build.pl, that analyzes the Makefile tree From: Trent Piepho This script will read a Linux Kernel style Makefile tree and produce an overview of the build process. It produces three lists which show to associations of: 1. Kconfig variables to kernel module(s) built 2. Kernel modules to source file(s) that make them 3. Kconfig variables to source file(s) built It can also check the Makefiles for various errors and warnings. Signed-off-by: Trent Piepho --- v4l/scripts/analyze_build.pl | 179 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100755 v4l/scripts/analyze_build.pl diff --git a/v4l/scripts/analyze_build.pl b/v4l/scripts/analyze_build.pl new file mode 100755 index 000000000..945377fa4 --- /dev/null +++ b/v4l/scripts/analyze_build.pl @@ -0,0 +1,179 @@ +#!/usr/bin/perl + +# Copyright (C) 2006 Trent Piepho +# Scans a tree of Linux Kernel style Makefiles, and builds lists of what +# builds what. +# Outputs three lists: +# 1. Kconfig variables associated with the kernel module(s) they turn on +# 2. Kernel modules associated with their source file(s) +# 3. Kconfig variables associated with all the source file(s) they turn on +# +# Optional options: +# Prefix relative to source tree root to start scanning in. This +# will be stripped from the beginnings of all filenames printed out. +# Default is 'linux/drivers/media' +# Root of source tree +# Default is to use 'hg root' command and if that fails the cwd +# +# Most usefull with grep, for example +# List of modules and source files used by DVB_BUDGET_AV +# deps.pl | grep DVB_BUDGET_AV +# +# Kconfig variable and kernel module that use dvb-usb-init.c +# deps.pl | grep dvb-usb-init.c +# +# Kconfig variable and source files that make dvb-core.ko +# deps.pl | grep dvb-core.ko +# +# Also has some ability to check Makefiles for errors +use strict; +use FileHandle; + +# Print out some extra checks of Makefile correctness +my $check = 0; + +# Directory to start in. Will be stripped from all filenames printed out. +my $prefix = 'linux/drivers/media/'; + +# Root of source tree +my $root; + +# List of Makefile's opened +my %makefiles = (); + +# For each Kconfig variable, a list of modules it builds +my %config = (); + +# For each module that is made up of multiple source files, list of sources +my %multi = (); + +sub open_makefile($) { + my $file = shift; + + # only open a given Makefile once + return if exists $makefiles{$file}; + $makefiles{$file} = 1; + + $file =~ m|^(.*)/[^/]*$|; + my $dir = $1; + +# print STDERR "opening $root$file (dir=$dir)\n"; + my $in = new FileHandle; + open $in, '<', "$root$file" or die "Unable to open Makefile '$root$file': $!"; + + while (<$in>) { + # print STDERR "Line: $_"; + # Skip comment and blank lines + next if (/^\s*(#.*)?$/); + m/^\s*\-?include/ and die "Can't handle includes! In $file"; + + # Handle line continuations + if (/\\\n$/) { + $_ .= <$in>; + redo; + } + # Eat line continuations in string we will parse + s/\s*\\\n\s*/ /g; + # Eat comments + s/#.*$//; + + if (/^\s*obj-(\S+)\s*([:+]?)=\s*(\S.*?)\s*$/) { + print STDERR "Should use '+=' in $file:$.\n$_\n" if ($check && $2 ne '+'); + my ($var,$targets) = ($1, $3); + if ($var =~ /\$\(CONFIG_(\S+)\)$/) { + $var = $1; + } elsif ($var !~ /^[ym]$/) { + print STDERR "Confused by obj assignment '$var' in $file:$.\n$_"; + } + foreach(split(/\s+/, $targets)) { + if (m|/$|) { # Ends in /, means it's a directory + open_makefile("$dir/$_".'Makefile'); + } elsif (/^(\S+)\.o$/) { + push @{$config{$var}}, "$dir/$1"; + } else { + print STDERR "Confused by target '$_' in $file:$.\n"; + } + } + next; + } + if (/(\S+)-objs\s*([:+]?)=\s*(\S.*?)\s*$/) { + print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && $2 ne ':'); + my @files = split(/\s+/, $3); + map { s|^(.*)\.o$|$dir/\1| } @files; + $multi{"$dir/$1"} = \@files; + next; + } + if (/^\s*EXTRA_CFLAGS\s*([:+]?)=\s*(\S.*?)\s*$/) { + if ($check) { + sub allI { /^-I/ or return 0 foreach split(/\s+/, $_[0]);return 1; } + my $use = allI($2) ? ':' : '+'; + print STDERR "Should use '$use=' with EXTRA_CFLAGS in $file:$.\n$_\n" + if ($1 ne $use); + } + next; + } + print STDERR "Odd line $file:$.\n$_\n" if ($check); + } +} + +if ($#ARGV >= 0) { + $prefix = $ARGV[0]; + $prefix .= '/' unless ($prefix =~ m|/$|); +} + +# Find root of source tree: command line, then Hg command, lastly cwd +if ($#ARGV >= 1) { + $root = $ARGV[1]; + $root .= '/' unless ($root =~ m|/$|); +} else { + $root = `hg root 2>/dev/null`; + if($? == 0) { + chomp $root; + $root .= '/'; + } else { + $root = ''; + } +} +print "# Using source tree root '$root'\n" if ($root ne ''); + +open_makefile($prefix."Makefile"); + +print "# Kconfig variable = kernel modules built\n"; +foreach my $var (keys %config) { + my @list = @{$config{$var}}; + map { s/^$prefix(.*)$/\1.ko/ } @list; + printf "%-22s= %s\n", $var, join(' ', @list); +} + +print "\n# kernel module = source files\n"; +my %modules = (); +foreach my $mods (values %config) { + $modules{$_} = 1 foreach @$mods; +} +foreach (keys %modules) { + /$prefix(.*)$/; + printf "%-30s = ", "$1.ko"; + if (exists $multi{$_}) { + my @list = @{$multi{$_}}; + map { s/^$prefix(.*)$/\1.c/ } @list; + print join(' ', @list), "\n"; + } else { + print "$1.c\n"; + } +} + +print "\n# Kconfig varible = source files\n"; +while (my ($var, $list) = each %config) { + my @outlist = (); + foreach (@$list) { + if (exists $multi{$_}) { + push @outlist, @{$multi{$_}}; + } else { + push @outlist, $_; + } + } + map { s/^$prefix(.*)$/\1.c/ } @outlist; + printf "%-22s= %s\n", $var, join(' ', @outlist); +} + +exit; -- cgit v1.2.3