From 7c3206d14cea8962f79628f11cd3f582f2b9644d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Oct 2007 16:25:58 -0200 Subject: Fix compilation for distro kernels with newer -ALSA trees From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/compat.h | 2 +- v4l/scripts/make_config_compat.pl | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) mode change 100644 => 100755 v4l/scripts/make_config_compat.pl diff --git a/v4l/compat.h b/v4l/compat.h index 97b35d4f7..db45d91f0 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -447,7 +447,7 @@ static inline u8 v4l_compat_pci_rev(struct pci_dev *pci) # endif #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) && defined(__SOUND_PCM_H) +#if defined(COMPAT_PCM_TO_RATE_BIT) && defined(__SOUND_PCM_H) /* New alsa core utility function */ static inline unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate) { diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl old mode 100644 new mode 100755 index 21dce0126..785f9ff72 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -26,6 +26,25 @@ sub check_spin_lock() close INNET; } +sub check_snd_pcm_rate_to_rate_bit() +{ + my $file = "$kdir/include/sound/pcm.h"; + my $old_syntax = 1; + + open INNET, "<$file" or die "File not found: $file"; + while () { + if (m/snd_pcm_rate_to_rate_bit/) { + $old_syntax = 0; + last; + } + } + + if ($old_syntax) { + $out.= "\n#define COMPAT_PCM_TO_RATE_BIT 1\n"; + } + close INNET; +} + sub check_snd_ctl_boolean_mono_info() { my $file = "$kdir/include/sound/control.h"; @@ -49,6 +68,7 @@ sub check_other_dependencies() { check_spin_lock(); check_snd_ctl_boolean_mono_info(); + check_snd_pcm_rate_to_rate_bit(); } # Do the basic rules -- cgit v1.2.3