[media] saa7164: code cleanup
authorSteven Toth <stoth@kernellabs.com>
Sat, 31 Jul 2010 18:55:22 +0000 (15:55 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 09:55:00 +0000 (07:55 -0200)
Removed some previous debugging code, whitespace cleanup and
spurious comments.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7164/saa7164-buffer.c
drivers/media/video/saa7164/saa7164-core.c
drivers/media/video/saa7164/saa7164-encoder.c
drivers/media/video/saa7164/saa7164.h

index c7bd81e248f6297dbbf5d3f130a8dc880ea53d71..5f45ea7f3d7cd2a4ad4e95878a22eb366729640f 100644 (file)
@@ -241,7 +241,6 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port)
 
        dprintk(DBGLVL_BUF, "%s(port=%d)\n", __func__, port->nr);
 
-       port->counter = 0;
        saa7164_writel(port->bufcounter, 0);
        saa7164_writel(port->pitch, params->pitch);
        saa7164_writel(port->bufsize, params->pitch * params->numberoflines);
index eb9c3459bb10fefe80afab294494ea7558c5a97e..b54b032d56b695a23c5f43c05e0321986dffb019 100644 (file)
@@ -363,10 +363,6 @@ static void saa7164_work_enchandler(struct work_struct *w)
                        printk(KERN_ERR "%s() illegal rp count %d\n", __func__, rp);
                        break;
                }
-
-               /* Process a buffer */
-               if (port->nr == SAA7164_PORT_ENC1)
-                       printk(KERN_ERR "Port enc1 processing buffer %d\n", rp);
                saa7164_work_enchandler_helper(port, rp);
                port->last_svc_rp = rp;
                cnt++;
@@ -375,15 +371,13 @@ static void saa7164_work_enchandler(struct work_struct *w)
                        break;
        }
 
-       if (port->nr == SAA7164_PORT_ENC1)
-               printk(KERN_ERR "Enc1 processed %d buffers for port %p\n", cnt, port);
-
        if (print_histogram == port->nr) {
                saa7164_histogram_print(port, &port->irq_interval);
                saa7164_histogram_print(port, &port->svc_interval);
                saa7164_histogram_print(port, &port->irq_svc_interval);
                saa7164_histogram_print(port, &port->read_interval);
                saa7164_histogram_print(port, &port->poll_interval);
+               /* TODO: fix this to preserve any previous state */
                print_histogram = 64 + port->nr;
        }
 }
@@ -766,7 +760,6 @@ static int get_resources(struct saa7164_dev *dev)
 static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
 {
        struct saa7164_port *port = 0;
-       int i;
 
        if ((portnr < 0) || (portnr >= SAA7164_MAX_PORTS))
                BUG();
@@ -805,18 +798,6 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
        saa7164_histogram_reset(&port->poll_interval,
                "encoder poll() intervals");
 
-       if (port->type == SAA7164_MPEG_ENCODER) {
-               for (i = 0; i < 8; i ++) {
-                       port->shadow_buf[i] = kzalloc(256 * 128, GFP_KERNEL);
-                       if (port->shadow_buf[i] == 0)
-                               printk(KERN_ERR "%s() shadow_buf ENOMEM\n", __func__);
-                       else {
-                               memset(port->shadow_buf[i], 0xff, 256 * 128);
-                               port->shadow_crc[i] = crc32(0, port->shadow_buf[i], 256 * 128);
-                       }
-               }
-       }
-
        return 0;
 }
 
@@ -1094,8 +1075,6 @@ static void saa7164_shutdown(struct saa7164_dev *dev)
 static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
 {
        struct saa7164_dev *dev = pci_get_drvdata(pci_dev);
-       struct saa7164_port *port;
-       int i;
 
        saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
                &dev->ports[ SAA7164_PORT_ENC1 ].irq_interval);
@@ -1110,22 +1089,6 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
 
        saa7164_shutdown(dev);
 
-       port = &dev->ports[ SAA7164_PORT_ENC1 ];
-       if (port->type == SAA7164_MPEG_ENCODER) {
-               for (i = 0; i < 8; i ++) {
-                       kfree(port->shadow_buf[i]);
-                       port->shadow_buf[i] = 0;
-               }
-       }
-       port = &dev->ports[ SAA7164_PORT_ENC2 ];
-       if (port->type == SAA7164_MPEG_ENCODER) {
-               for (i = 0; i < 8; i ++) {
-                       kfree(port->shadow_buf[i]);
-                       port->shadow_buf[i] = 0;
-               }
-       }
-
-
        if (saa7164_boards[dev->board].porta == SAA7164_MPEG_DVB)
                saa7164_dvb_unregister(&dev->ports[ SAA7164_PORT_TS1 ]);
 
index b904c61f8f81d3f0497b08036b5ac288dbf3a7ce..08b62e41c466690a91c5ffe139feb1e2bfeacea0 100644 (file)
@@ -1008,7 +1008,6 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
        struct saa7164_user_buffer *buf = 0;
        struct saa7164_dev *dev = port->dev;
        u32 crc;
-       u32 *d;
 
        mutex_lock(&port->dmaqueue_lock);
        if (!list_empty(&port->list_buf_used.list)) {
@@ -1021,13 +1020,6 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
                                buf, buf->crc, crc);
                }
 
-               d = (u32 *)buf->data;
-
-               if ((*d & 0xffffff) > (port->read_counter + 0x2000))
-                       printk(KERN_ERR "%s() *d 0x%x port %p\n", __func__, *d, port);
-
-               port->read_counter = *d;
-
        }
        mutex_unlock(&port->dmaqueue_lock);
 
index 9c76e65b978580142abc8f3b5c420666d496bb1f..71e385328ce30aec052442dbf80b7512f57a9de0 100644 (file)
@@ -378,8 +378,6 @@ struct saa7164_port {
        struct saa7164_encoder_params encoder_params;
        struct video_device *v4l_device;
        atomic_t v4l_reader_count;
-//     spinlock_t slock;
-//     struct mutex fops_lock;
 
        struct saa7164_buffer list_buf_used;
        struct saa7164_buffer list_buf_free;
@@ -391,12 +389,6 @@ struct saa7164_port {
        u32 a_cc_errors;
        u8 last_v_cc;
        u8 last_a_cc;
-
-       u8 *shadow_buf[8];
-       u32 shadow_crc[8];
-
-       u32 counter;
-       u32 read_counter;
 };
 
 struct saa7164_dev {