From ad8467d60299b1d9be5553f7de6bfc5ecfac72c7 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 20 Nov 2008 09:40:13 +0100 Subject: compat.h: fix uninitialized_var macro From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- v4l/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index 98f57879b..253b3387a 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -324,7 +324,7 @@ usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) /* * uninitialized_var() macro */ -#define uninitialized_var(x) x +#define uninitialized_var(x) x = x #endif #endif -- cgit v1.2.3 From 76b6f5c5b37d1795e744a8f0347f7e80fd1cd434 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 22 Nov 2008 11:39:10 -0200 Subject: Improve compatibility with RHEL kernels From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l/compat.h | 19 ++++++++----- v4l/scripts/make_config_compat.pl | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 7 deletions(-) (limited to 'v4l') diff --git a/v4l/compat.h b/v4l/compat.h index 253b3387a..1d042d96c 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -163,7 +163,8 @@ do { \ #define put_unaligned_le64(r, a) \ put_unaligned(cpu_to_le64(r), ((u64 *)(a))) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) + +#ifdef NEED_PROC_CREATE #ifdef CONFIG_PROC_FS static inline struct proc_dir_entry *proc_create(const char *a, mode_t b, struct proc_dir_entry *c, const struct file_operations *d) @@ -215,19 +216,23 @@ static inline struct proc_dir_entry *proc_create_data(const char *a, typedef unsigned long uintptr_t; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) -#define div64_u64(a,b) div64_64(a,b) +#ifdef NEED_IS_SINGULAR +static inline int list_is_singular(const struct list_head *head) +{ + return !list_empty(head) && (head->next == head->prev); +} +#endif +#ifdef NEED_CLAMP #define clamp( x, l, h ) max_t( __typeof__( x ), \ ( l ), \ min_t( __typeof__( x ), \ ( h ), \ ( x ) ) ) +#endif -static inline int list_is_singular(const struct list_head *head) -{ - return !list_empty(head) && (head->next == head->prev); -} +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) +#define div64_u64(a,b) div64_64(a,b) #define dev_name(dev) ((dev)->bus_id) diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index bd34e7193..f681baf3e 100755 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -102,6 +102,63 @@ sub check_bool() close INDEP; } +sub check_is_singular() +{ + my $file = "$kdir/include/linux/list.h"; + my $need_compat = 1; + + open INNET, "<$file" or die "File not found: $file"; + while () { + if (m/list_is_singular/) { + $need_compat = 0; + last; + } + } + + if ($need_compat) { + $out.= "\n#define NEED_IS_SINGULAR 1\n"; + } + close INNET; +} + +sub check_clamp() +{ + my $file = "$kdir/include/linux/kernel.h"; + my $need_compat = 1; + + open INNET, "<$file" or die "File not found: $file"; + while () { + if (m/define\s+clamp/) { + $need_compat = 0; + last; + } + } + + if ($need_compat) { + $out.= "\n#define NEED_CLAMP 1\n"; + } + close INNET; +} + +sub check_proc_create() +{ + my $file = "$kdir/include/linux/proc_fs.h"; + my $need_compat = 1; + + open INNET, "<$file" or die "File not found: $file"; + while () { + if (m/proc_create/) { + $need_compat = 0; + last; + } + } + + if ($need_compat) { + $out.= "\n#define NEED_PROC_FS 1\n"; + } + close INNET; +} + sub check_other_dependencies() { check_spin_lock(); @@ -109,6 +166,9 @@ sub check_other_dependencies() check_snd_ctl_boolean_mono_info(); check_snd_pcm_rate_to_rate_bit(); check_bool(); + check_is_singular(); + check_clamp(); + check_proc_create(); } # Do the basic rules -- cgit v1.2.3 From 431a2d54bfc4ff45db203d48565c0557792a5fcb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 22 Nov 2008 20:54:45 -0200 Subject: Fix compat code for proc_create From: Mauro Carvalho Chehab Thanks to Andy Walls for warning me Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/make_config_compat.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l') diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index f681baf3e..fdbc5eaba 100755 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -154,7 +154,7 @@ sub check_proc_create() } if ($need_compat) { - $out.= "\n#define NEED_PROC_FS 1\n"; + $out.= "\n#define NEED_PROC_CREATE 1\n"; } close INNET; } -- cgit v1.2.3