From 00ae040d86fe4250f09667bacd62bad2bd970090 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 24 Apr 2006 11:09:17 -0300 Subject: Fix compilation for sn9c102 on older kernels From: reinhard schwab Signed-off-by: Reinhard Schwab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/sn9c102/sn9c102.h | 6 ++++++ linux/drivers/media/video/sn9c102/sn9c102_core.c | 6 ++++++ linux/drivers/media/video/usbvideo/usbvideo.h | 10 ++++++++++ linux/drivers/media/video/usbvideo/vicam.c | 6 ++++++ 4 files changed, 28 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/sn9c102/sn9c102.h b/linux/drivers/media/video/sn9c102/sn9c102.h index 3f644c63f..1fcb7e73d 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102.h +++ b/linux/drivers/media/video/sn9c102/sn9c102.h @@ -34,7 +34,9 @@ #include #include #include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include +#endif #include #include @@ -146,7 +148,11 @@ struct sn9c102_device { enum sn9c102_dev_state state; u8 users; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct mutex dev_mutex, fileop_mutex; +#else + struct semaphore dev_mutex, fileop_mutex; +#endif spinlock_t queue_lock; wait_queue_head_t open, wait_frame, wait_stream; }; diff --git a/linux/drivers/media/video/sn9c102/sn9c102_core.c b/linux/drivers/media/video/sn9c102/sn9c102_core.c index ea4394dc9..3add1c79f 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102_core.c +++ b/linux/drivers/media/video/sn9c102/sn9c102_core.c @@ -1769,7 +1769,13 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) pos = cam->frame[i].bufmem; while (size > 0) { /* size is page-aligned */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) + unsigned long page = vmalloc_to_pfn(pos); + if (remap_pfn_range(vma, start, page, PAGE_SIZE, + vma->vm_page_prot)) { +#else if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { +#endif mutex_unlock(&cam->fileop_mutex); return -EAGAIN; } diff --git a/linux/drivers/media/video/usbvideo/usbvideo.h b/linux/drivers/media/video/usbvideo/usbvideo.h index 0d2066b7d..de266e78a 100644 --- a/linux/drivers/media/video/usbvideo/usbvideo.h +++ b/linux/drivers/media/video/usbvideo/usbvideo.h @@ -20,7 +20,9 @@ #include "compat.h" #include #include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include +#endif /* Most helpful debugging aid */ #define assert(expr) ((void) ((expr) ? 0 : (err("assert failed at line %d",__LINE__)))) @@ -215,7 +217,11 @@ struct uvd { unsigned long flags; /* FLAGS_USBVIDEO_xxx */ unsigned long paletteBits; /* Which palettes we accept? */ unsigned short defaultPalette; /* What palette to use for read() */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct mutex lock; +#else + struct semaphore lock; +#endif int user; /* user count for exclusive use */ videosize_t videosize; /* Current setting */ @@ -274,7 +280,11 @@ struct usbvideo { int num_cameras; /* As allocated */ struct usb_driver usbdrv; /* Interface to the USB stack */ char drvName[80]; /* Driver name */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct mutex lock; /* Mutex protecting camera structures */ +#else + struct semaphore lock; +#endif struct usbvideo_cb cb; /* Table of callbacks (virtual methods) */ struct video_device vdt; /* Video device template */ struct uvd *cam; /* Array of camera structures */ diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c index 98cb58e89..0ae33d432 100644 --- a/linux/drivers/media/video/usbvideo/vicam.c +++ b/linux/drivers/media/video/usbvideo/vicam.c @@ -43,7 +43,9 @@ #include #include #include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include +#endif #include "usbvideo.h" // #define VICAM_DEBUG @@ -409,7 +411,11 @@ struct vicam_camera { struct usb_device *udev; // usb device /* guard against simultaneous accesses to the camera */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct mutex cam_lock; +#else + struct semaphore cam_lock; +#endif int is_initialized; u8 open_count; -- cgit v1.2.3