aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-14 10:53:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:05:22 -0400
commitbe178cb4f41f70e29108ce4eb5a8a77a62f1922f (patch)
tree57bdcd58cb2352149f73383ddc487d76d9c615e8
parentb6f8727e9f4cff765de2b24e82c1b2cfc1a74a86 (diff)
[media] cx25821: use core locking
This allows us to replace .ioctl with .unlocked_ioctl. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/pci/cx25821/cx25821-medusa-video.c44
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c72
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.h6
-rw-r--r--drivers/media/pci/cx25821/cx25821.h1
4 files changed, 27 insertions, 96 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-medusa-video.c b/drivers/media/pci/cx25821/cx25821-medusa-video.c
index 6ab3ae08348e..22fa04415ccc 100644
--- a/drivers/media/pci/cx25821/cx25821-medusa-video.c
+++ b/drivers/media/pci/cx25821/cx25821-medusa-video.c
@@ -94,8 +94,6 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev)
94 u32 value = 0; 94 u32 value = 0;
95 u32 tmp = 0; 95 u32 tmp = 0;
96 96
97 mutex_lock(&dev->lock);
98
99 for (i = 0; i < MAX_DECODERS; i++) { 97 for (i = 0; i < MAX_DECODERS; i++) {
100 /* set video format NTSC-M */ 98 /* set video format NTSC-M */
101 value = cx25821_i2c_read(&dev->i2c_bus[0], 99 value = cx25821_i2c_read(&dev->i2c_bus[0],
@@ -222,8 +220,6 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev)
222 value |= 0x00080200; 220 value |= 0x00080200;
223 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); 221 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value);
224 222
225 mutex_unlock(&dev->lock);
226
227 return ret_val; 223 return ret_val;
228} 224}
229 225
@@ -265,8 +261,6 @@ static int medusa_initialize_pal(struct cx25821_dev *dev)
265 u32 value = 0; 261 u32 value = 0;
266 u32 tmp = 0; 262 u32 tmp = 0;
267 263
268 mutex_lock(&dev->lock);
269
270 for (i = 0; i < MAX_DECODERS; i++) { 264 for (i = 0; i < MAX_DECODERS; i++) {
271 /* set video format PAL-BDGHI */ 265 /* set video format PAL-BDGHI */
272 value = cx25821_i2c_read(&dev->i2c_bus[0], 266 value = cx25821_i2c_read(&dev->i2c_bus[0],
@@ -397,8 +391,6 @@ static int medusa_initialize_pal(struct cx25821_dev *dev)
397 value &= 0xFFF7FDFF; 391 value &= 0xFFF7FDFF;
398 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); 392 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value);
399 393
400 mutex_unlock(&dev->lock);
401
402 return ret_val; 394 return ret_val;
403} 395}
404 396
@@ -434,8 +426,6 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width,
434 u32 vscale = 0x0; 426 u32 vscale = 0x0;
435 const int MAX_WIDTH = 720; 427 const int MAX_WIDTH = 720;
436 428
437 mutex_lock(&dev->lock);
438
439 /* validate the width */ 429 /* validate the width */
440 if (width > MAX_WIDTH) { 430 if (width > MAX_WIDTH) {
441 pr_info("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n", 431 pr_info("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n",
@@ -485,8 +475,6 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width,
485 cx25821_i2c_write(&dev->i2c_bus[0], 475 cx25821_i2c_write(&dev->i2c_bus[0],
486 VSCALE_CTRL + (0x200 * decoder), vscale); 476 VSCALE_CTRL + (0x200 * decoder), vscale);
487 } 477 }
488
489 mutex_unlock(&dev->lock);
490} 478}
491 479
492static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, 480static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder,
@@ -496,11 +484,8 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder,
496 u32 tmp = 0; 484 u32 tmp = 0;
497 u32 disp_cnt_reg = DISP_AB_CNT; 485 u32 disp_cnt_reg = DISP_AB_CNT;
498 486
499 mutex_lock(&dev->lock);
500
501 /* no support */ 487 /* no support */
502 if (decoder < VDEC_A || decoder > VDEC_H) { 488 if (decoder < VDEC_A || decoder > VDEC_H) {
503 mutex_unlock(&dev->lock);
504 return; 489 return;
505 } 490 }
506 491
@@ -535,8 +520,6 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder,
535 } 520 }
536 521
537 cx25821_i2c_write(&dev->i2c_bus[0], disp_cnt_reg, fld_cnt); 522 cx25821_i2c_write(&dev->i2c_bus[0], disp_cnt_reg, fld_cnt);
538
539 mutex_unlock(&dev->lock);
540} 523}
541 524
542/* Map to Medusa register setting */ 525/* Map to Medusa register setting */
@@ -587,10 +570,8 @@ int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder)
587 int value = 0; 570 int value = 0;
588 u32 val = 0, tmp = 0; 571 u32 val = 0, tmp = 0;
589 572
590 mutex_lock(&dev->lock);
591 if ((brightness > VIDEO_PROCAMP_MAX) || 573 if ((brightness > VIDEO_PROCAMP_MAX) ||
592 (brightness < VIDEO_PROCAMP_MIN)) { 574 (brightness < VIDEO_PROCAMP_MIN)) {
593 mutex_unlock(&dev->lock);
594 return -1; 575 return -1;
595 } 576 }
596 ret_val = mapM(VIDEO_PROCAMP_MIN, VIDEO_PROCAMP_MAX, brightness, 577 ret_val = mapM(VIDEO_PROCAMP_MIN, VIDEO_PROCAMP_MAX, brightness,
@@ -601,7 +582,6 @@ int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder)
601 val &= 0xFFFFFF00; 582 val &= 0xFFFFFF00;
602 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], 583 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0],
603 VDEC_A_BRITE_CTRL + (0x200 * decoder), val | value); 584 VDEC_A_BRITE_CTRL + (0x200 * decoder), val | value);
604 mutex_unlock(&dev->lock);
605 return ret_val; 585 return ret_val;
606} 586}
607 587
@@ -611,10 +591,7 @@ int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder)
611 int value = 0; 591 int value = 0;
612 u32 val = 0, tmp = 0; 592 u32 val = 0, tmp = 0;
613 593
614 mutex_lock(&dev->lock);
615
616 if ((contrast > VIDEO_PROCAMP_MAX) || (contrast < VIDEO_PROCAMP_MIN)) { 594 if ((contrast > VIDEO_PROCAMP_MAX) || (contrast < VIDEO_PROCAMP_MIN)) {
617 mutex_unlock(&dev->lock);
618 return -1; 595 return -1;
619 } 596 }
620 597
@@ -626,7 +603,6 @@ int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder)
626 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], 603 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0],
627 VDEC_A_CNTRST_CTRL + (0x200 * decoder), val | value); 604 VDEC_A_CNTRST_CTRL + (0x200 * decoder), val | value);
628 605
629 mutex_unlock(&dev->lock);
630 return ret_val; 606 return ret_val;
631} 607}
632 608
@@ -636,10 +612,7 @@ int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder)
636 int value = 0; 612 int value = 0;
637 u32 val = 0, tmp = 0; 613 u32 val = 0, tmp = 0;
638 614
639 mutex_lock(&dev->lock);
640
641 if ((hue > VIDEO_PROCAMP_MAX) || (hue < VIDEO_PROCAMP_MIN)) { 615 if ((hue > VIDEO_PROCAMP_MAX) || (hue < VIDEO_PROCAMP_MIN)) {
642 mutex_unlock(&dev->lock);
643 return -1; 616 return -1;
644 } 617 }
645 618
@@ -654,7 +627,6 @@ int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder)
654 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], 627 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0],
655 VDEC_A_HUE_CTRL + (0x200 * decoder), val | value); 628 VDEC_A_HUE_CTRL + (0x200 * decoder), val | value);
656 629
657 mutex_unlock(&dev->lock);
658 return ret_val; 630 return ret_val;
659} 631}
660 632
@@ -664,11 +636,8 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder)
664 int value = 0; 636 int value = 0;
665 u32 val = 0, tmp = 0; 637 u32 val = 0, tmp = 0;
666 638
667 mutex_lock(&dev->lock);
668
669 if ((saturation > VIDEO_PROCAMP_MAX) || 639 if ((saturation > VIDEO_PROCAMP_MAX) ||
670 (saturation < VIDEO_PROCAMP_MIN)) { 640 (saturation < VIDEO_PROCAMP_MIN)) {
671 mutex_unlock(&dev->lock);
672 return -1; 641 return -1;
673 } 642 }
674 643
@@ -687,7 +656,6 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder)
687 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], 656 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0],
688 VDEC_A_VSAT_CTRL + (0x200 * decoder), val | value); 657 VDEC_A_VSAT_CTRL + (0x200 * decoder), val | value);
689 658
690 mutex_unlock(&dev->lock);
691 return ret_val; 659 return ret_val;
692} 660}
693 661
@@ -699,8 +667,6 @@ int medusa_video_init(struct cx25821_dev *dev)
699 int ret_val = 0; 667 int ret_val = 0;
700 int i = 0; 668 int i = 0;
701 669
702 mutex_lock(&dev->lock);
703
704 _num_decoders = dev->_max_num_decoders; 670 _num_decoders = dev->_max_num_decoders;
705 671
706 /* disable Auto source selection on all video decoders */ 672 /* disable Auto source selection on all video decoders */
@@ -719,13 +685,9 @@ int medusa_video_init(struct cx25821_dev *dev)
719 if (ret_val < 0) 685 if (ret_val < 0)
720 goto error; 686 goto error;
721 687
722 mutex_unlock(&dev->lock);
723
724 for (i = 0; i < _num_decoders; i++) 688 for (i = 0; i < _num_decoders; i++)
725 medusa_set_decoderduration(dev, i, _display_field_cnt[i]); 689 medusa_set_decoderduration(dev, i, _display_field_cnt[i]);
726 690
727 mutex_lock(&dev->lock);
728
729 /* Select monitor as DENC A input, power up the DAC */ 691 /* Select monitor as DENC A input, power up the DAC */
730 value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp); 692 value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp);
731 value &= 0xFF70FF70; 693 value &= 0xFF70FF70;
@@ -774,14 +736,8 @@ int medusa_video_init(struct cx25821_dev *dev)
774 if (ret_val < 0) 736 if (ret_val < 0)
775 goto error; 737 goto error;
776 738
777
778 mutex_unlock(&dev->lock);
779
780 ret_val = medusa_set_videostandard(dev); 739 ret_val = medusa_set_videostandard(dev);
781 740
782 return ret_val;
783
784error: 741error:
785 mutex_unlock(&dev->lock);
786 return ret_val; 742 return ret_val;
787} 743}
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index 6088ee996b92..ab79bd5e5f68 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -144,27 +144,8 @@ static int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
144 return 0; 144 return 0;
145} 145}
146 146
147/*
148static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl)
149{
150 int i;
151
152 if (qctrl->id < V4L2_CID_BASE || qctrl->id >= V4L2_CID_LASTP1)
153 return -EINVAL;
154 for (i = 0; i < CX25821_CTLS; i++)
155 if (cx25821_ctls[i].v.id == qctrl->id)
156 break;
157 if (i == CX25821_CTLS) {
158 *qctrl = no_ctl;
159 return 0;
160 }
161 *qctrl = cx25821_ctls[i].v;
162 return 0;
163}
164*/
165
166/* resource management */ 147/* resource management */
167int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, 148static int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
168 unsigned int bit) 149 unsigned int bit)
169{ 150{
170 dprintk(1, "%s()\n", __func__); 151 dprintk(1, "%s()\n", __func__);
@@ -173,41 +154,36 @@ int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
173 return 1; 154 return 1;
174 155
175 /* is it free? */ 156 /* is it free? */
176 mutex_lock(&dev->lock);
177 if (dev->channels[fh->channel_id].resources & bit) { 157 if (dev->channels[fh->channel_id].resources & bit) {
178 /* no, someone else uses it */ 158 /* no, someone else uses it */
179 mutex_unlock(&dev->lock);
180 return 0; 159 return 0;
181 } 160 }
182 /* it's free, grab it */ 161 /* it's free, grab it */
183 fh->resources |= bit; 162 fh->resources |= bit;
184 dev->channels[fh->channel_id].resources |= bit; 163 dev->channels[fh->channel_id].resources |= bit;
185 dprintk(1, "res: get %d\n", bit); 164 dprintk(1, "res: get %d\n", bit);
186 mutex_unlock(&dev->lock);
187 return 1; 165 return 1;
188} 166}
189 167
190int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit) 168static int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit)
191{ 169{
192 return fh->resources & bit; 170 return fh->resources & bit;
193} 171}
194 172
195int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit) 173static int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit)
196{ 174{
197 return fh->dev->channels[fh->channel_id].resources & bit; 175 return fh->dev->channels[fh->channel_id].resources & bit;
198} 176}
199 177
200void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, 178static void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
201 unsigned int bits) 179 unsigned int bits)
202{ 180{
203 BUG_ON((fh->resources & bits) != bits); 181 BUG_ON((fh->resources & bits) != bits);
204 dprintk(1, "%s()\n", __func__); 182 dprintk(1, "%s()\n", __func__);
205 183
206 mutex_lock(&dev->lock);
207 fh->resources &= ~bits; 184 fh->resources &= ~bits;
208 dev->channels[fh->channel_id].resources &= ~bits; 185 dev->channels[fh->channel_id].resources &= ~bits;
209 dprintk(1, "res: put %d\n", bits); 186 dprintk(1, "res: put %d\n", bits);
210 mutex_unlock(&dev->lock);
211} 187}
212 188
213static int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input) 189static int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input)
@@ -669,7 +645,7 @@ static int video_open(struct file *file)
669 videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops, &dev->pci->dev, 645 videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops, &dev->pci->dev,
670 &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, 646 &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
671 V4L2_FIELD_INTERLACED, sizeof(struct cx25821_buffer), 647 V4L2_FIELD_INTERLACED, sizeof(struct cx25821_buffer),
672 fh, NULL); 648 fh, &dev->lock);
673 649
674 dprintk(1, "post videobuf_queue_init()\n"); 650 dprintk(1, "post videobuf_queue_init()\n");
675 651
@@ -680,19 +656,25 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
680 loff_t *ppos) 656 loff_t *ppos)
681{ 657{
682 struct cx25821_fh *fh = file->private_data; 658 struct cx25821_fh *fh = file->private_data;
659 struct cx25821_dev *dev = fh->dev;
660 int err;
683 661
684 switch (fh->type) { 662 switch (fh->type) {
685 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 663 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
664 if (mutex_lock_interruptible(&dev->lock))
665 return -ERESTARTSYS;
686 if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) 666 if (cx25821_res_locked(fh, RESOURCE_VIDEO0))
687 return -EBUSY; 667 err = -EBUSY;
688 668 else
689 return videobuf_read_one(&fh->vidq, data, count, ppos, 669 err = videobuf_read_one(&fh->vidq, data, count, ppos,
690 file->f_flags & O_NONBLOCK); 670 file->f_flags & O_NONBLOCK);
671 mutex_unlock(&dev->lock);
672 return err;
691 673
692 default: 674 default:
693 BUG(); 675 return -ENODEV;
694 return 0;
695 } 676 }
677
696} 678}
697 679
698static unsigned int video_poll(struct file *file, 680static unsigned int video_poll(struct file *file,
@@ -742,6 +724,7 @@ static int video_release(struct file *file)
742 const struct sram_channel *sram_ch = 724 const struct sram_channel *sram_ch =
743 dev->channels[0].sram_channels; 725 dev->channels[0].sram_channels;
744 726
727 mutex_lock(&dev->lock);
745 /* stop the risc engine and fifo */ 728 /* stop the risc engine and fifo */
746 cx_write(sram_ch->dma_ctl, 0); /* FIFO and RISC disable */ 729 cx_write(sram_ch->dma_ctl, 0); /* FIFO and RISC disable */
747 730
@@ -750,6 +733,7 @@ static int video_release(struct file *file)
750 videobuf_queue_cancel(&fh->vidq); 733 videobuf_queue_cancel(&fh->vidq);
751 cx25821_res_free(dev, fh, RESOURCE_VIDEO0); 734 cx25821_res_free(dev, fh, RESOURCE_VIDEO0);
752 } 735 }
736 mutex_unlock(&dev->lock);
753 737
754 if (fh->vidq.read_buf) { 738 if (fh->vidq.read_buf) {
755 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); 739 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
@@ -1083,9 +1067,7 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
1083 if (dev->tvnorm == tvnorms) 1067 if (dev->tvnorm == tvnorms)
1084 return 0; 1068 return 0;
1085 1069
1086 mutex_lock(&dev->lock);
1087 cx25821_set_tvnorm(dev, tvnorms); 1070 cx25821_set_tvnorm(dev, tvnorms);
1088 mutex_unlock(&dev->lock);
1089 1071
1090 medusa_set_videostandard(dev); 1072 medusa_set_videostandard(dev);
1091 1073
@@ -1141,9 +1123,7 @@ static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
1141 if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0) 1123 if (i >= CX25821_NR_INPUT || INPUT(i)->type == 0)
1142 return -EINVAL; 1124 return -EINVAL;
1143 1125
1144 mutex_lock(&dev->lock);
1145 cx25821_video_mux(dev, i); 1126 cx25821_video_mux(dev, i);
1146 mutex_unlock(&dev->lock);
1147 return 0; 1127 return 0;
1148} 1128}
1149 1129
@@ -1465,7 +1445,7 @@ static const struct v4l2_file_operations video_fops = {
1465 .read = video_read, 1445 .read = video_read,
1466 .poll = video_poll, 1446 .poll = video_poll,
1467 .mmap = cx25821_video_mmap, 1447 .mmap = cx25821_video_mmap,
1468 .ioctl = cx25821_video_ioctl, 1448 .unlocked_ioctl = cx25821_video_ioctl,
1469}; 1449};
1470 1450
1471static const struct v4l2_ioctl_ops video_ioctl_ops = { 1451static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1521,6 +1501,10 @@ int cx25821_video_register(struct cx25821_dev *dev)
1521 int err; 1501 int err;
1522 int i; 1502 int i;
1523 1503
1504 /* initial device configuration */
1505 dev->tvnorm = V4L2_STD_NTSC_M,
1506 cx25821_set_tvnorm(dev, dev->tvnorm);
1507
1524 spin_lock_init(&dev->slock); 1508 spin_lock_init(&dev->slock);
1525 1509
1526 for (i = 0; i < VID_CHANNEL_NUM; ++i) { 1510 for (i = 0; i < VID_CHANNEL_NUM; ++i) {
@@ -1543,6 +1527,9 @@ int cx25821_video_register(struct cx25821_dev *dev)
1543 err = hdl->error; 1527 err = hdl->error;
1544 goto fail_unreg; 1528 goto fail_unreg;
1545 } 1529 }
1530 err = v4l2_ctrl_handler_setup(hdl);
1531 if (err)
1532 goto fail_unreg;
1546 1533
1547 cx25821_risc_stopper(dev->pci, &dev->channels[i].vidq.stopper, 1534 cx25821_risc_stopper(dev->pci, &dev->channels[i].vidq.stopper,
1548 dev->channels[i].sram_channels->dma_ctl, 0x11, 0); 1535 dev->channels[i].sram_channels->dma_ctl, 0x11, 0);
@@ -1567,6 +1554,7 @@ int cx25821_video_register(struct cx25821_dev *dev)
1567 *vdev = cx25821_video_device; 1554 *vdev = cx25821_video_device;
1568 vdev->v4l2_dev = &dev->v4l2_dev; 1555 vdev->v4l2_dev = &dev->v4l2_dev;
1569 vdev->ctrl_handler = hdl; 1556 vdev->ctrl_handler = hdl;
1557 vdev->lock = &dev->lock;
1570 snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i); 1558 snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i);
1571 video_set_drvdata(vdev, dev); 1559 video_set_drvdata(vdev, dev);
1572 1560
@@ -1580,12 +1568,6 @@ int cx25821_video_register(struct cx25821_dev *dev)
1580 /* set PCI interrupt */ 1568 /* set PCI interrupt */
1581 cx_set(PCI_INT_MSK, 0xff); 1569 cx_set(PCI_INT_MSK, 0xff);
1582 1570
1583 /* initial device configuration */
1584 mutex_lock(&dev->lock);
1585 dev->tvnorm = V4L2_STD_NTSC_M,
1586 cx25821_set_tvnorm(dev, dev->tvnorm);
1587 mutex_unlock(&dev->lock);
1588
1589 return 0; 1571 return 0;
1590 1572
1591fail_unreg: 1573fail_unreg:
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h
index 9d70020d9256..b0f0d5395490 100644
--- a/drivers/media/pci/cx25821/cx25821-video.h
+++ b/drivers/media/pci/cx25821/cx25821-video.h
@@ -67,12 +67,6 @@ do { \
67extern void cx25821_video_wakeup(struct cx25821_dev *dev, 67extern void cx25821_video_wakeup(struct cx25821_dev *dev,
68 struct cx25821_dmaqueue *q, u32 count); 68 struct cx25821_dmaqueue *q, u32 count);
69 69
70extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
71 unsigned int bit);
72extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
73extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit);
74extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
75 unsigned int bits);
76extern int cx25821_start_video_dma(struct cx25821_dev *dev, 70extern int cx25821_start_video_dma(struct cx25821_dev *dev,
77 struct cx25821_dmaqueue *q, 71 struct cx25821_dmaqueue *q,
78 struct cx25821_buffer *buf, 72 struct cx25821_buffer *buf,
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index 95dbf70d8667..ad56232154e6 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -222,7 +222,6 @@ struct cx25821_channel {
222 222
223 const struct sram_channel *sram_channels; 223 const struct sram_channel *sram_channels;
224 224
225 struct mutex lock;
226 int resources; 225 int resources;
227 226
228 int pixel_formats; 227 int pixel_formats;