{
struct cx23885_fh *fh = q->priv_data;
- fh->dev->ts1.ts_packet_size = mpeglinesize;
- fh->dev->ts1.ts_packet_count = mpeglines;
+ fh->q_dev->ts1.ts_packet_size = mpeglinesize;
+ fh->q_dev->ts1.ts_packet_count = mpeglines;
- *size = fh->dev->ts1.ts_packet_size * fh->dev->ts1.ts_packet_count;
+ *size = fh->q_dev->ts1.ts_packet_size * fh->q_dev->ts1.ts_packet_count;
*count = mpegbufs;
return 0;
struct videobuf_buffer *vb, enum v4l2_field field)
{
struct cx23885_fh *fh = q->priv_data;
- return cx23885_buf_prepare(q, &fh->dev->ts1,
+ return cx23885_buf_prepare(q, &fh->q_dev->ts1,
(struct cx23885_buffer *)vb,
field);
}
struct videobuf_buffer *vb)
{
struct cx23885_fh *fh = q->priv_data;
- cx23885_buf_queue(&fh->dev->ts1, (struct cx23885_buffer *)vb);
+ cx23885_buf_queue(&fh->q_dev->ts1, (struct cx23885_buffer *)vb);
}
static void bb_buf_release(struct videobuf_queue *q,
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
*id = dev->tvnorm;
return 0;
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
unsigned int i;
for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++)
static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
dprintk(1, "%s()\n", __func__);
return cx23885_enum_input(dev, i);
}
static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *t)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
static int vidioc_s_tuner(struct file *file, void *priv,
const struct v4l2_tuner *t)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_tsport *tsport = &dev->ts1;
strlcpy(cap->driver, dev->name, sizeof(cap->driver));
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f->fmt.pix.bytesperline = 0;
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f->fmt.pix.bytesperline = 0;
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f->fmt.pix.bytesperline = 0;
static int vidioc_log_status(struct file *file, void *priv)
{
- struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
char name[32 + 2];
snprintf(name, sizeof(name), "%s/2", dev->name);
static int mpeg_open(struct file *file)
{
- struct video_device *vdev = video_devdata(file);
struct cx23885_dev *dev = video_drvdata(file);
+ struct video_device *vdev = video_devdata(file);
struct cx23885_fh *fh;
dprintk(2, "%s()\n", __func__);
v4l2_fh_init(&fh->fh, vdev);
file->private_data = fh;
- fh->dev = dev;
+ fh->q_dev = dev;
videobuf_queue_sg_init(&fh->mpegq, &cx23885_qops,
&dev->pci->dev, &dev->ts1.slock,
static int mpeg_release(struct file *file)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
dprintk(2, "%s()\n", __func__);
if (atomic_cmpxchg(&fh->v4l_reading, 1, 0) == 1) {
if (atomic_dec_return(&dev->v4l_reader_count) == 0) {
/* stop mpeg capture */
- cx23885_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
+ cx23885_api_cmd(dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
CX23885_END_NOW, CX23885_MPEG_CAPTURE,
CX23885_RAW_BITS_NONE);
msleep(500);
cx23885_417_check_encoder(dev);
- cx23885_cancel_buffers(&fh->dev->ts1);
+ cx23885_cancel_buffers(&dev->ts1);
}
}
static ssize_t mpeg_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
dprintk(2, "%s()\n", __func__);
static unsigned int mpeg_poll(struct file *file,
struct poll_table_struct *wait)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
dprintk(2, "%s\n", __func__);
static int mpeg_mmap(struct file *file, struct vm_area_struct *vma)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
dprintk(2, "%s()\n", __func__);
unsigned int *size)
{
struct cx23885_fh *fh = q->priv_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = fh->q_dev;
*size = (dev->fmt->depth * dev->width * dev->height) >> 3;
if (0 == *count)
enum v4l2_field field)
{
struct cx23885_fh *fh = q->priv_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = fh->q_dev;
struct cx23885_buffer *buf =
container_of(vb, struct cx23885_buffer, vb);
int rc, init_buffer = 0;
struct cx23885_buffer, vb);
struct cx23885_buffer *prev;
struct cx23885_fh *fh = vq->priv_data;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = fh->q_dev;
struct cx23885_dmaqueue *q = &dev->vidq;
/* add jump to stopper */
v4l2_fh_init(&fh->fh, vdev);
file->private_data = &fh->fh;
- fh->dev = dev;
+ fh->q_dev = dev;
videobuf_queue_sg_init(&fh->vidq, &cx23885_video_qops,
&dev->pci->dev, &dev->slock,
size_t count, loff_t *ppos)
{
struct video_device *vdev = video_devdata(file);
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
- if (res_locked(fh->dev, RESOURCE_VIDEO))
+ if (res_locked(dev, RESOURCE_VIDEO))
return -EBUSY;
return videobuf_read_one(&fh->vidq, data, count, ppos,
file->f_flags & O_NONBLOCK);
case VFL_TYPE_VBI:
- if (!res_get(fh->dev, fh, RESOURCE_VBI))
+ if (!res_get(dev, fh, RESOURCE_VBI))
return -EBUSY;
return videobuf_read_stream(&fh->vbiq, data, count, ppos, 1,
file->f_flags & O_NONBLOCK);
struct poll_table_struct *wait)
{
struct video_device *vdev = video_devdata(file);
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
struct cx23885_buffer *buf;
unsigned long req_events = poll_requested_events(wait);
return rc;
if (vdev->vfl_type == VFL_TYPE_VBI) {
- if (!res_get(fh->dev, fh, RESOURCE_VBI))
+ if (!res_get(dev, fh, RESOURCE_VBI))
return rc | POLLERR;
return rc | videobuf_poll_stream(file, &fh->vbiq, wait);
}
static int video_release(struct file *file)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = file->private_data;
- struct cx23885_dev *dev = fh->dev;
/* turn off overlay */
if (res_check(fh, RESOURCE_OVERLAY)) {
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
f->fmt.pix.width = dev->width;
f->fmt.pix.height = dev->height;
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fmt *fmt;
enum v4l2_field field;
unsigned int maxw, maxh;
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
struct v4l2_mbus_framefmt mbus_fmt;
int err;
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
- struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
strcpy(cap->driver, "cx23885");
strlcpy(cap->card, cx23885_boards[dev->board].name,
static int vidioc_streamon(struct file *file, void *priv,
enum v4l2_buf_type i)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
dprintk(1, "%s()\n", __func__);
if (vdev->vfl_type == VFL_TYPE_VBI &&
static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
{
+ struct cx23885_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
int err, res;
dprintk(1, "%s()\n", __func__);
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
dprintk(1, "%s()\n", __func__);
*id = dev->tvnorm;
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
dprintk(1, "%s()\n", __func__);
cx23885_set_tvnorm(dev, tvnorms);
static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
dprintk(1, "%s()\n", __func__);
return cx23885_enum_input(dev, i);
}
int cx23885_get_input(struct file *file, void *priv, unsigned int *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
*i = dev->input;
dprintk(1, "%s() returns %d\n", __func__, *i);
int cx23885_set_input(struct file *file, void *priv, unsigned int i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
dprintk(1, "%s(%d)\n", __func__, i);
static int vidioc_log_status(struct file *file, void *priv)
{
- struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
call_all(dev, core, log_status);
return 0;
static int cx23885_query_audinput(struct file *file, void *priv,
struct v4l2_audio *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
static const char *iname[] = {
[0] = "Baseband L/R 1",
[1] = "Baseband L/R 2",
static int vidioc_g_audinput(struct file *file, void *priv,
struct v4l2_audio *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
(CX23885_VMUX_CABLE == INPUT(dev->input)->type))
static int vidioc_s_audinput(struct file *file, void *priv,
const struct v4l2_audio *i)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
(CX23885_VMUX_CABLE == INPUT(dev->input)->type)) {
static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *t)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
static int vidioc_s_tuner(struct file *file, void *priv,
const struct v4l2_tuner *t)
{
- struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
- struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL;
int cx23885_set_frequency(struct file *file, void *priv,
const struct v4l2_frequency *f)
{
- struct cx23885_fh *fh = priv;
- struct cx23885_dev *dev = fh->dev;
+ struct cx23885_dev *dev = video_drvdata(file);
int ret;
switch (dev->board) {