{
        struct cx25821_audio_buffer *buf = chip->buf;
        struct cx25821_dev *dev = chip->dev;
-       struct sram_channel *audio_ch =
+       const struct sram_channel *audio_ch =
            &cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
        u32 tmp = 0;
 
 
                        FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR;
 
 static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
-                                             struct sram_channel *ch,
+                                             const struct sram_channel *ch,
                                              unsigned int bpl, u32 risc)
 {
        unsigned int i, lines;
                                                 int fifo_enable)
 {
        unsigned int line;
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[dev->_audio_upstream_channel].sram_channels;
        int offset = 0;
 
 
 void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
 {
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
        u32 tmp = 0;
 
 }
 
 static int cx25821_get_audio_data(struct cx25821_dev *dev,
-                          struct sram_channel *sram_ch)
+                          const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int frame_index_temp = dev->_audioframe_index;
 }
 
 static int cx25821_openfile_audio(struct cx25821_dev *dev,
-                          struct sram_channel *sram_ch)
+                          const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int i = 0, j = 0;
 }
 
 static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
-                                                struct sram_channel *sram_ch,
+                                                const struct sram_channel *sram_ch,
                                                 int bpl)
 {
        int ret = 0;
 {
        int i = 0;
        u32 int_msk_tmp;
-       struct sram_channel *channel = dev->channels[chan_num].sram_channels;
+       const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
        dma_addr_t risc_phys_jump_addr;
        __le32 *rp;
 
        struct cx25821_dev *dev = dev_id;
        u32 audio_status;
        int handled = 0;
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
 
        if (!dev)
                return -1;
 }
 
 static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
-                                    struct sram_channel *sram_ch)
+                                    const struct sram_channel *sram_ch)
 {
        int count = 0;
        u32 tmp;
 }
 
 static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
-                                           struct sram_channel *sram_ch)
+                                           const struct sram_channel *sram_ch)
 {
        u32 tmp = 0;
        int err = 0;
 
 int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
 {
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
        int err = 0;
 
        if (dev->_audio_is_running) {
 
 LIST_HEAD(cx25821_devlist);
 EXPORT_SYMBOL(cx25821_devlist);
 
-struct sram_channel cx25821_sram_channels[] = {
+const struct sram_channel cx25821_sram_channels[] = {
        [SRAM_CH00] = {
                .i = SRAM_CH00,
                .name = "VID A",
 };
 EXPORT_SYMBOL(cx25821_sram_channels);
 
-struct sram_channel *channel0 = &cx25821_sram_channels[SRAM_CH00];
-struct sram_channel *channel1 = &cx25821_sram_channels[SRAM_CH01];
-struct sram_channel *channel2 = &cx25821_sram_channels[SRAM_CH02];
-struct sram_channel *channel3 = &cx25821_sram_channels[SRAM_CH03];
-struct sram_channel *channel4 = &cx25821_sram_channels[SRAM_CH04];
-struct sram_channel *channel5 = &cx25821_sram_channels[SRAM_CH05];
-struct sram_channel *channel6 = &cx25821_sram_channels[SRAM_CH06];
-struct sram_channel *channel7 = &cx25821_sram_channels[SRAM_CH07];
-struct sram_channel *channel9 = &cx25821_sram_channels[SRAM_CH09];
-struct sram_channel *channel10 = &cx25821_sram_channels[SRAM_CH10];
-struct sram_channel *channel11 = &cx25821_sram_channels[SRAM_CH11];
-
-struct cx25821_dmaqueue mpegq;
-
 static int cx25821_risc_decode(u32 risc)
 {
        static const char * const instr[16] = {
 }
 
 int cx25821_sram_channel_setup(struct cx25821_dev *dev,
-                              struct sram_channel *ch,
+                              const struct sram_channel *ch,
                               unsigned int bpl, u32 risc)
 {
        unsigned int i, lines;
 
        return 0;
 }
-EXPORT_SYMBOL(cx25821_sram_channel_setup);
 
 int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev,
-                                    struct sram_channel *ch,
+                                    const struct sram_channel *ch,
                                     unsigned int bpl, u32 risc)
 {
        unsigned int i, lines;
 }
 EXPORT_SYMBOL(cx25821_sram_channel_setup_audio);
 
-void cx25821_sram_channel_dump(struct cx25821_dev *dev, struct sram_channel *ch)
+void cx25821_sram_channel_dump(struct cx25821_dev *dev, const struct sram_channel *ch)
 {
        static char *name[] = {
                "init risc lo",
        pr_warn("        :   cnt2_reg: 0x%08x\n",
                cx_read(ch->cnt2_reg));
 }
-EXPORT_SYMBOL(cx25821_sram_channel_dump);
 
 void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev,
-                                    struct sram_channel *ch)
+                                    const struct sram_channel *ch)
 {
        static const char * const name[] = {
                "init risc lo",
 }
 
 static void cx25821_set_vip_mode(struct cx25821_dev *dev,
-                                struct sram_channel *ch)
+                                const struct sram_channel *ch)
 {
        cx_write(ch->pix_frmt, PIXEL_FRMT_422);
        cx_write(ch->vip_ctl, PIXEL_ENGINE_VIP1);
 
                                               int fifo_enable, int field_type)
 {
        unsigned int line, i;
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[dev->_channel2_upstream_select].sram_channels;
        int dist_betwn_starts = bpl * 2;
 
 
 void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev)
 {
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[VID_UPSTREAM_SRAM_CHANNEL_J].sram_channels;
        u32 tmp = 0;
 
 }
 
 static int cx25821_get_frame_ch2(struct cx25821_dev *dev,
-                                struct sram_channel *sram_ch)
+                                const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int frame_index_temp = dev->_frame_index_ch2;
 }
 
 static int cx25821_openfile_ch2(struct cx25821_dev *dev,
-                               struct sram_channel *sram_ch)
+                               const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int i = 0, j = 0;
 }
 
 static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev,
-                                              struct sram_channel *sram_ch,
+                                              const struct sram_channel *sram_ch,
                                               int bpl)
 {
        int ret = 0;
                                          u32 status)
 {
        u32 int_msk_tmp;
-       struct sram_channel *channel = dev->channels[chan_num].sram_channels;
+       const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
        int singlefield_lines = NTSC_FIELD_HEIGHT;
        int line_size_in_bytes = Y422_LINE_SZ;
        int odd_risc_prog_size = 0;
        u32 vid_status;
        int handled = 0;
        int channel_num = 0;
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
 
        if (!dev)
                return -1;
 }
 
 static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev,
-                                       struct sram_channel *ch, int pix_format)
+                                       const struct sram_channel *ch, int pix_format)
 {
        int width = WIDTH_D1;
        int height = dev->_lines_count_ch2;
 }
 
 static int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev,
