From 5af359015ddc9e36fc7a6620dbc0e8a1bdd08e93 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 10 Feb 2008 15:39:20 -0200 Subject: arv/planb/vino: Add kernel validation to mutex From: Douglas Schilling Landgraf Added kernel validation to support mutex/semaphore. (kernel < 2.6.16) Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/arv.c | 7 +++++++ linux/drivers/media/video/planb.c | 3 +++ linux/drivers/media/video/planb.h | 4 ++++ linux/drivers/media/video/vino.c | 12 ++++++++++++ 4 files changed, 26 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/arv.c b/linux/drivers/media/video/arv.c index 479ca4b46..0cd7f1d5e 100644 --- a/linux/drivers/media/video/arv.c +++ b/linux/drivers/media/video/arv.c @@ -30,7 +30,10 @@ #include "compat.h" #include #include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) #include +#endif #include #include @@ -116,7 +119,11 @@ struct ar_device { int width, height; int frame_bytes, line_bytes; wait_queue_head_t wait; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) struct mutex lock; +#else + struct semaphore lock; +#endif }; static int video_nr = -1; /* video device number (first free) */ diff --git a/linux/drivers/media/video/planb.c b/linux/drivers/media/video/planb.c index 358dc2996..e9860c883 100644 --- a/linux/drivers/media/video/planb.c +++ b/linux/drivers/media/video/planb.c @@ -50,7 +50,10 @@ #include #include #include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) #include +#endif #include "planb.h" #include "saa7196.h" diff --git a/linux/drivers/media/video/planb.h b/linux/drivers/media/video/planb.h index e21b5735c..944e4960a 100644 --- a/linux/drivers/media/video/planb.h +++ b/linux/drivers/media/video/planb.h @@ -174,7 +174,11 @@ struct planb { int user; unsigned int tab_size; int maxlines; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) struct mutex lock; +#else + struct semaphore lock; +#endif unsigned int irq; /* interrupt number */ volatile unsigned int intr_mask; struct pci_dev *dev; /* Our PCI device */ diff --git a/linux/drivers/media/video/vino.c b/linux/drivers/media/video/vino.c index 01a4b9d3e..b867e7e8c 100644 --- a/linux/drivers/media/video/vino.c +++ b/linux/drivers/media/video/vino.c @@ -41,7 +41,10 @@ #include #include #include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) #include +#endif #include #include @@ -245,7 +248,11 @@ struct vino_framebuffer_queue { struct vino_framebuffer *buffer[VINO_FRAMEBUFFER_COUNT_MAX]; spinlock_t queue_lock; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) struct mutex queue_mutex; +#else + struct semaphore queue_mutex; +#endif wait_queue_head_t frame_wait_queue; }; @@ -283,7 +290,12 @@ struct vino_channel_settings { /* the driver is currently processing the queue */ int capturing; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) struct mutex mutex; +#else + struct semaphore mutex; +#endif + spinlock_t capture_lock; unsigned int users; -- cgit v1.2.3