aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-04-23 07:43:51 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-09-03 06:57:38 -0400
commit568f44a18e9b63fbb44fcb3292c3530087ae527b (patch)
tree927e06dabdc7228fb3fe7599e91f0a27c8770d7f /drivers/media/pci
parent9529a4b0cf49163e489446ec159a2dfb64f78df8 (diff)
[media] cx23885: use video_drvdata to get cx23885_dev pointer
Use video_drvdata(file) instead of fh->dev to get the cx23885_dev pointer. This prepares for the vb2 conversion where fh->dev (renamed to fh->q_dev in this patch) will be removed completely. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/cx23885/cx23885-417.c56
-rw-r--r--drivers/media/pci/cx23885/cx23885-ioctl.c6
-rw-r--r--drivers/media/pci/cx23885/cx23885-vbi.c7
-rw-r--r--drivers/media/pci/cx23885/cx23885-video.c60
-rw-r--r--drivers/media/pci/cx23885/cx23885.h2
5 files changed, 60 insertions, 71 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c
index 4142c15b259e..0948b44b1c5e 100644
--- a/drivers/media/pci/cx23885/cx23885-417.c
+++ b/drivers/media/pci/cx23885/cx23885-417.c
@@ -1147,10 +1147,10 @@ static int bb_buf_setup(struct videobuf_queue *q,
1147{ 1147{
1148 struct cx23885_fh *fh = q->priv_data; 1148 struct cx23885_fh *fh = q->priv_data;
1149 1149
1150 fh->dev->ts1.ts_packet_size = mpeglinesize; 1150 fh->q_dev->ts1.ts_packet_size = mpeglinesize;
1151 fh->dev->ts1.ts_packet_count = mpeglines; 1151 fh->q_dev->ts1.ts_packet_count = mpeglines;
1152 1152
1153 *size = fh->dev->ts1.ts_packet_size * fh->dev->ts1.ts_packet_count; 1153 *size = fh->q_dev->ts1.ts_packet_size * fh->q_dev->ts1.ts_packet_count;
1154 *count = mpegbufs; 1154 *count = mpegbufs;
1155 1155
1156 return 0; 1156 return 0;
@@ -1160,7 +1160,7 @@ static int bb_buf_prepare(struct videobuf_queue *q,
1160 struct videobuf_buffer *vb, enum v4l2_field field) 1160 struct videobuf_buffer *vb, enum v4l2_field field)
1161{ 1161{
1162 struct cx23885_fh *fh = q->priv_data; 1162 struct cx23885_fh *fh = q->priv_data;
1163 return cx23885_buf_prepare(q, &fh->dev->ts1, 1163 return cx23885_buf_prepare(q, &fh->q_dev->ts1,
1164 (struct cx23885_buffer *)vb, 1164 (struct cx23885_buffer *)vb,
1165 field); 1165 field);
1166} 1166}
@@ -1169,7 +1169,7 @@ static void bb_buf_queue(struct videobuf_queue *q,
1169 struct videobuf_buffer *vb) 1169 struct videobuf_buffer *vb)
1170{ 1170{
1171 struct cx23885_fh *fh = q->priv_data; 1171 struct cx23885_fh *fh = q->priv_data;
1172 cx23885_buf_queue(&fh->dev->ts1, (struct cx23885_buffer *)vb); 1172 cx23885_buf_queue(&fh->q_dev->ts1, (struct cx23885_buffer *)vb);
1173} 1173}
1174 1174
1175static void bb_buf_release(struct videobuf_queue *q, 1175static void bb_buf_release(struct videobuf_queue *q,
@@ -1189,8 +1189,7 @@ static struct videobuf_queue_ops cx23885_qops = {
1189 1189
1190static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) 1190static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
1191{ 1191{
1192 struct cx23885_fh *fh = file->private_data; 1192 struct cx23885_dev *dev = video_drvdata(file);
1193 struct cx23885_dev *dev = fh->dev;
1194 1193
1195 *id = dev->tvnorm; 1194 *id = dev->tvnorm;
1196 return 0; 1195 return 0;
@@ -1198,8 +1197,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
1198 1197
1199static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) 1198static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
1200{ 1199{
1201 struct cx23885_fh *fh = file->private_data; 1200 struct cx23885_dev *dev = video_drvdata(file);
1202 struct cx23885_dev *dev = fh->dev;
1203 unsigned int i; 1201 unsigned int i;
1204 1202
1205 for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++) 1203 for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++)
@@ -1218,7 +1216,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
1218static int vidioc_enum_input(struct file *file, void *priv, 1216static int vidioc_enum_input(struct file *file, void *priv,
1219 struct v4l2_input *i) 1217 struct v4l2_input *i)
1220{ 1218{
1221 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1219 struct cx23885_dev *dev = video_drvdata(file);
1222 dprintk(1, "%s()\n", __func__); 1220 dprintk(1, "%s()\n", __func__);
1223 return cx23885_enum_input(dev, i); 1221 return cx23885_enum_input(dev, i);
1224} 1222}
@@ -1236,8 +1234,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
1236static int vidioc_g_tuner(struct file *file, void *priv, 1234static int vidioc_g_tuner(struct file *file, void *priv,
1237 struct v4l2_tuner *t) 1235 struct v4l2_tuner *t)
1238{ 1236{
1239 struct cx23885_fh *fh = file->private_data; 1237 struct cx23885_dev *dev = video_drvdata(file);
1240 struct cx23885_dev *dev = fh->dev;
1241 1238
1242 if (dev->tuner_type == TUNER_ABSENT) 1239 if (dev->tuner_type == TUNER_ABSENT)
1243 return -EINVAL; 1240 return -EINVAL;
@@ -1254,8 +1251,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1254static int vidioc_s_tuner(struct file *file, void *priv, 1251static int vidioc_s_tuner(struct file *file, void *priv,
1255 const struct v4l2_tuner *t) 1252 const struct v4l2_tuner *t)
1256{ 1253{
1257 struct cx23885_fh *fh = file->private_data; 1254 struct cx23885_dev *dev = video_drvdata(file);
1258 struct cx23885_dev *dev = fh->dev;
1259 1255
1260 if (dev->tuner_type == TUNER_ABSENT) 1256 if (dev->tuner_type == TUNER_ABSENT)
1261 return -EINVAL; 1257 return -EINVAL;
@@ -1269,8 +1265,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1269static int vidioc_g_frequency(struct file *file, void *priv, 1265static int vidioc_g_frequency(struct file *file, void *priv,
1270 struct v4l2_frequency *f) 1266 struct v4l2_frequency *f)
1271{ 1267{
1272 struct cx23885_fh *fh = file->private_data; 1268 struct cx23885_dev *dev = video_drvdata(file);
1273 struct cx23885_dev *dev = fh->dev;
1274 1269
1275 if (dev->tuner_type == TUNER_ABSENT) 1270 if (dev->tuner_type == TUNER_ABSENT)
1276 return -EINVAL; 1271 return -EINVAL;
@@ -1291,8 +1286,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1291static int vidioc_querycap(struct file *file, void *priv, 1286static int vidioc_querycap(struct file *file, void *priv,
1292 struct v4l2_capability *cap) 1287 struct v4l2_capability *cap)
1293{ 1288{
1294 struct cx23885_fh *fh = file->private_data; 1289 struct cx23885_dev *dev = video_drvdata(file);
1295 struct cx23885_dev *dev = fh->dev;
1296 struct cx23885_tsport *tsport = &dev->ts1; 1290 struct cx23885_tsport *tsport = &dev->ts1;
1297 1291
1298 strlcpy(cap->driver, dev->name, sizeof(cap->driver)); 1292 strlcpy(cap->driver, dev->name, sizeof(cap->driver));
@@ -1325,8 +1319,8 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
1325static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 1319static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
1326 struct v4l2_format *f) 1320 struct v4l2_format *f)
1327{ 1321{
1322 struct cx23885_dev *dev = video_drvdata(file);
1328 struct cx23885_fh *fh = file->private_data; 1323 struct cx23885_fh *fh = file->private_data;
1329 struct cx23885_dev *dev = fh->dev;
1330 1324
1331 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 1325 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
1332 f->fmt.pix.bytesperline = 0; 1326 f->fmt.pix.bytesperline = 0;
@@ -1344,8 +1338,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
1344static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, 1338static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1345 struct v4l2_format *f) 1339 struct v4l2_format *f)
1346{ 1340{
1341 struct cx23885_dev *dev = video_drvdata(file);
1347 struct cx23885_fh *fh = file->private_data; 1342 struct cx23885_fh *fh = file->private_data;
1348 struct cx23885_dev *dev = fh->dev;
1349 1343
1350 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 1344 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
1351 f->fmt.pix.bytesperline = 0; 1345 f->fmt.pix.bytesperline = 0;
@@ -1360,8 +1354,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1360static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, 1354static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1361 struct v4l2_format *f) 1355 struct v4l2_format *f)
1362{ 1356{
1363 struct cx23885_fh *fh = file->private_data; 1357 struct cx23885_dev *dev = video_drvdata(file);
1364 struct cx23885_dev *dev = fh->dev;
1365 1358
1366 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 1359 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
1367 f->fmt.pix.bytesperline = 0; 1360 f->fmt.pix.bytesperline = 0;
@@ -1422,8 +1415,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
1422 1415
1423static int vidioc_log_status(struct file *file, void *priv) 1416static int vidioc_log_status(struct file *file, void *priv)
1424{ 1417{
1425 struct cx23885_fh *fh = priv; 1418 struct cx23885_dev *dev = video_drvdata(file);
1426 struct cx23885_dev *dev = fh->dev;
1427 char name[32 + 2]; 1419 char name[32 + 2];
1428 1420
1429 snprintf(name, sizeof(name), "%s/2", dev->name); 1421 snprintf(name, sizeof(name), "%s/2", dev->name);
@@ -1434,8 +1426,8 @@ static int vidioc_log_status(struct file *file, void *priv)
1434 1426
1435static int mpeg_open(struct file *file) 1427static int mpeg_open(struct file *file)
1436{ 1428{
1437 struct video_device *vdev = video_devdata(file);
1438 struct cx23885_dev *dev = video_drvdata(file); 1429 struct cx23885_dev *dev = video_drvdata(file);
1430 struct video_device *vdev = video_devdata(file);
1439 struct cx23885_fh *fh; 1431 struct cx23885_fh *fh;
1440 1432
1441 dprintk(2, "%s()\n", __func__); 1433 dprintk(2, "%s()\n", __func__);
@@ -1447,7 +1439,7 @@ static int mpeg_open(struct file *file)
1447 1439
1448 v4l2_fh_init(&fh->fh, vdev); 1440 v4l2_fh_init(&fh->fh, vdev);
1449 file->private_data = fh; 1441 file->private_data = fh;
1450 fh->dev = dev; 1442 fh->q_dev = dev;
1451 1443
1452 videobuf_queue_sg_init(&fh->mpegq, &cx23885_qops, 1444 videobuf_queue_sg_init(&fh->mpegq, &cx23885_qops,
1453 &dev->pci->dev, &dev->ts1.slock, 1445 &dev->pci->dev, &dev->ts1.slock,
@@ -1461,8 +1453,8 @@ static int mpeg_open(struct file *file)
1461 1453
1462static int mpeg_release(struct file *file) 1454static int mpeg_release(struct file *file)
1463{ 1455{
1456 struct cx23885_dev *dev = video_drvdata(file);
1464 struct cx23885_fh *fh = file->private_data; 1457 struct cx23885_fh *fh = file->private_data;
1465 struct cx23885_dev *dev = fh->dev;
1466 1458
1467 dprintk(2, "%s()\n", __func__); 1459 dprintk(2, "%s()\n", __func__);
1468 1460
@@ -1471,14 +1463,14 @@ static int mpeg_release(struct file *file)
1471 if (atomic_cmpxchg(&fh->v4l_reading, 1, 0) == 1) { 1463 if (atomic_cmpxchg(&fh->v4l_reading, 1, 0) == 1) {
1472 if (atomic_dec_return(&dev->v4l_reader_count) == 0) { 1464 if (atomic_dec_return(&dev->v4l_reader_count) == 0) {
1473 /* stop mpeg capture */ 1465 /* stop mpeg capture */
1474 cx23885_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, 1466 cx23885_api_cmd(dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
1475 CX23885_END_NOW, CX23885_MPEG_CAPTURE, 1467 CX23885_END_NOW, CX23885_MPEG_CAPTURE,
1476 CX23885_RAW_BITS_NONE); 1468 CX23885_RAW_BITS_NONE);
1477 1469
1478 msleep(500); 1470 msleep(500);
1479 cx23885_417_check_encoder(dev); 1471 cx23885_417_check_encoder(dev);
1480 1472
1481 cx23885_cancel_buffers(&fh->dev->ts1); 1473 cx23885_cancel_buffers(&dev->ts1);
1482 } 1474 }
1483 } 1475 }
1484 1476
@@ -1499,8 +1491,8 @@ static int mpeg_release(struct file *file)
1499static ssize_t mpeg_read(struct file *file, char __user *data, 1491static ssize_t mpeg_read(struct file *file, char __user *data,
1500 size_t count, loff_t *ppos) 1492 size_t count, loff_t *ppos)
1501{ 1493{
1494 struct cx23885_dev *dev = video_drvdata(file);
1502 struct cx23885_fh *fh = file->private_data; 1495 struct cx23885_fh *fh = file->private_data;
1503 struct cx23885_dev *dev = fh->dev;
1504 1496
1505 dprintk(2, "%s()\n", __func__); 1497 dprintk(2, "%s()\n", __func__);
1506 1498
@@ -1520,8 +1512,8 @@ static ssize_t mpeg_read(struct file *file, char __user *data,
1520static unsigned int mpeg_poll(struct file *file, 1512static unsigned int mpeg_poll(struct file *file,
1521 struct poll_table_struct *wait) 1513 struct poll_table_struct *wait)
1522{ 1514{
1515 struct cx23885_dev *dev = video_drvdata(file);
1523 struct cx23885_fh *fh = file->private_data; 1516 struct cx23885_fh *fh = file->private_data;
1524 struct cx23885_dev *dev = fh->dev;
1525 1517
1526 dprintk(2, "%s\n", __func__); 1518 dprintk(2, "%s\n", __func__);
1527 1519
@@ -1530,8 +1522,8 @@ static unsigned int mpeg_poll(struct file *file,
1530 1522
1531static int mpeg_mmap(struct file *file, struct vm_area_struct *vma) 1523static int mpeg_mmap(struct file *file, struct vm_area_struct *vma)
1532{ 1524{
1525 struct cx23885_dev *dev = video_drvdata(file);
1533 struct cx23885_fh *fh = file->private_data; 1526 struct cx23885_fh *fh = file->private_data;
1534 struct cx23885_dev *dev = fh->dev;
1535 1527
1536 dprintk(2, "%s()\n", __func__); 1528 dprintk(2, "%s()\n", __func__);
1537 1529
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.c b/drivers/media/pci/cx23885/cx23885-ioctl.c
index 271d69d1ca8c..9c16786371a2 100644
--- a/drivers/media/pci/cx23885/cx23885-ioctl.c
+++ b/drivers/media/pci/cx23885/cx23885-ioctl.c
@@ -28,7 +28,7 @@
28int cx23885_g_chip_info(struct file *file, void *fh, 28int cx23885_g_chip_info(struct file *file, void *fh,
29 struct v4l2_dbg_chip_info *chip) 29 struct v4l2_dbg_chip_info *chip)
30{ 30{
31 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 31 struct cx23885_dev *dev = video_drvdata(file);
32 32
33 if (chip->match.addr > 1) 33 if (chip->match.addr > 1)
34 return -EINVAL; 34 return -EINVAL;
@@ -64,7 +64,7 @@ static int cx23417_g_register(struct cx23885_dev *dev,
64int cx23885_g_register(struct file *file, void *fh, 64int cx23885_g_register(struct file *file, void *fh,
65 struct v4l2_dbg_register *reg) 65 struct v4l2_dbg_register *reg)
66{ 66{
67 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 67 struct cx23885_dev *dev = video_drvdata(file);
68 68
69 if (reg->match.addr > 1) 69 if (reg->match.addr > 1)
70 return -EINVAL; 70 return -EINVAL;
@@ -96,7 +96,7 @@ static int cx23417_s_register(struct cx23885_dev *dev,
96int cx23885_s_register(struct file *file, void *fh, 96int cx23885_s_register(struct file *file, void *fh,
97 const struct v4l2_dbg_register *reg) 97 const struct v4l2_dbg_register *reg)
98{ 98{
99 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 99 struct cx23885_dev *dev = video_drvdata(file);
100 100
101 if (reg->match.addr > 1) 101 if (reg->match.addr > 1)
102 return -EINVAL; 102 return -EINVAL;
diff --git a/drivers/media/pci/cx23885/cx23885-vbi.c b/drivers/media/pci/cx23885/cx23885-vbi.c
index a1154f035bc1..1cb67d38022a 100644
--- a/drivers/media/pci/cx23885/cx23885-vbi.c
+++ b/drivers/media/pci/cx23885/cx23885-vbi.c
@@ -50,8 +50,7 @@ MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
50int cx23885_vbi_fmt(struct file *file, void *priv, 50int cx23885_vbi_fmt(struct file *file, void *priv,
51 struct v4l2_format *f) 51 struct v4l2_format *f)
52{ 52{
53 struct cx23885_fh *fh = priv; 53 struct cx23885_dev *dev = video_drvdata(file);
54 struct cx23885_dev *dev = fh->dev;
55 54
56 if (dev->tvnorm & V4L2_STD_525_60) { 55 if (dev->tvnorm & V4L2_STD_525_60) {
57 /* ntsc */ 56 /* ntsc */
@@ -201,7 +200,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
201 enum v4l2_field field) 200 enum v4l2_field field)
202{ 201{
203 struct cx23885_fh *fh = q->priv_data; 202 struct cx23885_fh *fh = q->priv_data;
204 struct cx23885_dev *dev = fh->dev; 203 struct cx23885_dev *dev = fh->q_dev;
205 struct cx23885_buffer *buf = container_of(vb, 204 struct cx23885_buffer *buf = container_of(vb,
206 struct cx23885_buffer, vb); 205 struct cx23885_buffer, vb);
207 struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); 206 struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb);
@@ -242,7 +241,7 @@ vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
242 container_of(vb, struct cx23885_buffer, vb); 241 container_of(vb, struct cx23885_buffer, vb);
243 struct cx23885_buffer *prev; 242 struct cx23885_buffer *prev;
244 struct cx23885_fh *fh = vq->priv_data; 243 struct cx23885_fh *fh = vq->priv_data;
245 struct cx23885_dev *dev = fh->dev; 244 struct cx23885_dev *dev = fh->q_dev;
246 struct cx23885_dmaqueue *q = &dev->vbiq; 245 struct cx23885_dmaqueue *q = &dev->vbiq;
247 246
248 /* add jump to stopper */ 247 /* add jump to stopper */
diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c
index 3dcee0a01787..b3740038cefb 100644
--- a/drivers/media/pci/cx23885/cx23885-video.c
+++ b/drivers/media/pci/cx23885/cx23885-video.c
@@ -432,7 +432,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count,
432 unsigned int *size) 432 unsigned int *size)
433{ 433{
434 struct cx23885_fh *fh = q->priv_data; 434 struct cx23885_fh *fh = q->priv_data;
435 struct cx23885_dev *dev = fh->dev; 435 struct cx23885_dev *dev = fh->q_dev;
436 436
437 *size = (dev->fmt->depth * dev->width * dev->height) >> 3; 437 *size = (dev->fmt->depth * dev->width * dev->height) >> 3;
438 if (0 == *count) 438 if (0 == *count)
@@ -446,7 +446,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
446 enum v4l2_field field) 446 enum v4l2_field field)
447{ 447{
448 struct cx23885_fh *fh = q->priv_data; 448 struct cx23885_fh *fh = q->priv_data;
449 struct cx23885_dev *dev = fh->dev; 449 struct cx23885_dev *dev = fh->q_dev;
450 struct cx23885_buffer *buf = 450 struct cx23885_buffer *buf =
451 container_of(vb, struct cx23885_buffer, vb); 451 container_of(vb, struct cx23885_buffer, vb);
452 int rc, init_buffer = 0; 452 int rc, init_buffer = 0;
@@ -562,7 +562,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
562 struct cx23885_buffer, vb); 562 struct cx23885_buffer, vb);
563 struct cx23885_buffer *prev; 563 struct cx23885_buffer *prev;
564 struct cx23885_fh *fh = vq->priv_data; 564 struct cx23885_fh *fh = vq->priv_data;
565 struct cx23885_dev *dev = fh->dev; 565 struct cx23885_dev *dev = fh->q_dev;
566 struct cx23885_dmaqueue *q = &dev->vidq; 566 struct cx23885_dmaqueue *q = &dev->vidq;
567 567
568 /* add jump to stopper */ 568 /* add jump to stopper */
@@ -670,7 +670,7 @@ static int video_open(struct file *file)
670 670
671 v4l2_fh_init(&fh->fh, vdev); 671 v4l2_fh_init(&fh->fh, vdev);
672 file->private_data = &fh->fh; 672 file->private_data = &fh->fh;
673 fh->dev = dev; 673 fh->q_dev = dev;
674 674
675 videobuf_queue_sg_init(&fh->vidq, &cx23885_video_qops, 675 videobuf_queue_sg_init(&fh->vidq, &cx23885_video_qops,
676 &dev->pci->dev, &dev->slock, 676 &dev->pci->dev, &dev->slock,
@@ -697,16 +697,17 @@ static ssize_t video_read(struct file *file, char __user *data,
697 size_t count, loff_t *ppos) 697 size_t count, loff_t *ppos)
698{ 698{
699 struct video_device *vdev = video_devdata(file); 699 struct video_device *vdev = video_devdata(file);
700 struct cx23885_dev *dev = video_drvdata(file);
700 struct cx23885_fh *fh = file->private_data; 701 struct cx23885_fh *fh = file->private_data;
701 702
702 switch (vdev->vfl_type) { 703 switch (vdev->vfl_type) {
703 case VFL_TYPE_GRABBER: 704 case VFL_TYPE_GRABBER:
704 if (res_locked(fh->dev, RESOURCE_VIDEO)) 705 if (res_locked(dev, RESOURCE_VIDEO))
705 return -EBUSY; 706 return -EBUSY;
706 return videobuf_read_one(&fh->vidq, data, count, ppos, 707 return videobuf_read_one(&fh->vidq, data, count, ppos,
707 file->f_flags & O_NONBLOCK); 708 file->f_flags & O_NONBLOCK);
708 case VFL_TYPE_VBI: 709 case VFL_TYPE_VBI:
709 if (!res_get(fh->dev, fh, RESOURCE_VBI)) 710 if (!res_get(dev, fh, RESOURCE_VBI))
710 return -EBUSY; 711 return -EBUSY;
711 return videobuf_read_stream(&fh->vbiq, data, count, ppos, 1, 712 return videobuf_read_stream(&fh->vbiq, data, count, ppos, 1,
712 file->f_flags & O_NONBLOCK); 713 file->f_flags & O_NONBLOCK);
@@ -719,6 +720,7 @@ static unsigned int video_poll(struct file *file,
719 struct poll_table_struct *wait) 720 struct poll_table_struct *wait)
720{ 721{
721 struct video_device *vdev = video_devdata(file); 722 struct video_device *vdev = video_devdata(file);
723 struct cx23885_dev *dev = video_drvdata(file);
722 struct cx23885_fh *fh = file->private_data; 724 struct cx23885_fh *fh = file->private_data;
723 struct cx23885_buffer *buf; 725 struct cx23885_buffer *buf;
724 unsigned long req_events = poll_requested_events(wait); 726 unsigned long req_events = poll_requested_events(wait);
@@ -732,7 +734,7 @@ static unsigned int video_poll(struct file *file,
732 return rc; 734 return rc;
733 735
734 if (vdev->vfl_type == VFL_TYPE_VBI) { 736 if (vdev->vfl_type == VFL_TYPE_VBI) {
735 if (!res_get(fh->dev, fh, RESOURCE_VBI)) 737 if (!res_get(dev, fh, RESOURCE_VBI))
736 return rc | POLLERR; 738 return rc | POLLERR;
737 return rc | videobuf_poll_stream(file, &fh->vbiq, wait); 739 return rc | videobuf_poll_stream(file, &fh->vbiq, wait);
738 } 740 }
@@ -761,8 +763,8 @@ done:
761 763
762static int video_release(struct file *file) 764static int video_release(struct file *file)
763{ 765{
766 struct cx23885_dev *dev = video_drvdata(file);
764 struct cx23885_fh *fh = file->private_data; 767 struct cx23885_fh *fh = file->private_data;
765 struct cx23885_dev *dev = fh->dev;
766 768
767 /* turn off overlay */ 769 /* turn off overlay */
768 if (res_check(fh, RESOURCE_OVERLAY)) { 770 if (res_check(fh, RESOURCE_OVERLAY)) {
@@ -816,8 +818,8 @@ static int video_mmap(struct file *file, struct vm_area_struct *vma)
816static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 818static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
817 struct v4l2_format *f) 819 struct v4l2_format *f)
818{ 820{
821 struct cx23885_dev *dev = video_drvdata(file);
819 struct cx23885_fh *fh = priv; 822 struct cx23885_fh *fh = priv;
820 struct cx23885_dev *dev = fh->dev;
821 823
822 f->fmt.pix.width = dev->width; 824 f->fmt.pix.width = dev->width;
823 f->fmt.pix.height = dev->height; 825 f->fmt.pix.height = dev->height;
@@ -835,7 +837,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
835static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, 837static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
836 struct v4l2_format *f) 838 struct v4l2_format *f)
837{ 839{
838 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 840 struct cx23885_dev *dev = video_drvdata(file);
839 struct cx23885_fmt *fmt; 841 struct cx23885_fmt *fmt;
840 enum v4l2_field field; 842 enum v4l2_field field;
841 unsigned int maxw, maxh; 843 unsigned int maxw, maxh;
@@ -881,8 +883,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
881static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, 883static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
882 struct v4l2_format *f) 884 struct v4l2_format *f)
883{ 885{
886 struct cx23885_dev *dev = video_drvdata(file);
884 struct cx23885_fh *fh = priv; 887 struct cx23885_fh *fh = priv;
885 struct cx23885_dev *dev = fh->dev;
886 struct v4l2_mbus_framefmt mbus_fmt; 888 struct v4l2_mbus_framefmt mbus_fmt;
887 int err; 889 int err;
888 890
@@ -906,9 +908,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
906static int vidioc_querycap(struct file *file, void *priv, 908static int vidioc_querycap(struct file *file, void *priv,
907 struct v4l2_capability *cap) 909 struct v4l2_capability *cap)
908{ 910{
911 struct cx23885_dev *dev = video_drvdata(file);
909 struct video_device *vdev = video_devdata(file); 912 struct video_device *vdev = video_devdata(file);
910 struct cx23885_fh *fh = priv;
911 struct cx23885_dev *dev = fh->dev;
912 913
913 strcpy(cap->driver, "cx23885"); 914 strcpy(cap->driver, "cx23885");
914 strlcpy(cap->card, cx23885_boards[dev->board].name, 915 strlcpy(cap->card, cx23885_boards[dev->board].name,
@@ -967,9 +968,9 @@ static int vidioc_dqbuf(struct file *file, void *priv,
967static int vidioc_streamon(struct file *file, void *priv, 968static int vidioc_streamon(struct file *file, void *priv,
968 enum v4l2_buf_type i) 969 enum v4l2_buf_type i)
969{ 970{
971 struct cx23885_dev *dev = video_drvdata(file);
970 struct video_device *vdev = video_devdata(file); 972 struct video_device *vdev = video_devdata(file);
971 struct cx23885_fh *fh = priv; 973 struct cx23885_fh *fh = priv;
972 struct cx23885_dev *dev = fh->dev;
973 dprintk(1, "%s()\n", __func__); 974 dprintk(1, "%s()\n", __func__);
974 975
975 if (vdev->vfl_type == VFL_TYPE_VBI && 976 if (vdev->vfl_type == VFL_TYPE_VBI &&
@@ -994,9 +995,9 @@ static int vidioc_streamon(struct file *file, void *priv,
994 995
995static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) 996static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
996{ 997{
998 struct cx23885_dev *dev = video_drvdata(file);
997 struct video_device *vdev = video_devdata(file); 999 struct video_device *vdev = video_devdata(file);
998 struct cx23885_fh *fh = priv; 1000 struct cx23885_fh *fh = priv;
999 struct cx23885_dev *dev = fh->dev;
1000 int err, res; 1001 int err, res;
1001 dprintk(1, "%s()\n", __func__); 1002 dprintk(1, "%s()\n", __func__);
1002 1003
@@ -1017,7 +1018,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
1017 1018
1018static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) 1019static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
1019{ 1020{
1020 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1021 struct cx23885_dev *dev = video_drvdata(file);
1021 dprintk(1, "%s()\n", __func__); 1022 dprintk(1, "%s()\n", __func__);
1022 1023
1023 *id = dev->tvnorm; 1024 *id = dev->tvnorm;
@@ -1026,7 +1027,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
1026 1027
1027static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) 1028static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
1028{ 1029{
1029 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1030 struct cx23885_dev *dev = video_drvdata(file);
1030 dprintk(1, "%s()\n", __func__); 1031 dprintk(1, "%s()\n", __func__);
1031 1032
1032 cx23885_set_tvnorm(dev, tvnorms); 1033 cx23885_set_tvnorm(dev, tvnorms);
@@ -1086,14 +1087,14 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
1086static int vidioc_enum_input(struct file *file, void *priv, 1087static int vidioc_enum_input(struct file *file, void *priv,
1087 struct v4l2_input *i) 1088 struct v4l2_input *i)
1088{ 1089{
1089 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1090 struct cx23885_dev *dev = video_drvdata(file);
1090 dprintk(1, "%s()\n", __func__); 1091 dprintk(1, "%s()\n", __func__);
1091 return cx23885_enum_input(dev, i); 1092 return cx23885_enum_input(dev, i);
1092} 1093}
1093 1094
1094int cx23885_get_input(struct file *file, void *priv, unsigned int *i) 1095int cx23885_get_input(struct file *file, void *priv, unsigned int *i)
1095{ 1096{
1096 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1097 struct cx23885_dev *dev = video_drvdata(file);
1097 1098
1098 *i = dev->input; 1099 *i = dev->input;
1099 dprintk(1, "%s() returns %d\n", __func__, *i); 1100 dprintk(1, "%s() returns %d\n", __func__, *i);
@@ -1107,7 +1108,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
1107 1108
1108int cx23885_set_input(struct file *file, void *priv, unsigned int i) 1109int cx23885_set_input(struct file *file, void *priv, unsigned int i)
1109{ 1110{
1110 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1111 struct cx23885_dev *dev = video_drvdata(file);
1111 1112
1112 dprintk(1, "%s(%d)\n", __func__, i); 1113 dprintk(1, "%s(%d)\n", __func__, i);
1113 1114
@@ -1134,8 +1135,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
1134 1135
1135static int vidioc_log_status(struct file *file, void *priv) 1136static int vidioc_log_status(struct file *file, void *priv)
1136{ 1137{
1137 struct cx23885_fh *fh = priv; 1138 struct cx23885_dev *dev = video_drvdata(file);
1138 struct cx23885_dev *dev = fh->dev;
1139 1139
1140 call_all(dev, core, log_status); 1140 call_all(dev, core, log_status);
1141 return 0; 1141 return 0;
@@ -1144,7 +1144,7 @@ static int vidioc_log_status(struct file *file, void *priv)
1144static int cx23885_query_audinput(struct file *file, void *priv, 1144static int cx23885_query_audinput(struct file *file, void *priv,
1145 struct v4l2_audio *i) 1145 struct v4l2_audio *i)
1146{ 1146{
1147 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1147 struct cx23885_dev *dev = video_drvdata(file);
1148 static const char *iname[] = { 1148 static const char *iname[] = {
1149 [0] = "Baseband L/R 1", 1149 [0] = "Baseband L/R 1",
1150 [1] = "Baseband L/R 2", 1150 [1] = "Baseband L/R 2",
@@ -1174,7 +1174,7 @@ static int vidioc_enum_audinput(struct file *file, void *priv,
1174static int vidioc_g_audinput(struct file *file, void *priv, 1174static int vidioc_g_audinput(struct file *file, void *priv,
1175 struct v4l2_audio *i) 1175 struct v4l2_audio *i)
1176{ 1176{
1177 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1177 struct cx23885_dev *dev = video_drvdata(file);
1178 1178
1179 if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) || 1179 if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
1180 (CX23885_VMUX_CABLE == INPUT(dev->input)->type)) 1180 (CX23885_VMUX_CABLE == INPUT(dev->input)->type))
@@ -1189,7 +1189,7 @@ static int vidioc_g_audinput(struct file *file, void *priv,
1189static int vidioc_s_audinput(struct file *file, void *priv, 1189static int vidioc_s_audinput(struct file *file, void *priv,
1190 const struct v4l2_audio *i) 1190 const struct v4l2_audio *i)
1191{ 1191{
1192 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1192 struct cx23885_dev *dev = video_drvdata(file);
1193 1193
1194 if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) || 1194 if ((CX23885_VMUX_TELEVISION == INPUT(dev->input)->type) ||
1195 (CX23885_VMUX_CABLE == INPUT(dev->input)->type)) { 1195 (CX23885_VMUX_CABLE == INPUT(dev->input)->type)) {
@@ -1211,7 +1211,7 @@ static int vidioc_s_audinput(struct file *file, void *priv,
1211static int vidioc_g_tuner(struct file *file, void *priv, 1211static int vidioc_g_tuner(struct file *file, void *priv,
1212 struct v4l2_tuner *t) 1212 struct v4l2_tuner *t)
1213{ 1213{
1214 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1214 struct cx23885_dev *dev = video_drvdata(file);
1215 1215
1216 if (dev->tuner_type == TUNER_ABSENT) 1216 if (dev->tuner_type == TUNER_ABSENT)
1217 return -EINVAL; 1217 return -EINVAL;
@@ -1227,7 +1227,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1227static int vidioc_s_tuner(struct file *file, void *priv, 1227static int vidioc_s_tuner(struct file *file, void *priv,
1228 const struct v4l2_tuner *t) 1228 const struct v4l2_tuner *t)
1229{ 1229{
1230 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 1230 struct cx23885_dev *dev = video_drvdata(file);
1231 1231
1232 if (dev->tuner_type == TUNER_ABSENT) 1232 if (dev->tuner_type == TUNER_ABSENT)
1233 return -EINVAL; 1233 return -EINVAL;
@@ -1242,8 +1242,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1242static int vidioc_g_frequency(struct file *file, void *priv, 1242static int vidioc_g_frequency(struct file *file, void *priv,
1243 struct v4l2_frequency *f) 1243 struct v4l2_frequency *f)
1244{ 1244{
1245 struct cx23885_fh *fh = priv; 1245 struct cx23885_dev *dev = video_drvdata(file);
1246 struct cx23885_dev *dev = fh->dev;
1247 1246
1248 if (dev->tuner_type == TUNER_ABSENT) 1247 if (dev->tuner_type == TUNER_ABSENT)
1249 return -EINVAL; 1248 return -EINVAL;
@@ -1349,8 +1348,7 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev,
1349int cx23885_set_frequency(struct file *file, void *priv, 1348int cx23885_set_frequency(struct file *file, void *priv,
1350 const struct v4l2_frequency *f) 1349 const struct v4l2_frequency *f)
1351{ 1350{
1352 struct cx23885_fh *fh = priv; 1351 struct cx23885_dev *dev = video_drvdata(file);
1353 struct cx23885_dev *dev = fh->dev;
1354 int ret; 1352 int ret;
1355 1353
1356 switch (dev->board) { 1354 switch (dev->board) {
diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h
index 9cd2b1b31cec..95f8c422a3d6 100644
--- a/drivers/media/pci/cx23885/cx23885.h
+++ b/drivers/media/pci/cx23885/cx23885.h
@@ -142,8 +142,8 @@ struct cx23885_tvnorm {
142 142
143struct cx23885_fh { 143struct cx23885_fh {
144 struct v4l2_fh fh; 144 struct v4l2_fh fh;
145 struct cx23885_dev *dev;
146 u32 resources; 145 u32 resources;
146 struct cx23885_dev *q_dev;
147 147
148 /* vbi capture */ 148 /* vbi capture */
149 struct videobuf_queue vidq; 149 struct videobuf_queue vidq;