Remove async->data_len globally
authorDavid Schleef <ds@schleef.org>
Thu, 25 Jul 2002 23:45:33 +0000 (23:45 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 25 Jul 2002 23:45:33 +0000 (23:45 +0000)
comedi/comedi_fops.c
comedi/drivers.c
comedi/drivers/adl_pci9118.c
comedi/drivers/adv_pci1710.c
comedi/drivers/dt282x.c
comedi/drivers/ni_mio_common.c
comedi/drivers/ni_pcidio.c
comedi/drivers/pcl812.c
comedi/kcomedilib/kcomedilib_main.c

index 46ba591ad16d77fb4d1506d05e607d309411c9bd..020bf4fdb50e41c02754e4da5c07753e1ee6e99c 100644 (file)
@@ -471,12 +471,12 @@ static int do_bufinfo_ioctl(comedi_device *dev,void *arg)
                }
 
                async->buf_read_ptr += bi.bytes_read;
-               if( async->buf_read_ptr >= async->data_len )
-                       async->buf_read_ptr %= async->data_len;
+               if( async->buf_read_ptr >= async->prealloc_bufsz )
+                       async->buf_read_ptr %= async->prealloc_bufsz;
                async->buf_read_count += bi.bytes_read;
 
                // check for buffer overflow
-               if( m > async->data_len )
+               if( m > async->prealloc_bufsz )
                {
                        do_cancel(dev, dev->read_subdev);
                        DPRINTK("buffer overflow\n");
@@ -878,18 +878,8 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file)
                goto cleanup;
        }
 
-#if 0
-       /* XXX this needs to be removed when the drivers are ready */
-       /* They should be ready now. */
-       async->cmd.data = async->prealloc_buf;
-       async->cmd.data_len=async->prealloc_bufsz;
-#endif
-
        init_async_buf( async );
 
