X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fmedia%2Fvicam.c;h=4a5857c53f112dc53eed4e0794f8f2fd8a62994d;hb=f7f1b0f1e2fbadeab12d24236000e778aa9b1ead;hp=79629c370c841025825f7c51d5b7f32cf1311853;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c index 79629c370..4a5857c53 100644 --- a/drivers/usb/media/vicam.c +++ b/drivers/usb/media/vicam.c @@ -351,16 +351,6 @@ static unsigned char setup5[] = { 0x46, 0x05, 0x6C, 0x05, 0x00, 0x00 }; -static unsigned long kvirt_to_pa(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = __pa(kva); - return ret; -} - /* rvmalloc / rvfree copied from usbvideo.c * * Not sure why these are not yet non-statics which I can reference through @@ -451,7 +441,7 @@ static int __send_control_msg(struct vicam_camera *cam, request, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, - cp, size, HZ); + cp, size, 1000); status = min(status, 0); @@ -523,9 +513,9 @@ set_camera_power(struct vicam_camera *cam, int state) } static int -vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long ul_arg) +vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long arg) { - void *arg = (void *)ul_arg; + void __user *user_arg = (void __user *)arg; struct vicam_camera *cam = file->private_data; int retval = 0; @@ -549,7 +539,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign b.minwidth = 320; /* VIDEOSIZE_48_48 */ b.minheight = 240; - if (copy_to_user(arg, &b, sizeof (b))) + if (copy_to_user(user_arg, &b, sizeof(b))) retval = -EFAULT; break; @@ -560,7 +550,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_channel v; DBG("VIDIOCGCHAN\n"); - if (copy_from_user(&v, arg, sizeof (v))) { + if (copy_from_user(&v, user_arg, sizeof(v))) { retval = -EFAULT; break; } @@ -576,7 +566,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign v.type = VIDEO_TYPE_CAMERA; v.norm = 0; - if (copy_to_user(arg, &v, sizeof (v))) + if (copy_to_user(user_arg, &v, sizeof(v))) retval = -EFAULT; break; } @@ -585,7 +575,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { int v; - if (copy_from_user(&v, arg, sizeof (v))) + if (copy_from_user(&v, user_arg, sizeof(v))) retval = -EFAULT; DBG("VIDIOCSCHAN %d\n", v); @@ -604,8 +594,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign vp.brightness = cam->gain << 8; vp.depth = 24; vp.palette = VIDEO_PALETTE_RGB24; - if (copy_to_user - (arg, &vp, sizeof (struct video_picture))) + if (copy_to_user(user_arg, &vp, sizeof (struct video_picture))) retval = -EFAULT; break; } @@ -614,7 +603,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { struct video_picture vp; - if (copy_from_user(&vp, arg, sizeof(vp))) { + if (copy_from_user(&vp, user_arg, sizeof(vp))) { retval = -EFAULT; break; } @@ -646,8 +635,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign DBG("VIDIOCGWIN\n"); - if (copy_to_user - ((void *) arg, (void *) &vw, sizeof (vw))) + if (copy_to_user(user_arg, (void *)&vw, sizeof(vw))) retval = -EFAULT; // I'm not sure what the deal with a capture window is, it is very poorly described @@ -660,7 +648,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_window vw; - if (copy_from_user(&vw, arg, sizeof(vw))) { + if (copy_from_user(&vw, user_arg, sizeof(vw))) { retval = -EFAULT; break; } @@ -687,8 +675,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign for (i = 0; i < VICAM_FRAMES; i++) vm.offsets[i] = VICAM_MAX_FRAME_SIZE * i; - if (copy_to_user - ((void *) arg, (void *) &vm, sizeof (vm))) + if (copy_to_user(user_arg, (void *)&vm, sizeof(vm))) retval = -EFAULT; break; @@ -699,8 +686,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign struct video_mmap vm; // int video_size; - if (copy_from_user - ((void *) &vm, (void *) arg, sizeof (vm))) { + if (copy_from_user((void *)&vm, user_arg, sizeof(vm))) { retval = -EFAULT; break; } @@ -723,7 +709,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign { int frame; - if (copy_from_user((void *) &frame, arg, sizeof (int))) { + if (copy_from_user((void *)&frame, user_arg, sizeof(int))) { retval = -EFAULT; break; } @@ -991,7 +977,7 @@ read_frame(struct vicam_camera *cam, int framenum) n = usb_bulk_msg(cam->udev, usb_rcvbulkpipe(cam->udev, cam->bulkEndpoint), cam->raw_image, - 512 * 242 + 128, &actual_length, HZ*10); + 512 * 242 + 128, &actual_length, 10000); if (n < 0) { printk(KERN_ERR "Problem during bulk read of frame data: %d\n", @@ -1003,7 +989,7 @@ read_frame(struct vicam_camera *cam, int framenum) } static ssize_t -vicam_read( struct file *file, char *buf, size_t count, loff_t *ppos ) +vicam_read( struct file *file, char __user *buf, size_t count, loff_t *ppos ) { struct vicam_camera *cam = file->private_data; @@ -1059,8 +1045,8 @@ vicam_mmap(struct file *file, struct vm_area_struct *vma) pos = (unsigned long)cam->framebuf; while (size > 0) { - page = kvirt_to_pa(pos); - if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + page = vmalloc_to_pfn((void *)pos); + if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; start += PAGE_SIZE; @@ -1295,12 +1281,6 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) const struct usb_endpoint_descriptor *endpoint; struct vicam_camera *cam; - /* See if the device offered us matches what we can accept */ - if ((dev->descriptor.idVendor != USB_VICAM_VENDOR_ID) || - (dev->descriptor.idProduct != USB_VICAM_PRODUCT_ID)) { - return -ENODEV; - } - printk(KERN_INFO "ViCam based webcam connected\n"); interface = intf->cur_altsetting;