aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-01-16 14:19:52 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-16 14:19:52 -0800
commitf37752a5fedef203decdcf6197f53b9cffa04416 (patch)
tree08512e83fba2a7ea076e85c3c4303e64337c180d /usb
parentd07e9db91955bb3909a915f56e90b380c189d8fb (diff)
downloadpatches-f37752a5fedef203decdcf6197f53b9cffa04416.tar.gz
more patches added
Diffstat (limited to 'usb')
-rw-r--r--usb/usb-convert-a-bunch-of-usb-semaphores-to-mutexes.patch100
-rw-r--r--usb/usb-remove-linux_version_code-macro-usage.patch82
-rw-r--r--usb/usb-sn9c10x-driver-updates.patch368
3 files changed, 501 insertions, 49 deletions
diff --git a/usb/usb-convert-a-bunch-of-usb-semaphores-to-mutexes.patch b/usb/usb-convert-a-bunch-of-usb-semaphores-to-mutexes.patch
index 0e7c4961ba6c3..e7ea1ad73a108 100644
--- a/usb/usb-convert-a-bunch-of-usb-semaphores-to-mutexes.patch
+++ b/usb/usb-convert-a-bunch-of-usb-semaphores-to-mutexes.patch
@@ -1739,7 +1739,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
wait_queue_head_t remove_ok;
--- gregkh-2.6.orig/drivers/usb/media/sn9c102.h
+++ gregkh-2.6/drivers/usb/media/sn9c102.h
-@@ -32,6 +32,7 @@
+@@ -33,6 +33,7 @@
#include <linux/types.h>
#include <linux/param.h>
#include <linux/rwsem.h>
@@ -1747,7 +1747,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
#include <asm/semaphore.h>
#include "sn9c102_sensor.h"
-@@ -115,7 +116,7 @@ struct sn9c102_module_param {
+@@ -109,7 +110,7 @@ struct sn9c102_module_param {
u8 force_munmap;
};
@@ -1756,7 +1756,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
static DECLARE_RWSEM(sn9c102_disconnect);
struct sn9c102_device {
-@@ -149,7 +150,7 @@ struct sn9c102_device {
+@@ -141,7 +142,7 @@ struct sn9c102_device {
enum sn9c102_dev_state state;
u8 users;
@@ -1767,7 +1767,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
};
--- gregkh-2.6.orig/drivers/usb/media/sn9c102_core.c
+++ gregkh-2.6/drivers/usb/media/sn9c102_core.c
-@@ -901,18 +901,18 @@ static ssize_t sn9c102_show_reg(struct c
+@@ -866,18 +866,18 @@ static ssize_t sn9c102_show_reg(struct c
struct sn9c102_device* cam;
ssize_t count;
@@ -1789,7 +1789,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -925,18 +925,18 @@ sn9c102_store_reg(struct class_device* c
+@@ -890,18 +890,18 @@ sn9c102_store_reg(struct class_device* c
u8 index;
ssize_t count;
@@ -1811,7 +1811,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EINVAL;
}
-@@ -945,7 +945,7 @@ sn9c102_store_reg(struct class_device* c
+@@ -910,7 +910,7 @@ sn9c102_store_reg(struct class_device* c
DBG(2, "Moved SN9C10X register index to 0x%02X", cam->sysfs.reg);
DBG(3, "Written bytes: %zd", count);
@@ -1820,7 +1820,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -957,17 +957,17 @@ static ssize_t sn9c102_show_val(struct c
+@@ -922,17 +922,17 @@ static ssize_t sn9c102_show_val(struct c
ssize_t count;
int val;
@@ -1841,7 +1841,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
-@@ -975,7 +975,7 @@ static ssize_t sn9c102_show_val(struct c
+@@ -940,7 +940,7 @@ static ssize_t sn9c102_show_val(struct c
DBG(3, "Read bytes: %zd", count);
@@ -1850,7 +1850,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -989,24 +989,24 @@ sn9c102_store_val(struct class_device* c
+@@ -954,24 +954,24 @@ sn9c102_store_val(struct class_device* c
ssize_t count;
int err;
@@ -1879,7 +1879,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
-@@ -1014,7 +1014,7 @@ sn9c102_store_val(struct class_device* c
+@@ -979,7 +979,7 @@ sn9c102_store_val(struct class_device* c
cam->sysfs.reg, value);
DBG(3, "Written bytes: %zd", count);
@@ -1888,7 +1888,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1025,12 +1025,12 @@ static ssize_t sn9c102_show_i2c_reg(stru
+@@ -990,12 +990,12 @@ static ssize_t sn9c102_show_i2c_reg(stru
struct sn9c102_device* cam;
ssize_t count;
@@ -1903,7 +1903,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -ENODEV;
}
-@@ -1038,7 +1038,7 @@ static ssize_t sn9c102_show_i2c_reg(stru
+@@ -1003,7 +1003,7 @@ static ssize_t sn9c102_show_i2c_reg(stru
DBG(3, "Read bytes: %zd", count);
@@ -1912,7 +1912,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1051,18 +1051,18 @@ sn9c102_store_i2c_reg(struct class_devic
+@@ -1016,18 +1016,18 @@ sn9c102_store_i2c_reg(struct class_devic
u8 index;
ssize_t count;
@@ -1934,7 +1934,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EINVAL;
}
-@@ -1071,7 +1071,7 @@ sn9c102_store_i2c_reg(struct class_devic
+@@ -1036,7 +1036,7 @@ sn9c102_store_i2c_reg(struct class_devic
DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg);
DBG(3, "Written bytes: %zd", count);
@@ -1943,7 +1943,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1083,22 +1083,22 @@ static ssize_t sn9c102_show_i2c_val(stru
+@@ -1048,22 +1048,22 @@ static ssize_t sn9c102_show_i2c_val(stru
ssize_t count;
int val;
@@ -1970,7 +1970,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
-@@ -1106,7 +1106,7 @@ static ssize_t sn9c102_show_i2c_val(stru
+@@ -1071,7 +1071,7 @@ static ssize_t sn9c102_show_i2c_val(stru
DBG(3, "Read bytes: %zd", count);
@@ -1979,7 +1979,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1120,29 +1120,29 @@ sn9c102_store_i2c_val(struct class_devic
+@@ -1085,29 +1085,29 @@ sn9c102_store_i2c_val(struct class_devic
ssize_t count;
int err;
@@ -2014,7 +2014,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
-@@ -1150,7 +1150,7 @@ sn9c102_store_i2c_val(struct class_devic
+@@ -1115,7 +1115,7 @@ sn9c102_store_i2c_val(struct class_devic
cam->sysfs.i2c_reg, value);
DBG(3, "Written bytes: %zd", count);
@@ -2023,7 +2023,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1165,18 +1165,18 @@ sn9c102_store_green(struct class_device*
+@@ -1130,18 +1130,18 @@ sn9c102_store_green(struct class_device*
u8 value;
ssize_t count;
@@ -2045,7 +2045,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
value = sn9c102_strtou8(buf, len, &count);
if (!count)
-@@ -1438,7 +1438,7 @@ static int sn9c102_init(struct sn9c102_d
+@@ -1404,7 +1404,7 @@ static int sn9c102_init(struct sn9c102_d
}
if (!(cam->state & DEV_INITIALIZED)) {
@@ -2054,7 +2054,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
spin_lock_init(&cam->queue_lock);
init_waitqueue_head(&cam->wait_frame);
init_waitqueue_head(&cam->wait_stream);
-@@ -1456,13 +1456,13 @@ static int sn9c102_init(struct sn9c102_d
+@@ -1422,13 +1422,13 @@ static int sn9c102_init(struct sn9c102_d
static void sn9c102_release_resources(struct sn9c102_device* cam)
{
@@ -2070,7 +2070,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kfree(cam->control_buffer);
}
-@@ -1483,7 +1483,7 @@ static int sn9c102_open(struct inode* in
+@@ -1449,7 +1449,7 @@ static int sn9c102_open(struct inode* in
cam = video_get_drvdata(video_devdata(filp));
@@ -2079,7 +2079,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
up_read(&sn9c102_disconnect);
return -ERESTARTSYS;
}
-@@ -1495,7 +1495,7 @@ static int sn9c102_open(struct inode* in
+@@ -1461,7 +1461,7 @@ static int sn9c102_open(struct inode* in
err = -EWOULDBLOCK;
goto out;
}
@@ -2088,7 +2088,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
err = wait_event_interruptible_exclusive(cam->open,
cam->state & DEV_DISCONNECTED
|| !cam->users);
-@@ -1507,7 +1507,7 @@ static int sn9c102_open(struct inode* in
+@@ -1473,7 +1473,7 @@ static int sn9c102_open(struct inode* in
up_read(&sn9c102_disconnect);
return -ENODEV;
}
@@ -2097,7 +2097,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
}
-@@ -1535,7 +1535,7 @@ static int sn9c102_open(struct inode* in
+@@ -1501,7 +1501,7 @@ static int sn9c102_open(struct inode* in
DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor);
out:
@@ -2106,7 +2106,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
up_read(&sn9c102_disconnect);
return err;
}
-@@ -1545,7 +1545,7 @@ static int sn9c102_release(struct inode*
+@@ -1511,7 +1511,7 @@ static int sn9c102_release(struct inode*
{
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
@@ -2115,7 +2115,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sn9c102_stop_transfer(cam);
-@@ -1553,7 +1553,7 @@ static int sn9c102_release(struct inode*
+@@ -1519,7 +1519,7 @@ static int sn9c102_release(struct inode*
if (cam->state & DEV_DISCONNECTED) {
sn9c102_release_resources(cam);
@@ -2124,7 +2124,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kfree(cam);
return 0;
}
-@@ -1563,7 +1563,7 @@ static int sn9c102_release(struct inode*
+@@ -1529,7 +1529,7 @@ static int sn9c102_release(struct inode*
DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor);
@@ -2133,7 +2133,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return 0;
}
-@@ -1577,33 +1577,33 @@ sn9c102_read(struct file* filp, char __u
+@@ -1543,33 +1543,33 @@ sn9c102_read(struct file* filp, char __u
unsigned long lock_flags;
int err = 0;
@@ -2172,7 +2172,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -ENOMEM;
}
cam->io = IO_READ;
-@@ -1617,13 +1617,13 @@ sn9c102_read(struct file* filp, char __u
+@@ -1583,13 +1583,13 @@ sn9c102_read(struct file* filp, char __u
}
if (!count) {
@@ -2188,7 +2188,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EAGAIN;
}
err = wait_event_interruptible
-@@ -1632,15 +1632,15 @@ sn9c102_read(struct file* filp, char __u
+@@ -1598,15 +1598,15 @@ sn9c102_read(struct file* filp, char __u
(cam->state & DEV_DISCONNECTED) ||
(cam->state & DEV_MISCONFIGURED) );
if (err) {
@@ -2207,7 +2207,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
}
-@@ -1668,7 +1668,7 @@ exit:
+@@ -1634,7 +1634,7 @@ exit:
PDBGG("Frame #%lu, bytes read: %zu",
(unsigned long)f->buf.index, count);
@@ -2216,7 +2216,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return count;
}
-@@ -1681,7 +1681,7 @@ static unsigned int sn9c102_poll(struct
+@@ -1647,7 +1647,7 @@ static unsigned int sn9c102_poll(struct
unsigned long lock_flags;
unsigned int mask = 0;
@@ -2225,7 +2225,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return POLLERR;
if (cam->state & DEV_DISCONNECTED) {
-@@ -1719,12 +1719,12 @@ static unsigned int sn9c102_poll(struct
+@@ -1685,12 +1685,12 @@ static unsigned int sn9c102_poll(struct
if (!list_empty(&cam->outqueue))
mask |= POLLIN | POLLRDNORM;
@@ -2240,8 +2240,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return POLLERR;
}
-@@ -1759,25 +1759,25 @@ static int sn9c102_mmap(struct file* fil
- page;
+@@ -1724,25 +1724,25 @@ static int sn9c102_mmap(struct file* fil
+ void *pos;
u32 i;
- if (down_interruptible(&cam->fileop_sem))
@@ -2270,7 +2270,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EINVAL;
}
-@@ -1786,7 +1786,7 @@ static int sn9c102_mmap(struct file* fil
+@@ -1751,7 +1751,7 @@ static int sn9c102_mmap(struct file* fil
break;
}
if (i == cam->nbuffers) {
@@ -2279,16 +2279,16 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EINVAL;
}
-@@ -1799,7 +1799,7 @@ static int sn9c102_mmap(struct file* fil
- page = vmalloc_to_pfn((void *)pos);
- if (remap_pfn_range(vma, start, page, PAGE_SIZE,
- vma->vm_page_prot)) {
+@@ -1761,7 +1761,7 @@ static int sn9c102_mmap(struct file* fil
+ pos = cam->frame[i].bufmem;
+ while (size > 0) { /* size is page-aligned */
+ if (vm_insert_page(vma, start, vmalloc_to_page(pos))) {
- up(&cam->fileop_sem);
+ mutex_unlock(&cam->fileop_mutex);
return -EAGAIN;
}
start += PAGE_SIZE;
-@@ -1812,7 +1812,7 @@ static int sn9c102_mmap(struct file* fil
+@@ -1774,7 +1774,7 @@ static int sn9c102_mmap(struct file* fil
sn9c102_vm_open(vma);
@@ -2297,7 +2297,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return 0;
}
-@@ -2692,25 +2692,25 @@ static int sn9c102_ioctl(struct inode* i
+@@ -2655,19 +2655,19 @@ static int sn9c102_ioctl(struct inode* i
struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
int err = 0;
@@ -2320,6 +2320,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return -EIO;
}
+@@ -2675,7 +2675,7 @@ static int sn9c102_ioctl(struct inode* i
+
err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg);
- up(&cam->fileop_sem);
@@ -2327,7 +2329,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return err;
}
-@@ -2758,7 +2758,7 @@ sn9c102_usb_probe(struct usb_interface*
+@@ -2722,7 +2722,7 @@ sn9c102_usb_probe(struct usb_interface*
goto fail;
}
@@ -2336,7 +2338,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
r = sn9c102_read_reg(cam, 0x00);
if (r < 0 || r != 0x10) {
-@@ -2812,7 +2812,7 @@ sn9c102_usb_probe(struct usb_interface*
+@@ -2776,7 +2776,7 @@ sn9c102_usb_probe(struct usb_interface*
cam->v4ldev->release = video_device_release;
video_set_drvdata(cam->v4ldev, cam);
@@ -2345,7 +2347,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
video_nr[dev_nr]);
-@@ -2822,7 +2822,7 @@ sn9c102_usb_probe(struct usb_interface*
+@@ -2786,7 +2786,7 @@ sn9c102_usb_probe(struct usb_interface*
DBG(1, "Free /dev/videoX node not found");
video_nr[dev_nr] = -1;
dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0;
@@ -2354,7 +2356,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
goto fail;
}
-@@ -2837,7 +2837,7 @@ sn9c102_usb_probe(struct usb_interface*
+@@ -2803,7 +2803,7 @@ sn9c102_usb_probe(struct usb_interface*
usb_set_intfdata(intf, cam);
@@ -2363,7 +2365,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
return 0;
-@@ -2861,7 +2861,7 @@ static void sn9c102_usb_disconnect(struc
+@@ -2827,7 +2827,7 @@ static void sn9c102_usb_disconnect(struc
down_write(&sn9c102_disconnect);
@@ -2372,7 +2374,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
DBG(2, "Disconnecting %s...", cam->v4ldev->name);
-@@ -2881,7 +2881,7 @@ static void sn9c102_usb_disconnect(struc
+@@ -2847,7 +2847,7 @@ static void sn9c102_usb_disconnect(struc
sn9c102_release_resources(cam);
}
diff --git a/usb/usb-remove-linux_version_code-macro-usage.patch b/usb/usb-remove-linux_version_code-macro-usage.patch
new file mode 100644
index 0000000000000..69cf4d0ed2bfa
--- /dev/null
+++ b/usb/usb-remove-linux_version_code-macro-usage.patch
@@ -0,0 +1,82 @@
+From penberg@cs.helsinki.fi Mon Jan 16 14:05:27 2006
+From: Pekka Enberg <penberg@cs.helsinki.fi>
+Subject: USB: remove LINUX_VERSION_CODE macro usage
+To: Greg KH <gregkh@suse.de>
+Date: Thu, 12 Jan 2006 20:35:25 +0200
+Message-Id: <1137090925.9933.0.camel@localhost>
+
+From: Pekka Enberg <penberg@cs.helsinki.fi>
+
+This patch removes unnecessary LINUX_VERSION_CODE macro usage from
+drivers/usb/.
+
+Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/usb/media/pwc/pwc-ctrl.c | 1 -
+ drivers/usb/media/pwc/pwc-if.c | 6 +-----
+ drivers/usb/misc/sisusbvga/sisusb.h | 8 --------
+ 3 files changed, 1 insertion(+), 14 deletions(-)
+
+--- gregkh-2.6.orig/drivers/usb/media/pwc/pwc-ctrl.c
++++ gregkh-2.6/drivers/usb/media/pwc/pwc-ctrl.c
+@@ -41,7 +41,6 @@
+ #include <asm/uaccess.h>
+ #endif
+ #include <asm/errno.h>
+-#include <linux/version.h>
+
+ #include "pwc.h"
+ #include "pwc-ioctl.h"
+--- gregkh-2.6.orig/drivers/usb/media/pwc/pwc-if.c
++++ gregkh-2.6/drivers/usb/media/pwc/pwc-if.c
+@@ -62,7 +62,6 @@
+ #include <linux/poll.h>
+ #include <linux/slab.h>
+ #include <linux/vmalloc.h>
+-#include <linux/version.h>
+ #include <asm/io.h>
+
+ #include "pwc.h"
+@@ -827,13 +826,10 @@ static int pwc_isoc_init(struct pwc_devi
+ /* Get the current alternate interface, adjust packet size */
+ if (!udev->actconfig)
+ return -EFAULT;
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+- idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];
+-#else
++
+ intf = usb_ifnum_to_if(udev, 0);
+ if (intf)
+ idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
+-#endif
+
+ if (!idesc)
+ return -EFAULT;
+--- gregkh-2.6.orig/drivers/usb/misc/sisusbvga/sisusb.h
++++ gregkh-2.6/drivers/usb/misc/sisusbvga/sisusb.h
+@@ -37,24 +37,16 @@
+ #ifndef _SISUSB_H_
+ #define _SISUSB_H_
+
+-#include <linux/version.h>
+ #ifdef CONFIG_COMPAT
+-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
+-#include <linux/ioctl32.h>
+-#define SISUSB_OLD_CONFIG_COMPAT
+-#else
+ #define SISUSB_NEW_CONFIG_COMPAT
+ #endif
+-#endif
+
+ /* For older kernels, support for text consoles is by default
+ * off. To ensable text console support, change the following:
+ */
+ #if 0
+-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
+ #define CONFIG_USB_SISUSBVGA_CON
+ #endif
+-#endif
+
+ /* Version Information */
+
diff --git a/usb/usb-sn9c10x-driver-updates.patch b/usb/usb-sn9c10x-driver-updates.patch
new file mode 100644
index 0000000000000..c6cabfba123b9
--- /dev/null
+++ b/usb/usb-sn9c10x-driver-updates.patch
@@ -0,0 +1,368 @@
+From luca.risolia@studio.unibo.it Fri Jan 13 08:13:56 2006
+Date: Fri, 13 Jan 2006 17:19:43 +0000
+From: Luca Risolia <luca.risolia@studio.unibo.it>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: USB: SN9C10x driver updates
+Message-ID: <20060113171943.GA31598@studio.unibo.it>
+Content-Disposition: inline
+
+SN9C10x driver updates:
+
+- Use kzalloc() instead of kmalloc()
+- Move some macro definitions from sn9c102.h to sn9c102_core.c
+- Use vfree() and vmalloc_32() instead of rvfree() and rvmalloc()
+- Fix mmap() sys call
+- Documentation updates
+
+Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ Documentation/usb/sn9c102.txt | 9 +++
+ drivers/usb/media/sn9c102.h | 27 ++++------
+ drivers/usb/media/sn9c102_core.c | 92 +++++++++++--------------------------
+ drivers/usb/media/sn9c102_sensor.h | 16 ++----
+ 4 files changed, 54 insertions(+), 90 deletions(-)
+
+--- gregkh-2.6.orig/Documentation/usb/sn9c102.txt
++++ gregkh-2.6/Documentation/usb/sn9c102.txt
+@@ -111,6 +111,12 @@ corresponding modules must be compiled:
+ #
+ CONFIG_VIDEO_DEV=m
+
++To enable advanced debugging functionality on the device through /sysfs:
++
++ # Multimedia devices
++ #
++ CONFIG_VIDEO_ADV_DEBUG=y
++
+ # USB support
+ #
+ CONFIG_USB=m
+@@ -208,7 +214,8 @@ Default: 2
+
+ 8. Optional device control through "sysfs" [1]
+ ==========================================
+-It is possible to read and write both the SN9C10x and the image sensor
++If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled,
++it is possible to read and write both the SN9C10x and the image sensor
+ registers by using the "sysfs" filesystem interface.
+
+ Every time a supported device is recognized, a write-only file named "green" is
+--- gregkh-2.6.orig/drivers/usb/media/sn9c102_core.c
++++ gregkh-2.6/drivers/usb/media/sn9c102_core.c
+@@ -45,6 +45,15 @@
+
+ /*****************************************************************************/
+
++#define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers"
++#define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia"
++#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
++#define SN9C102_MODULE_LICENSE "GPL"
++#define SN9C102_MODULE_VERSION "1:1.26"
++#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 26)
++
++/*****************************************************************************/
++
+ MODULE_DEVICE_TABLE(usb, sn9c102_id_table);
+
+ MODULE_AUTHOR(SN9C102_MODULE_AUTHOR " " SN9C102_AUTHOR_EMAIL);
+@@ -115,50 +124,6 @@ static sn9c102_eof_header_t sn9c102_eof_
+
+ /*****************************************************************************/
+
+-static void* rvmalloc(size_t size)
+-{
+- void* mem;
+- unsigned long adr;
+-
+- size = PAGE_ALIGN(size);
+-
+- mem = vmalloc_32((unsigned long)size);
+- if (!mem)
+- return NULL;
+-
+- memset(mem, 0, size);
+-
+- adr = (unsigned long)mem;
+- while (size > 0) {
+- SetPageReserved(vmalloc_to_page((void *)adr));
+- adr += PAGE_SIZE;
+- size -= PAGE_SIZE;
+- }
+-
+- return mem;
+-}
+-
+-
+-static void rvfree(void* mem, size_t size)
+-{
+- unsigned long adr;
+-
+- if (!mem)
+- return;
+-
+- size = PAGE_ALIGN(size);
+-
+- adr = (unsigned long)mem;
+- while (size > 0) {
+- ClearPageReserved(vmalloc_to_page((void *)adr));
+- adr += PAGE_SIZE;
+- size -= PAGE_SIZE;
+- }
+-
+- vfree(mem);
+-}
+-
+-
+ static u32
+ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count,
+ enum sn9c102_io_method io)
+@@ -177,7 +142,7 @@ sn9c102_request_buffers(struct sn9c102_d
+
+ cam->nbuffers = count;
+ while (cam->nbuffers > 0) {
+- if ((buff = rvmalloc(cam->nbuffers * PAGE_ALIGN(imagesize))))
++ if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize))))
+ break;
+ cam->nbuffers--;
+ }
+@@ -201,8 +166,7 @@ sn9c102_request_buffers(struct sn9c102_d
+ static void sn9c102_release_buffers(struct sn9c102_device* cam)
+ {
+ if (cam->nbuffers) {
+- rvfree(cam->frame[0].bufmem,
+- cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length));
++ vfree(cam->frame[0].bufmem);
+ cam->nbuffers = 0;
+ }
+ cam->frame_current = NULL;
+@@ -745,7 +709,7 @@ static int sn9c102_start_transfer(struct
+ int err = 0;
+
+ for (i = 0; i < SN9C102_URBS; i++) {
+- cam->transfer_buffer[i] = kmalloc(SN9C102_ISO_PACKETS * psz,
++ cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz,
+ GFP_KERNEL);
+ if (!cam->transfer_buffer[i]) {
+ err = -ENOMEM;
+@@ -865,6 +829,7 @@ static int sn9c102_stream_interrupt(stru
+
+ /*****************************************************************************/
+
++#ifdef CONFIG_VIDEO_ADV_DEBUG
+ static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count)
+ {
+ char str[5];
+@@ -1289,6 +1254,7 @@ static void sn9c102_create_sysfs(struct
+ video_device_create_file(v4ldev, &class_device_attr_i2c_val);
+ }
+ }
++#endif /* CONFIG_VIDEO_ADV_DEBUG */
+
+ /*****************************************************************************/
+
+@@ -1754,9 +1720,8 @@ static int sn9c102_mmap(struct file* fil
+ {
+ struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
+ unsigned long size = vma->vm_end - vma->vm_start,
+- start = vma->vm_start,
+- pos,
+- page;
++ start = vma->vm_start;
++ void *pos;
+ u32 i;
+
+ if (down_interruptible(&cam->fileop_sem))
+@@ -1790,15 +1755,12 @@ static int sn9c102_mmap(struct file* fil
+ return -EINVAL;
+ }
+
+- /* VM_IO is eventually going to replace PageReserved altogether */
+ vma->vm_flags |= VM_IO;
+- vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */
++ vma->vm_flags |= VM_RESERVED;
+
+- pos = (unsigned long)cam->frame[i].bufmem;
++ pos = cam->frame[i].bufmem;
+ while (size > 0) { /* size is page-aligned */
+- page = vmalloc_to_pfn((void *)pos);
+- if (remap_pfn_range(vma, start, page, PAGE_SIZE,
+- vma->vm_page_prot)) {
++ if (vm_insert_page(vma, start, vmalloc_to_page(pos))) {
+ up(&cam->fileop_sem);
+ return -EAGAIN;
+ }
+@@ -1831,7 +1793,8 @@ sn9c102_vidioc_querycap(struct sn9c102_d
+
+ strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card));
+ if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0)
+- strlcpy(cap.bus_info, cam->dev.bus_id, sizeof(cap.bus_info));
++ strlcpy(cap.bus_info, cam->usbdev->dev.bus_id,
++ sizeof(cap.bus_info));
+
+ if (copy_to_user(arg, &cap, sizeof(cap)))
+ return -EFAULT;
+@@ -1852,7 +1815,7 @@ sn9c102_vidioc_enuminput(struct sn9c102_
+ return -EINVAL;
+
+ memset(&i, 0, sizeof(i));
+- strcpy(i.name, "USB");
++ strcpy(i.name, "Camera");
+
+ if (copy_to_user(arg, &i, sizeof(i)))
+ return -EFAULT;
+@@ -2708,6 +2671,8 @@ static int sn9c102_ioctl(struct inode* i
+ return -EIO;
+ }
+
++ V4LDBG(3, "sn9c102", cmd);
++
+ err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg);
+
+ up(&cam->fileop_sem);
+@@ -2740,13 +2705,12 @@ sn9c102_usb_probe(struct usb_interface*
+ unsigned int i;
+ int err = 0, r;
+
+- if (!(cam = kmalloc(sizeof(struct sn9c102_device), GFP_KERNEL)))
++ if (!(cam = kzalloc(sizeof(struct sn9c102_device), GFP_KERNEL)))
+ return -ENOMEM;
+
+ cam->usbdev = udev;
+- memcpy(&cam->dev, &udev->dev, sizeof(struct device));
+
+- if (!(cam->control_buffer = kmalloc(8, GFP_KERNEL))) {
++ if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) {
+ DBG(1, "kmalloc() failed");
+ err = -ENOMEM;
+ goto fail;
+@@ -2806,7 +2770,7 @@ sn9c102_usb_probe(struct usb_interface*
+ strcpy(cam->v4ldev->name, "SN9C10x PC Camera");
+ cam->v4ldev->owner = THIS_MODULE;
+ cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
+- cam->v4ldev->hardware = VID_HARDWARE_SN9C102;
++ cam->v4ldev->hardware = 0;
+ cam->v4ldev->fops = &sn9c102_fops;
+ cam->v4ldev->minor = video_nr[dev_nr];
+ cam->v4ldev->release = video_device_release;
+@@ -2832,8 +2796,10 @@ sn9c102_usb_probe(struct usb_interface*
+
+ dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0;
+
++#ifdef CONFIG_VIDEO_ADV_DEBUG
+ sn9c102_create_sysfs(cam);
+ DBG(2, "Optional device control through 'sysfs' interface ready");
++#endif
+
+ usb_set_intfdata(intf, cam);
+
+--- gregkh-2.6.orig/drivers/usb/media/sn9c102.h
++++ gregkh-2.6/drivers/usb/media/sn9c102.h
+@@ -23,7 +23,8 @@
+
+ #include <linux/version.h>
+ #include <linux/usb.h>
+-#include <linux/videodev.h>
++#include <linux/videodev2.h>
++#include <media/v4l2-common.h>
+ #include <linux/device.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+@@ -52,13 +53,6 @@
+
+ /*****************************************************************************/
+
+-#define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers"
+-#define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia"
+-#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
+-#define SN9C102_MODULE_LICENSE "GPL"
+-#define SN9C102_MODULE_VERSION "1:1.25"
+-#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 25)
+-
+ enum sn9c102_bridge {
+ BRIDGE_SN9C101 = 0x01,
+ BRIDGE_SN9C102 = 0x02,
+@@ -119,8 +113,6 @@ static DECLARE_MUTEX(sn9c102_sysfs_lock)
+ static DECLARE_RWSEM(sn9c102_disconnect);
+
+ struct sn9c102_device {
+- struct device dev;
+-
+ struct video_device* v4ldev;
+
+ enum sn9c102_bridge bridge;
+@@ -161,7 +153,6 @@ sn9c102_attach_sensor(struct sn9c102_dev
+ struct sn9c102_sensor* sensor)
+ {
+ cam->sensor = sensor;
+- cam->sensor->dev = &cam->dev;
+ cam->sensor->usbdev = cam->usbdev;
+ }
+
+@@ -174,14 +165,19 @@ sn9c102_attach_sensor(struct sn9c102_dev
+ do { \
+ if (debug >= (level)) { \
+ if ((level) == 1) \
+- dev_err(&cam->dev, fmt "\n", ## args); \
++ dev_err(&cam->usbdev->dev, fmt "\n", ## args); \
+ else if ((level) == 2) \
+- dev_info(&cam->dev, fmt "\n", ## args); \
++ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \
+ else if ((level) >= 3) \
+- dev_info(&cam->dev, "[%s:%d] " fmt "\n", \
++ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
+ __FUNCTION__, __LINE__ , ## args); \
+ } \
+ } while (0)
++# define V4LDBG(level, name, cmd) \
++do { \
++ if (debug >= (level)) \
++ v4l_print_ioctl(name, cmd); \
++} while (0)
+ # define KDBG(level, fmt, args...) \
+ do { \
+ if (debug >= (level)) { \
+@@ -193,8 +189,9 @@ do {
+ } \
+ } while (0)
+ #else
+-# define KDBG(level, fmt, args...) do {;} while(0)
+ # define DBG(level, fmt, args...) do {;} while(0)
++# define V4LDBG(level, name, cmd) do {;} while(0)
++# define KDBG(level, fmt, args...) do {;} while(0)
+ #endif
+
+ #undef PDBG
+--- gregkh-2.6.orig/drivers/usb/media/sn9c102_sensor.h
++++ gregkh-2.6/drivers/usb/media/sn9c102_sensor.h
+@@ -196,10 +196,11 @@ extern int sn9c102_pread_reg(struct sn9c
+ /*
+ NOTE: there are no exported debugging functions. To uniform the output you
+ must use the dev_info()/dev_warn()/dev_err() macros defined in device.h,
+- already included here, the argument being the struct device 'dev' of the
+- sensor structure. Do NOT use these macros before the sensor is attached or
+- the kernel will crash! However, you should not need to notify the user about
+- common errors or other messages, since this is done by the master module.
++ already included here, the argument being the struct device '&usbdev->dev'
++ of the sensor structure. Do NOT use these macros before the sensor is
++ attached or the kernel will crash! However, you should not need to notify
++ the user about common errors or other messages, since this is done by the
++ master module.
+ */
+
+ /*****************************************************************************/
+@@ -358,13 +359,6 @@ struct sn9c102_sensor {
+ error code without rolling back.
+ */
+
+- const struct device* dev;
+- /*
+- This is the argument for dev_err(), dev_info() and dev_warn(). It
+- is used for debugging purposes. You must not access the struct
+- before the sensor is attached.
+- */
+-
+ const struct usb_device* usbdev;
+ /*
+ Points to the usb_device struct after the sensor is attached.