-       async->data = async->prealloc_buf;
-       async->data_len=async->prealloc_bufsz;
-
        async->cb_mask = COMEDI_CB_EOA|COMEDI_CB_BLOCK|COMEDI_CB_ERROR;
        if(async->cmd.flags & TRIG_WAKE_EOS){
                async->cb_mask |= COMEDI_CB_EOS;
@@ -1343,8 +1333,8 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes,
                n=nbytes;
 
                m = n;
-               if(async->buf_write_ptr + m > async->data_len){
-                       m = async->data_len - async->buf_write_ptr;
+               if(async->buf_write_ptr + m > async->prealloc_bufsz){
+                       m = async->prealloc_bufsz - async->buf_write_ptr;
                }
                m = comedi_buf_write_alloc(async, m);
 
index 2a8541af9a152dd7afee527ec17665af46f3ab01..d0eeea841e49b9b0dfc7bb0e9c3027192657dee3 100644 (file)
@@ -394,7 +394,7 @@ static int buf_alloc(comedi_device *dev, comedi_subdevice *s,
 
 unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes)
 {
-       unsigned int free_end = async->buf_read_count + async->data_len;
+       unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
 
        if((int)(async->buf_free_count + nbytes - free_end) > 0){
                nbytes = free_end - async->buf_free_count;
@@ -408,7 +408,7 @@ unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes)
 unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
        unsigned int nbytes)
 {
-       unsigned int free_end = async->buf_read_count + async->data_len;
+       unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
 
        if((int)(async->buf_free_count + nbytes - free_end) > 0){
                nbytes = 0;
@@ -424,8 +424,8 @@ void comedi_buf_write_free(comedi_async *async, unsigned int nbytes)
 {
        async->buf_write_count += nbytes;
        async->buf_write_ptr += nbytes;
-       if(async->buf_write_ptr >= async->data_len){
-               async->buf_write_ptr -= async->data_len;
+       if(async->buf_write_ptr >= async->prealloc_bufsz){
+               async->buf_write_ptr -= async->prealloc_bufsz;
                async->events |= COMEDI_CB_EOBUF;
        }
 }
@@ -435,8 +435,8 @@ void comedi_buf_read_free(comedi_async *async, unsigned int nbytes)
 {
        async->buf_read_count += nbytes;
        async->buf_read_ptr += nbytes;
-       if(async->buf_read_ptr >= async->data_len){
-               async->buf_read_ptr -= async->data_len;
+       if(async->buf_read_ptr >= async->prealloc_bufsz){
+               async->buf_read_ptr -= async->prealloc_bufsz;
        }
 }
 
@@ -445,19 +445,19 @@ void comedi_buf_memcpy_to( comedi_async *async, unsigned int offset, const void
 {
        unsigned int write_ptr = async->buf_write_ptr + offset;
 
-       if( write_ptr >= async->data_len )
-               write_ptr -= async->data_len;
+       if( write_ptr >= async->prealloc_bufsz )
+               write_ptr -= async->prealloc_bufsz;
 
        while( num_bytes )
        {
                unsigned int block_size;
 
-               if( write_ptr + num_bytes > async->data_len)
-                       block_size = async->data_len - write_ptr;
+               if( write_ptr + num_bytes > async->prealloc_bufsz)
+                       block_size = async->prealloc_bufsz - write_ptr;
                else
                        block_size = num_bytes;
 
-               memcpy( async->data + write_ptr, data, block_size );
+               memcpy( async->prealloc_buf + write_ptr, data, block_size );
 
                data += block_size;
                num_bytes -= block_size;
@@ -472,17 +472,17 @@ void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
        void *src;
        unsigned int read_ptr = async->buf_read_ptr + offset;
 
-       if( read_ptr >= async->data_len )
-               read_ptr -= async->data_len;
+       if( read_ptr >= async->prealloc_bufsz )
+               read_ptr -= async->prealloc_bufsz;
 
        while( nbytes )
        {
                unsigned int block_size;
 
-               src = async->data + read_ptr;
+               src = async->prealloc_buf + read_ptr;
 
-               if( nbytes >= async->data_len - read_ptr )
-                       block_size = async->data_len - read_ptr;
+               if( nbytes >= async->prealloc_bufsz - read_ptr )
+                       block_size = async->prealloc_bufsz - read_ptr;
                else
                        block_size = nbytes;
 
index 8c53d37964f161a3b1c70a56d4fa2edcde36f1b5..31be8001ad15207b44abe2d8f02fe2363cebad0d 100644 (file)
@@ -1471,8 +1471,8 @@ static int pci9118_ai_cmd(comedi_device *dev,comedi_subdevice *s)
        devpriv->ai_n_chan=cmd->chanlist_len;
        devpriv->ai_n_scanlen=cmd->scan_end_arg;
        devpriv->ai_chanlist=cmd->chanlist;
-       devpriv->ai_data=s->async->data;
-       devpriv->ai_data_len=s->async->data_len;
+       devpriv->ai_data=s->async->prealloc_buf;
+       devpriv->ai_data_len=s->async->prealloc_bufsz;
        devpriv->ai_timer1=0;
        devpriv->ai_timer2=0;
        devpriv->ai_add_front=0;
index c7f528dbe53ffd6521b373d4fc141d680e1872b0..91309da32fe2e7d1c2c27e56cbbe832b0c9d061f 100644 (file)
@@ -907,8 +907,8 @@ static int pci171x_ai_cmd(comedi_device *dev,comedi_subdevice *s)
        devpriv->ai_n_chan=cmd->chanlist_len;
        devpriv->ai_chanlist=cmd->chanlist;
        devpriv->ai_flags=cmd->flags;
-       devpriv->ai_data_len=s->async->data_len;
-       devpriv->ai_data=s->async->data;
+       devpriv->ai_data_len=s->async->prealloc_bufsz;
+       devpriv->ai_data=s->async->prealloc_buf;
        devpriv->ai_timer1=0;
        devpriv->ai_timer2=0;
 
index 40145f72821305e5f6abe8148b075886ba4b3514..f0335b410612b0fc2dc7fc4bca06b8d6eeb97abd 100644 (file)
@@ -432,7 +432,7 @@ static void dt282x_ao_dma_interrupt(comedi_device * dev)
 
        update_supcsr(DT2821_CLRDMADNE);
 
-       if(!s->async->data){
+       if(!s->async->prealloc_buf){
                printk("async->data disappeared.  dang!\n");
                return;
        }
@@ -472,7 +472,7 @@ static void dt282x_ai_dma_interrupt(comedi_device * dev)
 
        update_supcsr(DT2821_CLRDMADNE);
 
-       if(!s->async->data){
+       if(!s->async->prealloc_buf){
                printk("async->data disappeared.  dang!\n");
                return;
        }
index a37722ab23955ec654ec2d5025b0be39a25dea29..622f57a6548045c477f5aea540abc56b868f65c1 100644 (file)
@@ -717,7 +717,7 @@ static void ni_handle_fifo_dregs(comedi_device *dev)
                }
        }else{
                while(1){
-                       n = s->async->data_len / sizeof(sampl_t);
+                       n = s->async->prealloc_bufsz / sizeof(sampl_t);
                        for(i=0;i<n;i++){
                                if(win_in(AI_Status_1_Register)&AI_FIFO_Empty_St){
                                        return;
index 3c733ae51cd8dec520e5084e2e7995a57205d962..9ed9c9d2733c677b5429d6396634905cf46fdde8 100644 (file)
@@ -434,8 +434,8 @@ static void nidio_interrupt(int irq, void *d, struct pt_regs *regs)
 
                        async->buf_write_count += count;
                        async->buf_write_ptr += count;
-                       if(async->buf_write_ptr >= async->data_len){
-                               async->buf_write_ptr -= async->data_len;
+                       if(async->buf_write_ptr >= async->prealloc_bufsz){
+                               async->buf_write_ptr -= async->prealloc_bufsz;
                        }
                        mite->current_link++;
                        if(mite->current_link >= mite->n_links){
index 136d17c6292c922f23b950b752db6b13a751f1e4..6ec624989e0d965f47f434f3a0f2e26595ac41d8 100644 (file)
@@ -772,8 +772,8 @@ static int pcl812_ai_cmd(comedi_device *dev,comedi_subdevice *s)
        } else devpriv->ai_dma=0;
                
        devpriv->ai_flags=cmd->flags;
-       devpriv->ai_data_len=s->async->data_len;
-       devpriv->ai_data=s->async->data;
+       devpriv->ai_data_len=s->async->prealloc_bufsz;
+       devpriv->ai_data=s->async->prealloc_buf;
        if (cmd->stop_src==TRIG_COUNT) { devpriv->ai_scans=cmd->stop_arg; devpriv->ai_neverending=0; }
                                else   { devpriv->ai_scans=0; devpriv->ai_neverending=1; }
 
index 0e4a2460092b9fb832ca44fe845445cf48008b25..0a4fee692b3655239b00ef91c58007dd298e35b4 100644 (file)
@@ -160,9 +160,6 @@ int comedi_command(comedi_t *d,comedi_cmd *cmd)
 
        init_async_buf( async );
 
-       async->data = cmd->data;
-       async->data_len = cmd->data_len;
-
        return s->do_cmd(dev,s);
 }