-                                               struct sram_channel *sram_ch)
+                                               const struct sram_channel *sram_ch)
 {
        u32 tmp = 0;
        int err = 0;
 int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
                                 int pixel_format)
 {
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
        u32 tmp;
        int err = 0;
        int data_frame_size = 0;
 
                        FLD_VID_SRC_OPC_ERR;
 
 int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev,
-                                       struct sram_channel *ch,
+                                       const struct sram_channel *ch,
                                        unsigned int bpl, u32 risc)
 {
        unsigned int i, lines;
                                           int fifo_enable, int field_type)
 {
        unsigned int line, i;
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[dev->_channel_upstream_select].sram_channels;
        int dist_betwn_starts = bpl * 2;
 
 
 void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
 {
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels;
        u32 tmp = 0;
 
 }
 
 static int cx25821_get_frame(struct cx25821_dev *dev,
-                            struct sram_channel *sram_ch)
+                            const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int frame_index_temp = dev->_frame_index;
 }
 
 static int cx25821_openfile(struct cx25821_dev *dev,
-                           struct sram_channel *sram_ch)
+                           const struct sram_channel *sram_ch)
 {
        struct file *myfile;
        int i = 0, j = 0;
 }
 
 static int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
-                                          struct sram_channel *sram_ch,
+                                          const struct sram_channel *sram_ch,
                                           int bpl)
 {
        int ret = 0;
                                      u32 status)
 {
        u32 int_msk_tmp;
-       struct sram_channel *channel = dev->channels[chan_num].sram_channels;
+       const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
        int singlefield_lines = NTSC_FIELD_HEIGHT;
        int line_size_in_bytes = Y422_LINE_SZ;
        int odd_risc_prog_size = 0;
        u32 vid_status;
        int handled = 0;
        int channel_num = 0;
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
 
        if (!dev)
                return -1;
 }
 
 static void cx25821_set_pixelengine(struct cx25821_dev *dev,
-                                   struct sram_channel *ch,
+                                   const struct sram_channel *ch,
                                    int pix_format)
 {
        int width = WIDTH_D1;
 }
 
 static int cx25821_start_video_dma_upstream(struct cx25821_dev *dev,
-                                           struct sram_channel *sram_ch)
+                                           const struct sram_channel *sram_ch)
 {
        u32 tmp = 0;
        int err = 0;
 int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
                                 int pixel_format)
 {
-       struct sram_channel *sram_ch;
+       const struct sram_channel *sram_ch;
        u32 tmp;
        int err = 0;
        int data_frame_size = 0;
 
 int cx25821_start_video_dma(struct cx25821_dev *dev,
                            struct cx25821_dmaqueue *q,
                            struct cx25821_buffer *buf,
-                           struct sram_channel *channel)
+                           const struct sram_channel *channel)
 {
        int tmp = 0;
 
 
 static int cx25821_restart_video_queue(struct cx25821_dev *dev,
                                       struct cx25821_dmaqueue *q,
-                                      struct sram_channel *channel)
+                                      const struct sram_channel *channel)
 {
        struct cx25821_buffer *buf, *prev;
        struct list_head *item;
 {
        struct cx25821_data *timeout_data = (struct cx25821_data *)data;
        struct cx25821_dev *dev = timeout_data->dev;
-       struct sram_channel *channel = timeout_data->channel;
+       const struct sram_channel *channel = timeout_data->channel;
        struct cx25821_dmaqueue *q = &dev->channels[channel->i].vidq;
        struct cx25821_buffer *buf;
        unsigned long flags;
        u32 count = 0;
        int handled = 0;
        u32 mask;
-       struct sram_channel *channel = dev->channels[chan_num].sram_channels;
+       const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
 
        mask = cx_read(channel->int_msk);
        if (0 == (status & mask))
 {
        struct cx25821_fh *fh = file->private_data;
        struct cx25821_dev *dev = fh->dev;
+       const struct sram_channel *sram_ch =
+               dev->channels[0].sram_channels;
 
        /* stop the risc engine and fifo */
-       cx_write(channel0->dma_ctl, 0); /* FIFO and RISC disable */
+       cx_write(sram_ch->dma_ctl, 0); /* FIFO and RISC disable */
 
        /* stop video capture */
        if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
 {
        struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
        struct cx25821_fh *fh = priv;
-       struct sram_channel *sram_ch =
+       const struct sram_channel *sram_ch =
                dev->channels[fh->channel_id].sram_channels;
        u32 tmp = 0;
 
 
 #define MEDUSA_READ                910
 #define MEDUSA_WRITE               911
 
-extern struct sram_channel *channel0;
-extern struct sram_channel *channel1;
-extern struct sram_channel *channel2;
-extern struct sram_channel *channel3;
-extern struct sram_channel *channel4;
-extern struct sram_channel *channel5;
-extern struct sram_channel *channel6;
-extern struct sram_channel *channel7;
-extern struct sram_channel *channel9;
-extern struct sram_channel *channel10;
-extern struct sram_channel *channel11;
-/* extern const u32 *ctrl_classes[]; */
-
 extern unsigned int vid_limit;
 
 #define FORMAT_FLAGS_PACKED       0x01
 extern int cx25821_start_video_dma(struct cx25821_dev *dev,
                                   struct cx25821_dmaqueue *q,
                                   struct cx25821_buffer *buf,
-                                  struct sram_channel *channel);
+                                  const struct sram_channel *channel);
 
 extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
                             unsigned int height, enum v4l2_field field);
 
 
        enum v4l2_priority prio;
 
-       /* video overlay */
-       struct v4l2_window win;
-       struct v4l2_clip *clips;
-       unsigned int nclips;
-
        /* video capture */
        struct cx25821_fmt *fmt;
        unsigned int width, height;
        int channel_id;
        struct videobuf_queue vidq;
-
-       /* H264 Encoder specifics ONLY */
-       struct videobuf_queue mpegq;
-       atomic_t v4l_reading;
 };
 
 enum cx25821_itype {
 
 struct cx25821_data {
        struct cx25821_dev *dev;
-       struct sram_channel *channel;
+       const struct sram_channel *channel;
 };
 
 struct cx25821_channel {
        struct video_device *video_dev;
        struct cx25821_dmaqueue vidq;
 
-       struct sram_channel *sram_channels;
+       const struct sram_channel *sram_channels;
 
        struct mutex lock;
        int resources;
        u32 jumponly;
        u32 irq_bit;
 };
-extern struct sram_channel cx25821_sram_channels[];
+
+extern const struct sram_channel cx25821_sram_channels[];
 
 #define STATUS_SUCCESS         0
 #define STATUS_UNSUCCESSFUL    -1
                                 int decoder);
 
 extern int cx25821_sram_channel_setup(struct cx25821_dev *dev,
-                                     struct sram_channel *ch, unsigned int bpl,
+                                     const struct sram_channel *ch, unsigned int bpl,
                                      u32 risc);
 
 extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
 extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
                                u32 reg, u32 mask, u32 value);
 extern void cx25821_sram_channel_dump(struct cx25821_dev *dev,
-                                     struct sram_channel *ch);
+                                     const struct sram_channel *ch);
 extern void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev,
-                                           struct sram_channel *ch);
+                                           const struct sram_channel *ch);
 
 extern struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci);
 extern void cx25821_print_irqbits(char *name, char *tag, char **strings,
                                  int len, u32 bits, u32 mask);
 extern void cx25821_dev_unregister(struct cx25821_dev *dev);
 extern int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev,
-                                           struct sram_channel *ch,
+                                           const struct sram_channel *ch,
                                            unsigned int bpl, u32 risc);
 
 extern int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev,
 extern void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev);
 extern void cx25821_stop_upstream_audio(struct cx25821_dev *dev);
 extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev,
-                                              struct sram_channel *ch,
+                                              const struct sram_channel *ch,
                                               unsigned int bpl, u32 risc);
 extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel,
                                     u32 format);