X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fpwc%2Fpwc-if.c;h=e62beb4efdb472e811609ec96717013ca6ffa74d;hp=aea7e224cef6bebff3fe4b17c7e24dac7e9c4afd;hb=a0e3390787ef523699ae1f3f3ea0ca953e630be2;hpb=d4a66e752d0b19934dd208884f8605fe385aaaa9 diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index aea7e224cef6..e62beb4efdb4 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -163,7 +163,7 @@ static const struct v4l2_file_operations pwc_fops = { .read = pwc_video_read, .poll = pwc_video_poll, .mmap = pwc_video_mmap, - .ioctl = pwc_video_ioctl, + .unlocked_ioctl = pwc_video_ioctl, }; static struct video_device pwc_template = { .name = "Philips Webcam", /* Filled in later */ @@ -1247,8 +1247,8 @@ static int pwc_video_close(struct file *file) PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); - lock_kernel(); pdev = video_get_drvdata(vdev); + mutex_lock(&pdev->modlock); if (pdev->vopen == 0) PWC_DEBUG_MODULE("video_close() called on closed device?\n"); @@ -1286,7 +1286,7 @@ static int pwc_video_close(struct file *file) if (device_hint[hint].pdev == pdev) device_hint[hint].pdev = NULL; } - unlock_kernel(); + mutex_unlock(&pdev->modlock); return 0; } @@ -1365,7 +1365,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, } PWC_DEBUG_READ("Copying data to user space.\n"); - if (pdev->vpalette == VIDEO_PALETTE_RAW) + if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) bytes_to_read = pdev->frame_size + sizeof(struct pwc_raw_frame); else bytes_to_read = pdev->view.size; @@ -1800,13 +1800,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id } pdev->vdev->release = video_device_release; - rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); - if (rc < 0) { - PWC_ERROR("Failed to register as video device (%d).\n", rc); - goto err_video_release; - } - - PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); /* occupy slot */ if (hint < MAX_DEV_HINTS) @@ -1814,14 +1807,22 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); usb_set_intfdata(intf, pdev); - rc = pwc_create_sysfs_files(pdev->vdev); - if (rc) - goto err_video_unreg; /* Set the leds off */ pwc_set_leds(pdev, 0, 0); pwc_camera_power(pdev, 0); + rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); + if (rc < 0) { + PWC_ERROR("Failed to register as video device (%d).\n", rc); + goto err_video_release; + } + rc = pwc_create_sysfs_files(pdev->vdev); + if (rc) + goto err_video_unreg; + + PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); + #ifdef CONFIG_USB_PWC_INPUT_EVDEV /* register webcam snapshot button input device */ pdev->button_dev = input_allocate_device(); @@ -1871,8 +1872,8 @@ static void usb_pwc_disconnect(struct usb_interface *intf) struct pwc_device *pdev; int hint; - lock_kernel(); pdev = usb_get_intfdata (intf); + mutex_lock(&pdev->modlock); usb_set_intfdata (intf, NULL); if (pdev == NULL) { PWC_ERROR("pwc_disconnect() Called without private pointer.\n"); @@ -1897,9 +1898,7 @@ static void usb_pwc_disconnect(struct usb_interface *intf) wake_up_interruptible(&pdev->frameq); /* Wait until device is closed */ if (pdev->vopen) { - mutex_lock(&pdev->modlock); pdev->unplugged = 1; - mutex_unlock(&pdev->modlock); pwc_iso_stop(pdev); } else { /* Device is closed, so we can safely unregister it */ @@ -1913,7 +1912,7 @@ disconnect_out: device_hint[hint].pdev = NULL; } - unlock_kernel(); + mutex_unlock(&pdev->modlock); }