static int ivtv_reg_dev(struct ivtv *itv, int type) { struct ivtv_stream *s = &itv->streams[type]; int vfl_type = ivtv_stream_info[type].vfl_type; const char *name; int num; if (s->vdev == NULL) return 0; num = s->vdev->num; /* card number + user defined offset + device offset */ if (type != IVTV_ENC_STREAM_TYPE_MPG) { struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; if (s_mpg->vdev) num = s_mpg->vdev->num + ivtv_stream_info[type].num_offset; } video_set_drvdata(s->vdev, s); /* Register device. First try the desired minor, then any free one. */ if (video_register_device_no_warn(s->vdev, vfl_type, num)) { IVTV_ERR("Couldn't register v4l2 device for %s (device node number %d)\n", s->name, num); video_device_release(s->vdev); s->vdev = NULL; return -ENOMEM; } name = video_device_node_name(s->vdev); switch (vfl_type) { case VFL_TYPE_GRABBER: IVTV_INFO("Registered device %s for %s (%d kB)\n", name, s->name, itv->options.kilobytes[type]); break; case VFL_TYPE_RADIO: IVTV_INFO("Registered device %s for %s\n", name, s->name); break; case VFL_TYPE_VBI: if (itv->options.kilobytes[type]) IVTV_INFO("Registered device %s for %s (%d kB)\n", name, s->name, itv->options.kilobytes[type]); else IVTV_INFO("Registered device %s for %s\n", name, s->name); break; } return 0; }
static int cx18_reg_dev(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; int vfl_type = cx18_stream_info[type].vfl_type; const char *name; int num, ret; if (type == CX18_ENC_STREAM_TYPE_TS && s->dvb != NULL) { ret = cx18_dvb_register(s); if (ret < 0) { CX18_ERR("DVB failed to register\n"); return ret; } } if (s->video_dev == NULL) return 0; num = s->video_dev->num; /* card number + user defined offset + device offset */ if (type != CX18_ENC_STREAM_TYPE_MPG) { struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; if (s_mpg->video_dev) num = s_mpg->video_dev->num + cx18_stream_info[type].num_offset; } video_set_drvdata(s->video_dev, s); /* Register device. First try the desired minor, then any free one. */ ret = video_register_device_no_warn(s->video_dev, vfl_type, num); if (ret < 0) { CX18_ERR("Couldn't register v4l2 device for %s (device node number %d)\n", s->name, num); video_device_release(s->video_dev); s->video_dev = NULL; return ret; } name = video_device_node_name(s->video_dev); switch (vfl_type) { case VFL_TYPE_GRABBER: CX18_INFO("Registered device %s for %s (%d x %d.%02d kB)\n", name, s->name, cx->stream_buffers[type], cx->stream_buf_size[type] / 1024, (cx->stream_buf_size[type] * 100 / 1024) % 100); break; case VFL_TYPE_RADIO: CX18_INFO("Registered device %s for %s\n", name, s->name); break; case VFL_TYPE_VBI: if (cx->stream_buffers[type]) CX18_INFO("Registered device %s for %s " "(%d x %d bytes)\n", name, s->name, cx->stream_buffers[type], cx->stream_buf_size[type]); else CX18_INFO("Registered device %s for %s\n", name, s->name); break; } return 0; }
static int cx18_reg_dev(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; int vfl_type = cx18_stream_info[type].vfl_type; int num, ret; /* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something? * We need a VFL_TYPE_TS defined. */ if (strcmp("TS", s->name) == 0) { /* just return if no DVB is supported */ if ((cx->card->hw_all & CX18_HW_DVB) == 0) return 0; ret = cx18_dvb_register(s); if (ret < 0) { CX18_ERR("DVB failed to register\n"); return ret; } } if (s->video_dev == NULL) return 0; num = s->video_dev->num; /* card number + user defined offset + device offset */ if (type != CX18_ENC_STREAM_TYPE_MPG) { struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; if (s_mpg->video_dev) num = s_mpg->video_dev->num + cx18_stream_info[type].num_offset; } video_set_drvdata(s->video_dev, s); /* Register device. First try the desired minor, then any free one. */ ret = video_register_device_no_warn(s->video_dev, vfl_type, num); if (ret < 0) { CX18_ERR("Couldn't register v4l2 device for %s (device node number %d)\n", s->name, num); video_device_release(s->video_dev); s->video_dev = NULL; return ret; } num = s->video_dev->num; switch (vfl_type) { case VFL_TYPE_GRABBER: CX18_INFO("Registered device video%d for %s " "(%d x %d.%02d kB)\n", num, s->name, cx->stream_buffers[type], cx->stream_buf_size[type] / 1024, (cx->stream_buf_size[type] * 100 / 1024) % 100); break; case VFL_TYPE_RADIO: CX18_INFO("Registered device radio%d for %s\n", num, s->name); break; case VFL_TYPE_VBI: if (cx->stream_buffers[type]) CX18_INFO("Registered device vbi%d for %s " "(%d x %d bytes)\n", num, s->name, cx->stream_buffers[type], cx->stream_buf_size[type]); else CX18_INFO("Registered device vbi%d for %s\n", num, s->name); break; } return 0; }