aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 07:18:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:03:49 -0400
commit467870ca26c01cb0ac84e969a78160f8164919cc (patch)
tree98fbc5ec70205daa6016090dcd18616d472de719 /drivers/media
parent89c21389f2a48afb2fb24fdf74433950cb9b19a2 (diff)
[media] cx25821: embed video_device, clean up some kernel log spam
Embed the video_device struct instead of allocating it. Remove some of the annoying and ugly kernel messages shown during loading and unloading of the module. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/cx25821/cx25821-core.c15
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c54
-rw-r--r--drivers/media/pci/cx25821/cx25821.h2
3 files changed, 16 insertions, 55 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 82c2db0944e3..f3a48a17c4c3 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -845,8 +845,7 @@ static void cx25821_dev_checkrevision(struct cx25821_dev *dev)
845{ 845{
846 dev->hwrevision = cx_read(RDR_CFG2) & 0xff; 846 dev->hwrevision = cx_read(RDR_CFG2) & 0xff;
847 847
848 pr_info("%s(): Hardware revision = 0x%02x\n", 848 pr_info("Hardware revision = 0x%02x\n", dev->hwrevision);
849 __func__, dev->hwrevision);
850} 849}
851 850
852static void cx25821_iounmap(struct cx25821_dev *dev) 851static void cx25821_iounmap(struct cx25821_dev *dev)
@@ -856,7 +855,6 @@ static void cx25821_iounmap(struct cx25821_dev *dev)
856 855
857 /* Releasing IO memory */ 856 /* Releasing IO memory */
858 if (dev->lmmio != NULL) { 857 if (dev->lmmio != NULL) {
859 CX25821_INFO("Releasing lmmio.\n");
860 iounmap(dev->lmmio); 858 iounmap(dev->lmmio);
861 dev->lmmio = NULL; 859 dev->lmmio = NULL;
862 } 860 }
@@ -867,10 +865,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
867 static unsigned int cx25821_devcount; 865 static unsigned int cx25821_devcount;
868 int i; 866 int i;
869 867
870 pr_info("\n***********************************\n");
871 pr_info("cx25821 set up\n");
872 pr_info("***********************************\n\n");
873
874 mutex_init(&dev->lock); 868 mutex_init(&dev->lock);
875 869
876 dev->nr = ++cx25821_devcount; 870 dev->nr = ++cx25821_devcount;
@@ -950,17 +944,12 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
950/* cx25821_i2c_register(&dev->i2c_bus[1]); 944/* cx25821_i2c_register(&dev->i2c_bus[1]);
951 * cx25821_i2c_register(&dev->i2c_bus[2]); */ 945 * cx25821_i2c_register(&dev->i2c_bus[2]); */
952 946
953 CX25821_INFO("i2c register! bus->i2c_rc = %d\n",
954 dev->i2c_bus[0].i2c_rc);
955
956 if (medusa_video_init(dev) < 0) 947 if (medusa_video_init(dev) < 0)
957 CX25821_ERR("%s(): Failed to initialize medusa!\n", __func__); 948 CX25821_ERR("%s(): Failed to initialize medusa!\n", __func__);
958 949
959 cx25821_video_register(dev); 950 cx25821_video_register(dev);
960 951
961 cx25821_dev_checkrevision(dev); 952 cx25821_dev_checkrevision(dev);
962 CX25821_INFO("setup done!\n");
963
964 return 0; 953 return 0;
965} 954}
966 955
@@ -1337,8 +1326,6 @@ static int cx25821_initdev(struct pci_dev *pci_dev,
1337 goto fail_unregister_device; 1326 goto fail_unregister_device;
1338 } 1327 }
1339 1328
1340 pr_info("Athena pci enable !\n");
1341
1342 err = cx25821_dev_setup(dev); 1329 err = cx25821_dev_setup(dev);
1343 if (err) { 1330 if (err) {
1344 if (err == -EBUSY) 1331 if (err == -EBUSY)
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index 9919a0e93f4d..41e3475efec3 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -144,26 +144,6 @@ static int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
144 return 0; 144 return 0;
145} 145}
146 146
147static struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
148 struct pci_dev *pci,
149 const struct video_device *template,
150 char *type)
151{
152 struct video_device *vfd;
153 dprintk(1, "%s()\n", __func__);
154
155 vfd = video_device_alloc();
156 if (NULL == vfd)
157 return NULL;
158 *vfd = *template;
159 vfd->v4l2_dev = &dev->v4l2_dev;
160 vfd->release = video_device_release;
161 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type,
162 cx25821_boards[dev->board].name);
163 video_set_drvdata(vfd, dev);
164 return vfd;
165}
166
167/* 147/*
168static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl) 148static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl)
169{ 149{
@@ -657,7 +637,7 @@ static int video_open(struct file *file)
657 v4l2_type_names[type]); 637 v4l2_type_names[type]);
658 638
659 for (ch_id = 0; ch_id < MAX_VID_CHANNEL_NUM - 1; ch_id++) 639 for (ch_id = 0; ch_id < MAX_VID_CHANNEL_NUM - 1; ch_id++)
660 if (dev->channels[ch_id].video_dev == vdev) 640 if (&dev->channels[ch_id].vdev == vdev)
661 break; 641 break;
662 642
663 /* Can't happen */ 643 /* Can't happen */
@@ -1692,6 +1672,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1692static const struct video_device cx25821_video_device = { 1672static const struct video_device cx25821_video_device = {
1693 .name = "cx25821-video", 1673 .name = "cx25821-video",
1694 .fops = &video_fops, 1674 .fops = &video_fops,
1675 .release = video_device_release_empty,
1695 .minor = -1, 1676 .minor = -1,
1696 .ioctl_ops = &video_ioctl_ops, 1677 .ioctl_ops = &video_ioctl_ops,
1697 .tvnorms = CX25821_NORMS, 1678 .tvnorms = CX25821_NORMS,
@@ -1701,22 +1682,12 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
1701{ 1682{
1702 cx_clear(PCI_INT_MSK, 1); 1683 cx_clear(PCI_INT_MSK, 1);
1703 1684
1704 if (dev->channels[chan_num].video_dev) { 1685 if (video_is_registered(&dev->channels[chan_num].vdev)) {
1705 if (video_is_registered(dev->channels[chan_num].video_dev)) 1686 video_unregister_device(&dev->channels[chan_num].vdev);
1706 video_unregister_device(
1707 dev->channels[chan_num].video_dev);
1708 else
1709 video_device_release(
1710 dev->channels[chan_num].video_dev);
1711
1712 dev->channels[chan_num].video_dev = NULL;
1713 1687
1714 btcx_riscmem_free(dev->pci, 1688 btcx_riscmem_free(dev->pci,
1715 &dev->channels[chan_num].vidq.stopper); 1689 &dev->channels[chan_num].vidq.stopper);
1716
1717 pr_warn("device %d released!\n", chan_num);
1718 } 1690 }
1719
1720} 1691}
1721 1692
1722int cx25821_video_register(struct cx25821_dev *dev) 1693int cx25821_video_register(struct cx25821_dev *dev)
@@ -1727,6 +1698,8 @@ int cx25821_video_register(struct cx25821_dev *dev)
1727 spin_lock_init(&dev->slock); 1698 spin_lock_init(&dev->slock);
1728 1699
1729 for (i = 0; i < VID_CHANNEL_NUM; ++i) { 1700 for (i = 0; i < VID_CHANNEL_NUM; ++i) {
1701 struct video_device *vdev = &dev->channels[i].vdev;
1702
1730 if (i == SRAM_CH08) /* audio channel */ 1703 if (i == SRAM_CH08) /* audio channel */
1731 continue; 1704 continue;
1732 1705
@@ -1736,7 +1709,6 @@ int cx25821_video_register(struct cx25821_dev *dev)
1736 dev->channels[i].sram_channels->dma_ctl, 0x11, 0); 1709 dev->channels[i].sram_channels->dma_ctl, 0x11, 0);
1737 1710
1738 dev->channels[i].sram_channels = &cx25821_sram_channels[i]; 1711 dev->channels[i].sram_channels = &cx25821_sram_channels[i];
1739 dev->channels[i].video_dev = NULL;
1740 dev->channels[i].resources = 0; 1712 dev->channels[i].resources = 0;
1741 1713
1742 cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff); 1714 cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff);
@@ -1753,15 +1725,16 @@ int cx25821_video_register(struct cx25821_dev *dev)
1753 init_timer(&dev->channels[i].vidq.timeout); 1725 init_timer(&dev->channels[i].vidq.timeout);
1754 1726
1755 /* register v4l devices */ 1727 /* register v4l devices */
1756 dev->channels[i].video_dev = cx25821_vdev_init(dev, dev->pci, 1728 *vdev = cx25821_video_device;
1757 &cx25821_video_device, "video"); 1729 vdev->v4l2_dev = &dev->v4l2_dev;
1730 snprintf(vdev->name, sizeof(vdev->name), "%s #%d", dev->name, i);
1731 video_set_drvdata(vdev, dev);
1758 1732
1759 err = video_register_device(dev->channels[i].video_dev, 1733 err = video_register_device(vdev, VFL_TYPE_GRABBER,
1760 VFL_TYPE_GRABBER, video_nr[dev->nr]); 1734 video_nr[dev->nr]);
1761 1735
1762 if (err < 0) 1736 if (err < 0)
1763 goto fail_unreg; 1737 goto fail_unreg;
1764
1765 } 1738 }
1766 1739
1767 /* set PCI interrupt */ 1740 /* set PCI interrupt */
@@ -1776,6 +1749,7 @@ int cx25821_video_register(struct cx25821_dev *dev)
1776 return 0; 1749 return 0;
1777 1750
1778fail_unreg: 1751fail_unreg:
1779 cx25821_video_unregister(dev, i); 1752 while (i >= 0)
1753 cx25821_video_unregister(dev, i--);
1780 return err; 1754 return err;
1781} 1755}
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index 61c6cfc02d8c..df2ea22563e5 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -217,7 +217,7 @@ struct cx25821_channel {
217 int ctl_saturation; 217 int ctl_saturation;
218 struct cx25821_data timeout_data; 218 struct cx25821_data timeout_data;
219 219
220 struct video_device *video_dev; 220 struct video_device vdev;
221 struct cx25821_dmaqueue vidq; 221 struct cx25821_dmaqueue vidq;
222 222
223 const struct sram_channel *sram_channels; 223 const struct sram_channel *sram_channels;