aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-streams.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 4ab8d36831ba..c854285a4371 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -44,23 +44,25 @@
44#include "ivtv-streams.h" 44#include "ivtv-streams.h"
45 45
46static const struct file_operations ivtv_v4l2_enc_fops = { 46static const struct file_operations ivtv_v4l2_enc_fops = {
47 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
48 .read = ivtv_v4l2_read, 48 .read = ivtv_v4l2_read,
49 .write = ivtv_v4l2_write, 49 .write = ivtv_v4l2_write,
50 .open = ivtv_v4l2_open, 50 .open = ivtv_v4l2_open,
51 .ioctl = ivtv_v4l2_ioctl, 51 .ioctl = ivtv_v4l2_ioctl,
52 .release = ivtv_v4l2_close, 52 .compat_ioctl = v4l_compat_ioctl32,
53 .poll = ivtv_v4l2_enc_poll, 53 .release = ivtv_v4l2_close,
54 .poll = ivtv_v4l2_enc_poll,
54}; 55};
55 56
56static const struct file_operations ivtv_v4l2_dec_fops = { 57static const struct file_operations ivtv_v4l2_dec_fops = {
57 .owner = THIS_MODULE, 58 .owner = THIS_MODULE,
58 .read = ivtv_v4l2_read, 59 .read = ivtv_v4l2_read,
59 .write = ivtv_v4l2_write, 60 .write = ivtv_v4l2_write,
60 .open = ivtv_v4l2_open, 61 .open = ivtv_v4l2_open,
61 .ioctl = ivtv_v4l2_ioctl, 62 .ioctl = ivtv_v4l2_ioctl,
62 .release = ivtv_v4l2_close, 63 .compat_ioctl = v4l_compat_ioctl32,
63 .poll = ivtv_v4l2_dec_poll, 64 .release = ivtv_v4l2_close,
65 .poll = ivtv_v4l2_dec_poll,
64}; 66};
65 67
66#define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ 68#define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */
@@ -244,7 +246,7 @@ int ivtv_streams_setup(struct ivtv *itv)
244 return 0; 246 return 0;
245 247
246 /* One or more streams could not be initialized. Clean 'em all up. */ 248 /* One or more streams could not be initialized. Clean 'em all up. */
247 ivtv_streams_cleanup(itv); 249 ivtv_streams_cleanup(itv, 0);
248 return -ENOMEM; 250 return -ENOMEM;
249} 251}
250 252
@@ -304,12 +306,12 @@ int ivtv_streams_register(struct ivtv *itv)
304 return 0; 306 return 0;
305 307
306 /* One or more streams could not be initialized. Clean 'em all up. */ 308 /* One or more streams could not be initialized. Clean 'em all up. */
307 ivtv_streams_cleanup(itv); 309 ivtv_streams_cleanup(itv, 1);
308 return -ENOMEM; 310 return -ENOMEM;
309} 311}
310 312
311/* Unregister v4l2 devices */ 313/* Unregister v4l2 devices */
312void ivtv_streams_cleanup(struct ivtv *itv) 314void ivtv_streams_cleanup(struct ivtv *itv, int unregister)
313{ 315{
314 int type; 316 int type;
315 317
@@ -322,8 +324,11 @@ void ivtv_streams_cleanup(struct ivtv *itv)
322 continue; 324 continue;
323 325
324 ivtv_stream_free(&itv->streams[type]); 326 ivtv_stream_free(&itv->streams[type]);
325 /* Unregister device */ 327 /* Unregister or release device */
326 video_unregister_device(vdev); 328 if (unregister)
329 video_unregister_device(vdev);
330 else
331 video_device_release(vdev);
327 } 332 }
328} 333}
329 334