diff options
Diffstat (limited to 'drivers/media/video/pwc/pwc-if.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 35 |
1 files changed, 17 insertions, 18 deletions
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 = { | |||
163 | .read = pwc_video_read, | 163 | .read = pwc_video_read, |
164 | .poll = pwc_video_poll, | 164 | .poll = pwc_video_poll, |
165 | .mmap = pwc_video_mmap, | 165 | .mmap = pwc_video_mmap, |
166 | .ioctl = pwc_video_ioctl, | 166 | .unlocked_ioctl = pwc_video_ioctl, |
167 | }; | 167 | }; |
168 | static struct video_device pwc_template = { | 168 | static struct video_device pwc_template = { |
169 | .name = "Philips Webcam", /* Filled in later */ | 169 | .name = "Philips Webcam", /* Filled in later */ |
@@ -1247,8 +1247,8 @@ static int pwc_video_close(struct file *file) | |||
1247 | 1247 | ||
1248 | PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); | 1248 | PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); |
1249 | 1249 | ||
1250 | lock_kernel(); | ||
1251 | pdev = video_get_drvdata(vdev); | 1250 | pdev = video_get_drvdata(vdev); |
1251 | mutex_lock(&pdev->modlock); | ||
1252 | if (pdev->vopen == 0) | 1252 | if (pdev->vopen == 0) |
1253 | PWC_DEBUG_MODULE("video_close() called on closed device?\n"); | 1253 | PWC_DEBUG_MODULE("video_close() called on closed device?\n"); |
1254 | 1254 | ||
@@ -1286,7 +1286,7 @@ static int pwc_video_close(struct file *file) | |||
1286 | if (device_hint[hint].pdev == pdev) | 1286 | if (device_hint[hint].pdev == pdev) |
1287 | device_hint[hint].pdev = NULL; | 1287 | device_hint[hint].pdev = NULL; |
1288 | } | 1288 | } |
1289 | unlock_kernel(); | 1289 | mutex_unlock(&pdev->modlock); |
1290 | 1290 | ||
1291 | return 0; | 1291 | return 0; |
1292 | } | 1292 | } |
@@ -1365,7 +1365,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf, | |||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | PWC_DEBUG_READ("Copying data to user space.\n"); | 1367 | PWC_DEBUG_READ("Copying data to user space.\n"); |
1368 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 1368 | if (pdev->pixfmt != V4L2_PIX_FMT_YUV420) |
1369 | bytes_to_read = pdev->frame_size + sizeof(struct pwc_raw_frame); | 1369 | bytes_to_read = pdev->frame_size + sizeof(struct pwc_raw_frame); |
1370 | else | 1370 | else |
1371 | bytes_to_read = pdev->view.size; | 1371 | bytes_to_read = pdev->view.size; |
@@ -1800,13 +1800,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | pdev->vdev->release = video_device_release; | 1802 | pdev->vdev->release = video_device_release; |
1803 | rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); | ||
1804 | if (rc < 0) { | ||
1805 | PWC_ERROR("Failed to register as video device (%d).\n", rc); | ||
1806 | goto err_video_release; | ||
1807 | } | ||
1808 | |||
1809 | PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); | ||
1810 | 1803 | ||
1811 | /* occupy slot */ | 1804 | /* occupy slot */ |
1812 | if (hint < MAX_DEV_HINTS) | 1805 | if (hint < MAX_DEV_HINTS) |
@@ -1814,14 +1807,22 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1814 | 1807 | ||
1815 | PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); | 1808 | PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); |
1816 | usb_set_intfdata(intf, pdev); | 1809 | usb_set_intfdata(intf, pdev); |
1817 | rc = pwc_create_sysfs_files(pdev->vdev); | ||
1818 | if (rc) | ||
1819 | goto err_video_unreg; | ||
1820 | 1810 | ||
1821 | /* Set the leds off */ | 1811 | /* Set the leds off */ |
1822 | pwc_set_leds(pdev, 0, 0); | 1812 | pwc_set_leds(pdev, 0, 0); |
1823 | pwc_camera_power(pdev, 0); | 1813 | pwc_camera_power(pdev, 0); |
1824 | 1814 | ||
1815 | rc = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); | ||
1816 | if (rc < 0) { | ||
1817 | PWC_ERROR("Failed to register as video device (%d).\n", rc); | ||
1818 | goto err_video_release; | ||
1819 | } | ||
1820 | rc = pwc_create_sysfs_files(pdev->vdev); | ||
1821 | if (rc) | ||
1822 | goto err_video_unreg; | ||
1823 | |||
1824 | PWC_INFO("Registered as %s.\n", video_device_node_name(pdev->vdev)); | ||
1825 | |||
1825 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 1826 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
1826 | /* register webcam snapshot button input device */ | 1827 | /* register webcam snapshot button input device */ |
1827 | pdev->button_dev = input_allocate_device(); | 1828 | pdev->button_dev = input_allocate_device(); |
@@ -1871,8 +1872,8 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1871 | struct pwc_device *pdev; | 1872 | struct pwc_device *pdev; |
1872 | int hint; | 1873 | int hint; |
1873 | 1874 | ||
1874 | lock_kernel(); | ||
1875 | pdev = usb_get_intfdata (intf); | 1875 | pdev = usb_get_intfdata (intf); |
1876 | mutex_lock(&pdev->modlock); | ||
1876 | usb_set_intfdata (intf, NULL); | 1877 | usb_set_intfdata (intf, NULL); |
1877 | if (pdev == NULL) { | 1878 | if (pdev == NULL) { |
1878 | PWC_ERROR("pwc_disconnect() Called without private pointer.\n"); | 1879 | PWC_ERROR("pwc_disconnect() Called without private pointer.\n"); |
@@ -1897,9 +1898,7 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1897 | wake_up_interruptible(&pdev->frameq); | 1898 | wake_up_interruptible(&pdev->frameq); |
1898 | /* Wait until device is closed */ | 1899 | /* Wait until device is closed */ |
1899 | if (pdev->vopen) { | 1900 | if (pdev->vopen) { |
1900 | mutex_lock(&pdev->modlock); | ||
1901 | pdev->unplugged = 1; | 1901 | pdev->unplugged = 1; |
1902 | mutex_unlock(&pdev->modlock); | ||
1903 | pwc_iso_stop(pdev); | 1902 | pwc_iso_stop(pdev); |
1904 | } else { | 1903 | } else { |
1905 | /* Device is closed, so we can safely unregister it */ | 1904 | /* Device is closed, so we can safely unregister it */ |
@@ -1913,7 +1912,7 @@ disconnect_out: | |||
1913 | device_hint[hint].pdev = NULL; | 1912 | device_hint[hint].pdev = NULL; |
1914 | } | 1913 | } |
1915 | 1914 | ||
1916 | unlock_kernel(); | 1915 | mutex_unlock(&pdev->modlock); |
1917 | } | 1916 | } |
1918 | 1917 | ||
1919 | 1918 | ||