[PATCH] Several compat additions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here are patches for four different kernel compat issues, plus a patch to
update versions.txt.

Most were straight forward.  The change for the usb_input.h was not so
obvious, I tried to come up something that had the least impact on the
drivers.

Some drivers don't have compat code for changes made to struct i2c_driver in
2.6.16.  They will still compile and insert, but leave important fields
uninitialized, which can lock the kernel.  I didn't make them work with older
kernels, but did adjust versions.txt to be correct.
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID 11b94a9ffc4d3997290f96bd996604d4790770b5
# Parent  9b7ee58c97f0b98c9f7b06fb2db49099307d6f81
Add some mutex -> semaphore backward compatability changes

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Standard back compatability changes, for struct mutex added after 2.6.15
Done with #define mutex semaphore in these files, because it's less invasive.

Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r 9b7ee58c97f0 -r 11b94a9ffc4d linux/drivers/media/video/et61x251/et61x251.h
--- a/linux/drivers/media/video/et61x251/et61x251.h	Thu May 11 16:45:10 2006 -0700
+++ b/linux/drivers/media/video/et61x251/et61x251.h	Fri May 12 15:18:37 2006 -0700
@@ -34,7 +34,11 @@
 #include <linux/types.h>
 #include <linux/param.h>
 #include <linux/rwsem.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 #include <linux/mutex.h>
+#else
+#define mutex semaphore
+#endif
 #include <linux/stddef.h>
 #include <linux/string.h>
 
diff -r 9b7ee58c97f0 -r 11b94a9ffc4d linux/drivers/media/video/zc0301/zc0301.h
--- a/linux/drivers/media/video/zc0301/zc0301.h	Thu May 11 16:45:10 2006 -0700
+++ b/linux/drivers/media/video/zc0301/zc0301.h	Fri May 12 15:18:37 2006 -0700
@@ -33,7 +33,11 @@
 #include <linux/wait.h>
 #include <linux/types.h>
 #include <linux/param.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 #include <linux/mutex.h>
+#else
+#define mutex semaphore
+#endif
 #include <linux/rwsem.h>
 #include <linux/stddef.h>
 #include <linux/string.h>
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID e9383e768f51327a95f1824adc1d4da294508773
# Parent  11b94a9ffc4d3997290f96bd996604d4790770b5
Update driver to use v4l_printk_ioctl() and v4l2-common.h

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Include meda/v4l2-common.h instead of manual extern prototype for
v4l_printk_ioctl().
Remove private version of same function that was for older kernels, it's
part of v4l-dvb now on old kernels too.

Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r 11b94a9ffc4d -r e9383e768f51 linux/drivers/media/video/pwc/pwc-v4l.c
--- a/linux/drivers/media/video/pwc/pwc-v4l.c	Fri May 12 15:18:37 2006 -0700
+++ b/linux/drivers/media/video/pwc/pwc-v4l.c	Fri May 12 15:26:41 2006 -0700
@@ -212,20 +212,6 @@ static struct v4l2_queryctrl pwc_control
 #endif
 };
 
