Parche qc-usb 0.6.6 para 2.6.28

by anonymous on December 25th, 2008

No notes

Syntax: No syntax
Show lines - Hide lines - Show in textbox - Download
diff -uNr qc-usb-0.6.6/qc-driver.c qc-usb-0.6.6-nuevo/qc-driver.c
--- qc-usb-0.6.6/qc-driver.c    2006-10-24 04:06:19.000000000 +0200
+++ qc-usb-0.6.6-nuevo/qc-driver.c      2008-12-25 21:52:50.000000000 +0100
@@ -821,7 +821,9 @@
        if (!cr) goto fail2;
        urb->transfer_buffer = kmalloc(qc_i2c_maxbufsize*sizeof(u8), GFP_KERNEL);       /* Allocate maximum ever needed */
        if (!urb->transfer_buffer) goto fail3;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
        spin_lock_init(&urb->lock);
+#endif
        urb->complete = qc_i2c_handler;
        urb->context  = qc;
 #if (LINUX_VERSION_CODE<KERNEL_VERSION(2,6,9) && !defined(CONFIG_SUSE_KERNEL)) || LINUX_VERSION_CODE<KERNEL_VERSION(2,6,8)
@@ -2253,7 +2255,7 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        struct video_device *dev = video_devdata(file);
 #endif
-       struct quickcam *qc = (struct quickcam *)dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        struct qc_frame_data *fd = &qc->frame_data;
        int mask;
 
@@ -2305,7 +2307,7 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        struct video_device *dev = video_devdata(file);
 #endif
-       struct quickcam *qc = dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        int r;
 
        if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_open(qc=%p)", qc);
@@ -2373,7 +2375,7 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        struct video_device *dev = video_devdata(file);
 #endif
-       struct quickcam *qc = (struct quickcam *)dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_close(dev=%p,qc=%p)",dev,qc);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        TEST_BUGR_MSG(qc==NULL, "qc==NULL");
@@ -2421,7 +2423,7 @@
        struct video_device *dev = video_devdata(file);
        int noblock = file->f_flags & O_NONBLOCK;
 #endif
-       struct quickcam *qc = (struct quickcam *)dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        int frame_len;
        unsigned char *frame;
        long r = 0;
@@ -2476,7 +2478,7 @@
        const void *start = (void *)vma->vm_start;
        unsigned long size  = vma->vm_end - vma->vm_start;
 #endif
-       struct quickcam *qc = (struct quickcam *)dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        unsigned char *frame;
        int ret = 0,  frame_size;
 #if !HAVE_VMA && LINUX_VERSION_CODE<KERNEL_VERSION(2,6,0)
@@ -2508,7 +2510,7 @@
        struct video_device *dev = video_devdata(file);
        void *argp = (void *)arg;
 #endif
-       struct quickcam *qc = (struct quickcam *)dev->priv;
+       struct quickcam *qc = (struct quickcam *) video_get_drvdata(dev);
        int i, retval = 0;
 
        if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_ioctl(dev=%p,cmd=%u,arg=%p,qc=%p)",dev,cmd,argp,qc);
@@ -2526,7 +2528,7 @@
                        if (qcdebug&QC_DEBUGUSER) PDEBUG("VIDIOCGCAP");
                        memset(&b, 0, sizeof(b));
                        strcpy(b.name, "Logitech QuickCam USB");        /* Max 31 characters */
-                       b.type      = qc->vdev.type;
+                       b.type      = VID_TYPE_CAPTURE;
                        b.channels  = 1;
                        b.audios    = 0;
                        b.maxwidth  = qc->sensor_data.maxwidth;
@@ -3005,8 +3007,10 @@
 
 static struct video_device qc_v4l_template = {
        name:           "QuickCam USB",
-       type:           VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE,
+       /*type:         VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE,*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
        hardware:       VID_HARDWARE_QCAM_USB,
+#endif
        minor:          -1,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        release:        qc_v4l_release,
@@ -3155,7 +3159,7 @@
 
                /* Register V4L video device */
                memcpy(&qc->vdev, &qc_v4l_template, sizeof(qc_v4l_template));
-               qc->vdev.priv = qc;
+               video_set_drvdata(&qc->vdev, qc);
                r = video_register_device(&qc->vdev, VFL_TYPE_GRABBER, video_nr);
                if (r<0) goto fail3;
                PRINTK(KERN_INFO, "Registered device: /dev/video%i", qc->vdev.minor);
diff -uNr qc-usb-0.6.6/qc-memory.c qc-usb-0.6.6-nuevo/qc-memory.c
--- qc-usb-0.6.6/qc-memory.c    2006-11-04 14:34:32.000000000 +0100
+++ qc-usb-0.6.6-nuevo/qc-memory.c      2008-12-25 21:12:50.000000000 +0100
@@ -81,12 +81,14 @@
 #define pte_offset(pmd,adr)    pte_offset_map(pmd,adr) /* Emulation for a kernel using the new rmap-vm */
 #endif                                                 /* Fix by Michele Balistreri <brain87@gmx.net> */
 
+#ifndef SETPAGEFLAG
 #ifndef SetPageReserved
 #define SetPageReserved(p)     mem_map_reserve(p)
 #endif
 #ifndef ClearPageReserved
 #define ClearPageReserved(p)   mem_map_unreserve(p)
 #endif
+#endif
 /* }}} */
 
 /* {{{ [fold] kvirt_to_pa(): obtain physical address from virtual address obtained by vmalloc() */
diff -uNr qc-usb-0.6.6/quickcam.h qc-usb-0.6.6-nuevo/quickcam.h
--- qc-usb-0.6.6/quickcam.h     2006-11-04 14:38:27.000000000 +0100
+++ qc-usb-0.6.6-nuevo/quickcam.h       2008-12-25 21:12:50.000000000 +0100
@@ -126,7 +126,9 @@
 #define FALSE                  0
 #define TRUE                   (!FALSE)
 typedef unsigned char Bool;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
 #define BIT(x)         (1<<(x))
+#endif
 #define SIZE(a)                (sizeof(a)/sizeof((a)[0]))
 #define MAX(a,b)       ((a)>(b)?(a):(b))
 #define MIN(a,b)       ((a)<(b)?(a):(b))

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS