diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-06-25 17:39:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 17:53:43 -0300 |
commit | b824bb4b12548fedd622686d443310d574eb084e (patch) | |
tree | 09b71717e080d9809a73e4a198d15a7a892f0fb6 /drivers/media/video/pwc/pwc-v4l.c | |
parent | 1a4ede65f30315a31cb9b239bec0d4bb32834691 (diff) |
[media] pwc: Get rid of error_status and unplugged variables
Having 2 ways of tracking disconnection is too much, remove both and
instead simply set pdev->udev to NULL on disconnect. Also check for
pdev->udev being NULL in all possible entry paths.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index cda38837adc..8bd0a681990 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -288,6 +288,9 @@ static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f) { int ret, fps, snapshot, compression, pixelformat; + if (!pdev->udev) + return -ENODEV; + ret = pwc_vidioc_try_fmt(pdev, f); if (ret<0) return ret; @@ -346,6 +349,9 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap struct video_device *vdev = video_devdata(file); struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + strcpy(cap->driver, PWC_NAME); strlcpy(cap->card, vdev->name, sizeof(cap->card)); usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); @@ -414,6 +420,9 @@ static int pwc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) struct pwc_device *pdev = video_drvdata(file); int ret; + if (!pdev->udev) + return -ENODEV; + switch (c->id) { case V4L2_CID_BRIGHTNESS: c->value = pwc_get_brightness(pdev); @@ -517,6 +526,9 @@ static int pwc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) struct pwc_device *pdev = video_drvdata(file); int ret; + if (!pdev->udev) + return -ENODEV; + switch (c->id) { case V4L2_CID_BRIGHTNESS: c->value <<= 9; @@ -692,6 +704,9 @@ static int pwc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_qbuf(&pdev->vb_queue, buf); } @@ -699,6 +714,9 @@ static int pwc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_dqbuf(&pdev->vb_queue, buf, file->f_flags & O_NONBLOCK); } @@ -706,6 +724,9 @@ static int pwc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_streamon(&pdev->vb_queue, i); } @@ -713,6 +734,9 @@ static int pwc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) { struct pwc_device *pdev = video_drvdata(file); + if (!pdev->udev) + return -ENODEV; + return vb2_streamoff(&pdev->vb_queue, i); } |