aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-streams.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-01-10 19:54:39 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:25 -0400
commit3d05913d894a460b7dc8e5d93415fde21b986411 (patch)
tree04a2216afdbbf27230dd364107d5d1dcb7f13057 /drivers/media/video/cx18/cx18-streams.c
parente0f28b6a69b73ebf610f4f9759999bcdabdcda8e (diff)
V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v4l2dev to video_dev
Renamed structure member name to be more specific to type in anticipation of updating to the v4l2_device/v4l2_subdev framework. Too many objects named "dev" and /v4l2_\{0,1\}dev/ would be to confusing. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r--drivers/media/video/cx18/cx18-streams.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 89c1ec94f335..abc3fe605f00 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -101,11 +101,11 @@ static struct {
101static void cx18_stream_init(struct cx18 *cx, int type) 101static void cx18_stream_init(struct cx18 *cx, int type)
102{ 102{
103 struct cx18_stream *s = &cx->streams[type]; 103 struct cx18_stream *s = &cx->streams[type];
104 struct video_device *dev = s->v4l2dev; 104 struct video_device *video_dev = s->video_dev;
105 105
106 /* we need to keep v4l2dev, so restore it afterwards */ 106 /* we need to keep video_dev, so restore it afterwards */
107 memset(s, 0, sizeof(*s)); 107 memset(s, 0, sizeof(*s));
108 s->v4l2dev = dev; 108 s->video_dev = video_dev;
109 109
110 /* initialize cx18_stream fields */ 110 /* initialize cx18_stream fields */
111 s->cx = cx; 111 s->cx = cx;
@@ -132,10 +132,10 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
132 int num_offset = cx18_stream_info[type].num_offset; 132 int num_offset = cx18_stream_info[type].num_offset;
133 int num = cx->num + cx18_first_minor + num_offset; 133 int num = cx->num + cx18_first_minor + num_offset;
134 134
135 /* These four fields are always initialized. If v4l2dev == NULL, then 135 /* These four fields are always initialized. If video_dev == NULL, then
136 this stream is not in use. In that case no other fields but these 136 this stream is not in use. In that case no other fields but these
137 four can be used. */ 137 four can be used. */
138 s->v4l2dev = NULL; 138 s->video_dev = NULL;
139 s->cx = cx; 139 s->cx = cx;
140 s->type = type; 140 s->type = type;
141 s->name = cx18_stream_info[type].name; 141 s->name = cx18_stream_info[type].name;
@@ -163,22 +163,22 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
163 return 0; 163 return 0;
164 164
165 /* allocate and initialize the v4l2 video device structure */ 165 /* allocate and initialize the v4l2 video device structure */
166 s->v4l2dev = video_device_alloc(); 166 s->video_dev = video_device_alloc();
167 if (s->v4l2dev == NULL) { 167 if (s->video_dev == NULL) {
168 CX18_ERR("Couldn't allocate v4l2 video_device for %s\n", 168 CX18_ERR("Couldn't allocate v4l2 video_device for %s\n",
169 s->name); 169 s->name);
170 return -ENOMEM; 170 return -ENOMEM;
171 } 171 }
172 172
173 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d", 173 snprintf(s->video_dev->name, sizeof(s->video_dev->name), "cx18-%d",
174 cx->num); 174 cx->num);
175 175
176 s->v4l2dev->num = num; 176 s->video_dev->num = num;
177 s->v4l2dev->parent = &cx->dev->dev; 177 s->video_dev->parent = &cx->pci_dev->dev;
178 s->v4l2dev->fops = &cx18_v4l2_enc_fops; 178 s->video_dev->fops = &cx18_v4l2_enc_fops;
179 s->v4l2dev->release = video_device_release; 179 s->video_dev->release = video_device_release;
180 s->v4l2dev->tvnorms = V4L2_STD_ALL; 180 s->video_dev->tvnorms = V4L2_STD_ALL;
181 cx18_set_funcs(s->v4l2dev); 181 cx18_set_funcs(s->video_dev);
182 return 0; 182 return 0;
183} 183}
184 184
@@ -227,28 +227,29 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
227 } 227 }
228 } 228 }
229 229
230 if (s->v4l2dev == NULL) 230 if (s->video_dev == NULL)
231 return 0; 231 return 0;
232 232
233 num = s->v4l2dev->num; 233 num = s->video_dev->num;
234 /* card number + user defined offset + device offset */ 234 /* card number + user defined offset + device offset */
235 if (type != CX18_ENC_STREAM_TYPE_MPG) { 235 if (type != CX18_ENC_STREAM_TYPE_MPG) {
236 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; 236 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
237 237
238 if (s_mpg->v4l2dev) 238 if (s_mpg->video_dev)
239 num = s_mpg->v4l2dev->num + cx18_stream_info[type].num_offset; 239 num = s_mpg->video_dev->num
240 + cx18_stream_info[type].num_offset;
240 } 241 }
241 242
242 /* Register device. First try the desired minor, then any free one. */ 243 /* Register device. First try the desired minor, then any free one. */
243 ret = video_register_device(s->v4l2dev, vfl_type, num); 244 ret = video_register_device(s->video_dev, vfl_type, num);
244 if (ret < 0) { 245 if (ret < 0) {
245 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", 246 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n",
246 s->name, num); 247 s->name, num);
247 video_device_release(s->v4l2dev); 248 video_device_release(s->video_dev);
248 s->v4l2dev = NULL; 249 s->video_dev = NULL;
249 return ret; 250 return ret;
250 } 251 }
251 num = s->v4l2dev->num; 252 num = s->video_dev->num;
252 253
253 switch (vfl_type) { 254 switch (vfl_type) {
254 case VFL_TYPE_GRABBER: 255 case VFL_TYPE_GRABBER:
@@ -312,9 +313,9 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
312 cx->streams[type].dvb.enabled = false; 313 cx->streams[type].dvb.enabled = false;
313 } 314 }
314 315
315 vdev = cx->streams[type].v4l2dev; 316 vdev = cx->streams[type].video_dev;
316 317
317 cx->streams[type].v4l2dev = NULL; 318 cx->streams[type].video_dev = NULL;
318 if (vdev == NULL) 319 if (vdev == NULL)
319 continue; 320 continue;
320 321
@@ -437,7 +438,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
437 int ts = 0; 438 int ts = 0;
438 int captype = 0; 439 int captype = 0;
439 440
440 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 441 if (s->video_dev == NULL && s->dvb.enabled == 0)
441 return -EINVAL; 442 return -EINVAL;
442 443
443 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); 444 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name);
@@ -565,7 +566,7 @@ void cx18_stop_all_captures(struct cx18 *cx)
565 for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) { 566 for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) {
566 struct cx18_stream *s = &cx->streams[i]; 567 struct cx18_stream *s = &cx->streams[i];
567 568
568 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 569 if (s->video_dev == NULL && s->dvb.enabled == 0)
569 continue; 570 continue;
570 if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) 571 if (test_bit(CX18_F_S_STREAMING, &s->s_flags))
571 cx18_stop_v4l2_encode_stream(s, 0); 572 cx18_stop_v4l2_encode_stream(s, 0);
@@ -577,7 +578,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
577 struct cx18 *cx = s->cx; 578 struct cx18 *cx = s->cx;
578 unsigned long then; 579 unsigned long then;
579 580
580 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 581 if (s->video_dev == NULL && s->dvb.enabled == 0)
581 return -EINVAL; 582 return -EINVAL;
582 583
583 /* This function assumes that you are allowed to stop the capture 584 /* This function assumes that you are allowed to stop the capture
@@ -629,7 +630,7 @@ u32 cx18_find_handle(struct cx18 *cx)
629 for (i = 0; i < CX18_MAX_STREAMS; i++) { 630 for (i = 0; i < CX18_MAX_STREAMS; i++) {
630 struct cx18_stream *s = &cx->streams[i]; 631 struct cx18_stream *s = &cx->streams[i];
631 632
632 if (s->v4l2dev && (s->handle != CX18_INVALID_TASK_HANDLE)) 633 if (s->video_dev && (s->handle != CX18_INVALID_TASK_HANDLE))
633 return s->handle; 634 return s->handle;
634 } 635 }
635 return CX18_INVALID_TASK_HANDLE; 636 return CX18_INVALID_TASK_HANDLE;
@@ -647,7 +648,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
647 s = &cx->streams[i]; 648 s = &cx->streams[i];
648 if (s->handle != handle) 649 if (s->handle != handle)
649 continue; 650 continue;
650 if (s->v4l2dev || s->dvb.enabled) 651 if (s->video_dev || s->dvb.enabled)
651 return s; 652 return s;
652 } 653 }
653 return NULL; 654 return NULL;