static void cx18_stream_init(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; struct video_device *video_dev = s->video_dev; /* we need to keep video_dev, so restore it afterwards */ memset(s, 0, sizeof(*s)); s->video_dev = video_dev; /* initialize cx18_stream fields */ s->cx = cx; s->type = type; s->name = cx18_stream_info[type].name; s->handle = CX18_INVALID_TASK_HANDLE; s->dma = cx18_stream_info[type].dma; s->buffers = cx->stream_buffers[type]; s->buf_size = cx->stream_buf_size[type]; INIT_LIST_HEAD(&s->buf_pool); s->bufs_per_mdl = 1; s->mdl_size = s->buf_size * s->bufs_per_mdl; init_waitqueue_head(&s->waitq); s->id = -1; spin_lock_init(&s->q_free.lock); cx18_queue_init(&s->q_free); spin_lock_init(&s->q_busy.lock); cx18_queue_init(&s->q_busy); spin_lock_init(&s->q_full.lock); cx18_queue_init(&s->q_full); spin_lock_init(&s->q_idle.lock); cx18_queue_init(&s->q_idle); INIT_WORK(&s->out_work_order, cx18_out_work_handler); }
static void cx18_stream_init(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; struct video_device *video_dev = s->video_dev; /* we need to keep video_dev, so restore it afterwards */ memset(s, 0, sizeof(*s)); s->video_dev = video_dev; /* initialize cx18_stream fields */ s->dvb = NULL; s->cx = cx; s->type = type; s->name = cx18_stream_info[type].name; s->handle = CX18_INVALID_TASK_HANDLE; s->dma = cx18_stream_info[type].dma; s->buffers = cx->stream_buffers[type]; s->buf_size = cx->stream_buf_size[type]; INIT_LIST_HEAD(&s->buf_pool); s->bufs_per_mdl = 1; s->mdl_size = s->buf_size * s->bufs_per_mdl; init_waitqueue_head(&s->waitq); s->id = -1; spin_lock_init(&s->q_free.lock); cx18_queue_init(&s->q_free); spin_lock_init(&s->q_busy.lock); cx18_queue_init(&s->q_busy); spin_lock_init(&s->q_full.lock); cx18_queue_init(&s->q_full); spin_lock_init(&s->q_idle.lock); cx18_queue_init(&s->q_idle); INIT_WORK(&s->out_work_order, cx18_out_work_handler); INIT_LIST_HEAD(&s->vb_capture); s->vb_timeout.function = cx18_vb_timeout; s->vb_timeout.data = (unsigned long)s; init_timer(&s->vb_timeout); spin_lock_init(&s->vb_lock); if (type == CX18_ENC_STREAM_TYPE_YUV) { spin_lock_init(&s->vbuf_q_lock); s->vb_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; videobuf_queue_vmalloc_init(&s->vbuf_q, &cx18_videobuf_qops, &cx->pci_dev->dev, &s->vbuf_q_lock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_INTERLACED, sizeof(struct cx18_videobuf_buffer), s, &cx->serialize_lock); /* Assume the previous pixel default */ s->pixelformat = V4L2_PIX_FMT_HM12; s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2; } }