Make it to compile with some distro-patched kernels

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab
2011-01-19 13:47:43 -02:00
parent fe5f150122
commit 2f3b6a700e
2 changed files with 23 additions and 1 deletions

View File

@@ -39,7 +39,7 @@
#include <linux/i2c-dev.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
#ifdef NEED_HEX_TO_BIN
#include <linux/ctype.h>
static inline int hex_to_bin(char ch)
{

View File

@@ -439,6 +439,28 @@ sub check_autosuspend_delay()
$out.= "\n#define NEED_AUTOSUSPEND_DELAY 1\n";
}
sub check_hex_to_bin()
{
my @files = ( "$kdir/include/linux/kernel.h" );
foreach my $file ( @files ) {
open IN, "<$file" or die "File not found: $file";
while (<IN>) {
if (m/hex_to_bin/) {
close IN;
# definition found. No need for compat
return;
}
}
close IN;
}
# definition not found. This means that we need compat
$out.= "\n#define NEED_HEX_TO_BIN 1\n";
}
sub check_other_dependencies()
{
check_spin_lock();