-#if CONFIG_PWC_DEBUG
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-static const char *v4l1_ioctls[] = {
-	"?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
-	"CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
-	"SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
-	"GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
-	"SMICROCODE", "GVBIFMT", "SVBIFMT" };
-#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
-#else
-/* In 2.6.16-rc1 v4l_printk_ioctl is not defined but exported */
-extern void v4l_printk_ioctl(unsigned int cmd);
-#endif
-#endif
 
 static void pwc_vidioc_fill_fmt(const struct pwc_device *pdev, struct v4l2_format *f)
 {
@@ -367,23 +353,8 @@ int pwc_video_do_ioctl(struct inode *ino
 		return -EFAULT;
 
 #if CONFIG_PWC_DEBUG
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-	switch (_IOC_TYPE(cmd)) {
-		case 'v':
-			PWC_DEBUG_IOCTL("ioctl 0x%x (v4l1, VIDIOC%s)\n", cmd,
-					(_IOC_NR(cmd) < V4L1_IOCTLS) ?  v4l1_ioctls[_IOC_NR(cmd)] : "???");
-			break;
-		case 'V':
-			PWC_DEBUG_IOCTL("ioctl 0x%x (v4l2, %s)\n", cmd,
-					v4l2_ioctl_names[_IOC_NR(cmd)]);
-			break;
-		default:
-			PWC_DEBUG_IOCTL("ioctl 0x%x (unknown)\n", cmd);
-	}
-#else
 	if (PWC_DEBUG_LEVEL_IOCTL & pwc_trace)
 		v4l_printk_ioctl(cmd);
-#endif
 #endif
 
 
diff -r 11b94a9ffc4d -r e9383e768f51 linux/drivers/media/video/pwc/pwc.h
--- a/linux/drivers/media/video/pwc/pwc.h	Fri May 12 15:18:37 2006 -0700
+++ b/linux/drivers/media/video/pwc/pwc.h	Fri May 12 15:26:41 2006 -0700
@@ -36,6 +36,7 @@
 #include <asm/errno.h>
 #include <linux/videodev.h>
 #include <linux/videodev2.h>
+#include <media/v4l2-common.h>
 
 #include "pwc-uncompress.h"
 #include <media/pwc-ioctl.h>
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID 40ba20975e812d482474e1c07f5f3e1a98c932ed
# Parent  e9383e768f51327a95f1824adc1d4da294508773
Compat additions for usb_input.h, struct input_dev

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Struct input_dev got a new field 'cdev' in 2.6.15, put a check compat.h
that defines V4LCOMPAT_NO_INPUT_CDEV when it's not there.  Use this
define for konicawc.

A new header file linux/usb_input.h appeared in 2.6.13.  Add a compat.h
inline function that appears there, usb_to_input_id().  This function needs
linux/usb.h and linux/input.h.  linux/usb.h can not be unconditionally
included in compat.h, as it defines symbols that conflict with code that
doesn't normally include usb.h.  As a workaround, code that uses
usb_input.h should define V4LCOMPAT_USB_INPUT before including compat.h to
activate the compat code.

diff -r e9383e768f51 -r 40ba20975e81 linux/drivers/media/video/usbvideo/konicawc.c
--- a/linux/drivers/media/video/usbvideo/konicawc.c	Fri May 12 15:26:41 2006 -0700
+++ b/linux/drivers/media/video/usbvideo/konicawc.c	Fri May 12 15:40:23 2006 -0700
@@ -16,7 +16,11 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/input.h>
+#define V4LCOMPAT_USB_INPUT	/* Include usb_input code in compat.h */
+#include "compat.h"
+#if !defined(V4LCOMPAT_NO_USB_INPUT)
 #include <linux/usb_input.h>
+#endif
 
 #include "usbvideo.h"
 
@@ -236,7 +240,9 @@ static void konicawc_register_input(stru
 	input_dev->name = "Konicawc snapshot button";
 	input_dev->phys = cam->input_physname;
 	usb_to_input_id(dev, &input_dev->id);
+#if !defined(V4LCOMPAT_NO_INPUT_CDEV)
 	input_dev->cdev.dev = &dev->dev;
+#endif
 
 	input_dev->evbit[0] = BIT(EV_KEY);
 	input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
diff -r e9383e768f51 -r 40ba20975e81 v4l/compat.h
--- a/v4l/compat.h	Fri May 12 15:26:41 2006 -0700
+++ b/v4l/compat.h	Fri May 12 15:40:23 2006 -0700
@@ -267,6 +267,25 @@ static inline unsigned long vmalloc_to_p
 #define mutex_trylock(a) down_trylock(a)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(V4LCOMPAT_USB_INPUT)
+/* Found in linux/usb_input.h in 2.6.13 */
+#define V4LCOMPAT_NO_USB_INPUT
+#include <linux/input.h>
+#include <linux/usb.h>
+static inline void
+usb_to_input_id(const struct usb_device *dev, struct input_id *id)
+{
+	id->bustype = BUS_USB;
+	id->vendor = le16_to_cpu(dev->descriptor.idVendor);
+	id->product = le16_to_cpu(dev->descriptor.idProduct);
+	id->version = le16_to_cpu(dev->descriptor.bcdDevice);
+}
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
+#define V4LCOMPAT_NO_INPUT_CDEV
+#endif
+
 #endif
 /*
  * Local variables:
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID 4e4c8a4653708fbaff27cc3f146119fa36603708
# Parent  40ba20975e812d482474e1c07f5f3e1a98c932ed
Add compat.h code for schedule_timeout_interruptible()

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Add a static inline version of schedule_timeout_interruptible(), it's only
two lines, to compat.h.  Remove #if/#else code from some drivers which used
to handled this.

Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r 40ba20975e81 -r 4e4c8a465370 linux/drivers/media/video/msp3400-driver.c
--- a/linux/drivers/media/video/msp3400-driver.c	Fri May 12 15:40:23 2006 -0700
+++ b/linux/drivers/media/video/msp3400-driver.c	Fri May 12 15:53:56 2006 -0700
@@ -391,13 +391,8 @@ int msp_sleep(struct msp_state *state, i
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
 		} else {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
 			schedule_timeout_interruptible
 						(msecs_to_jiffies(timeout));
-#else
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(msecs_to_jiffies(timeout));
-#endif
 		}
 	}
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
diff -r 40ba20975e81 -r 4e4c8a465370 linux/drivers/media/video/saa7134/saa7134-tvaudio.c
--- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c	Fri May 12 15:40:23 2006 -0700
+++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c	Fri May 12 15:53:56 2006 -0700
@@ -363,13 +363,8 @@ static int tvaudio_sleep(struct saa7134_
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
 		} else {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
 			schedule_timeout_interruptible
 						(msecs_to_jiffies(timeout));
-#else
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(msecs_to_jiffies(timeout));
-#endif
 		}
 	}
 	remove_wait_queue(&dev->thread.wq, &wait);
diff -r 40ba20975e81 -r 4e4c8a465370 linux/drivers/media/video/vivi.c
--- a/linux/drivers/media/video/vivi.c	Fri May 12 15:40:23 2006 -0700
+++ b/linux/drivers/media/video/vivi.c	Fri May 12 15:53:56 2006 -0700
@@ -534,12 +534,7 @@ static void vivi_sleep(struct vivi_dmaqu
 
 		vivi_thread_tick(dma_q);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
 		schedule_timeout_interruptible (timeout);
-#else
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(timeout);
-#endif
 	}
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 	if (current->flags & PF_FREEZE) {
diff -r 40ba20975e81 -r 4e4c8a465370 v4l/compat.h
--- a/v4l/compat.h	Fri May 12 15:40:23 2006 -0700
+++ b/v4l/compat.h	Fri May 12 15:53:56 2006 -0700
@@ -286,6 +286,15 @@ usb_to_input_id(const struct usb_device 
 #define V4LCOMPAT_NO_INPUT_CDEV
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+static inline signed long __sched 
+schedule_timeout_interruptible(signed long timeout)
+{
+	__set_current_state(TASK_INTERRUPTIBLE);
+	return schedule_timeout(timeout);
+}
+#endif
+
 #endif
 /*
  * Local variables:
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID c6947745b9bba226f97257430ee164768532b542
# Parent  4e4c8a4653708fbaff27cc3f146119fa36603708
Adjust versions.txt to reflect current status

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Many drivers will work on older kernels than was specified.  Some drivers need
newer kernels than was specified.  There were several changes in struct
i2c_driver in 2.6.16 that don't cause a _compile_ error but will cause a
runtime error.

Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r 4e4c8a465370 -r c6947745b9bb v4l/versions.txt
--- a/v4l/versions.txt	Fri May 12 15:53:56 2006 -0700
+++ b/v4l/versions.txt	Fri May 12 16:03:49 2006 -0700
@@ -8,76 +8,34 @@ VIDEO_PLANB
 
 # Those are architecture-dependent
 VIDEO_VINO
+VIDEO_M32R_AR
 VIDEO_M32R_AR_M64278
 
+# Changes in struct i2c_driver, i2c_add_driver()
 [2.6.16]
-VIDEO_USBVIDEO
-USB_VICAM
-USB_IBMCAM
-USB_KONICAWC
-USB_ET61X251
-USB_PWC
-USB_PWC_DEBUG
-USB_ZC0301
-VIDEO_ZORAN_AVS6EYES
-
-[2.6.14]
-VIDEO_ZORAN
 VIDEO_ZORAN_BUZ
 VIDEO_ZORAN_DC10
 VIDEO_ZORAN_DC30
 VIDEO_ZORAN_LML33
 VIDEO_ZORAN_LML33R10
+VIDEO_ZORAN_AVS6EYES
 VIDEO_SAA5246A
 VIDEO_SAA5249
-VIDEO_BWQCAM
-VIDEO_CQCAM
-VIDEO_W9966
-VIDEO_PMS
-VIDEO_STRADIS
+VIDEO_MXB
+VIDEO_DPC
+VIDEO_OVCAMCHIP
+TUNER_3036
+
+# Uses vm_insert_page()
+[2.6.15]
+USB_ZC0301
+USB_ET61X251
+
+# Do not think this driver works at all
+[2.6.14]
 VIDEO_CPIA
 VIDEO_CPIA_PP
 VIDEO_CPIA_USB
-VIDEO_MEYE
-VIDEO_MXB
-VIDEO_DPC
-TUNER_3036
-USB_DABUSB
-USB_DSBR
-USB_OV511
-USB_SE401
-USB_STV680
-USB_W9968CF
-VIDEO_M32R_AR
-RADIO_CADET
-RADIO_RTRACK
-RADIO_RTRACK_PORT
-RADIO_RTRACK2
-RADIO_RTRACK2_PORT
-RADIO_AZTECH
-RADIO_AZTECH_PORT
-RADIO_GEMTEK
-RADIO_GEMTEK_PORT
-RADIO_GEMTEK_PCI
-RADIO_MAXIRADIO
-RADIO_MAESTRO
-RADIO_MIROPCM20
-RADIO_MIROPCM20_RDS
-RADIO_SF16FMI
-RADIO_SF16FMR2
-RADIO_TERRATEC
-RADIO_TERRATEC_PORT
-RADIO_TRUST
-RADIO_TRUST_PORT
-RADIO_TYPHOON
-RADIO_TYPHOON_PROC_FS
-RADIO_TYPHOON_PORT
-RADIO_TYPHOON_MUTEFREQ
-RADIO_ZOLTRIX
-RADIO_ZOLTRIX_PORT
-
-[2.6.13]
-USB_SN9C102
 
 [2.6.12]
 VIDEO_VIVI
@@ -113,7 +71,6 @@ VIDEO_CX88_DVB_LGDT330X
 VIDEO_CX88_DVB_LGDT330X
 VIDEO_CX88_DVB_NXT200X
 VIDEO_CX88_DVB_CX24123
-VIDEO_OVCAMCHIP
 VIDEO_MSP3400
 VIDEO_CS53L32A
 VIDEO_WM8775
@@ -203,3 +160,49 @@ VIDEO_BTCX
 VIDEO_BTCX
 VIDEO_IR
 VIDEO_TVEEPROM
+VIDEO_USBVIDEO
+VIDEO_ZORAN
+VIDEO_BWQCAM
+VIDEO_CQCAM
+VIDEO_W9966
+VIDEO_PMS
+VIDEO_STRADIS
+VIDEO_MEYE
+USB_VICAM
+USB_IBMCAM
+USB_KONICAWC
+USB_PWC
+USB_PWC_DEBUG
+USB_SN9C102
+USB_DABUSB
+USB_DSBR
+USB_OV511
+USB_SE401
+USB_STV680
+USB_W9968CF
+RADIO_CADET
+RADIO_RTRACK
+RADIO_RTRACK_PORT
+RADIO_RTRACK2
+RADIO_RTRACK2_PORT
+RADIO_AZTECH
+RADIO_AZTECH_PORT
+RADIO_GEMTEK
+RADIO_GEMTEK_PORT
+RADIO_GEMTEK_PCI
+RADIO_MAXIRADIO
+RADIO_MAESTRO
+RADIO_MIROPCM20
+RADIO_MIROPCM20_RDS
+RADIO_SF16FMI
+RADIO_SF16FMR2
+RADIO_TERRATEC
+RADIO_TERRATEC_PORT
+RADIO_TRUST
+RADIO_TRUST_PORT
+RADIO_TYPHOON
+RADIO_TYPHOON_PROC_FS
+RADIO_TYPHOON_PORT
+RADIO_TYPHOON_MUTEFREQ
+RADIO_ZOLTRIX
+RADIO_ZOLTRIX_PORT
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux