EXPORT_SYMBOL_GPL(comedi_buf_read_n_available);
 
 /* allocates a chunk for the reader from filled (and munged) buffer space */
-unsigned int comedi_buf_read_alloc(struct comedi_async *async,
+unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s,
                                   unsigned int nbytes)
 {
+       struct comedi_async *async = s->async;
        unsigned int available;
 
        available = async->munge_count - async->buf_read_alloc_count;
 
        if (n < sizeof(short))
                return 0;
-       comedi_buf_read_alloc(async, sizeof(short));
+       comedi_buf_read_alloc(s, sizeof(short));
        *x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr);
        comedi_buf_read_free(async, sizeof(short));
        return 1;
 
                return -EACCES;
 
        if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) {
-               bi.bytes_read = comedi_buf_read_alloc(async, bi.bytes_read);
+               bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read);
                comedi_buf_read_free(async, bi.bytes_read);
 
                if (comedi_is_subdevice_idle(s) &&
                        retval = -EFAULT;
                }
 
-               comedi_buf_read_alloc(async, n);
+               comedi_buf_read_alloc(s, n);
                comedi_buf_read_free(async, n);
 
                count += n;
 
 unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n);
 
 unsigned int comedi_buf_read_n_available(struct comedi_async *);
-unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
+unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n);
 unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);
 
 int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
 
        if (num_bytes == 0)
                return 0;
 
-       num_bytes = comedi_buf_read_alloc(async, num_bytes);
+       num_bytes = comedi_buf_read_alloc(s, num_bytes);
        comedi_buf_memcpy_from(s, 0, data, num_bytes);
        comedi_buf_read_free(async, num_bytes);
        cfc_inc_scan_progress(s, num_bytes);
 
 int mite_sync_output_dma(struct mite_channel *mite_chan,
                         struct comedi_async *async)
 {
+       struct comedi_subdevice *s = async->subdevice;
        int count;
        u32 nbytes_ub, nbytes_lb;
        unsigned int old_alloc_count;
-       u32 stop_count =
-           async->cmd.stop_arg * cfc_bytes_per_scan(async->subdevice);
+       u32 stop_count = async->cmd.stop_arg * cfc_bytes_per_scan(s);
 
        old_alloc_count = async->buf_read_alloc_count;
        /*  read alloc as much as we can */
-       comedi_buf_read_alloc(async, async->prealloc_bufsz);
+       comedi_buf_read_alloc(s, async->prealloc_bufsz);
        nbytes_lb = mite_bytes_read_from_memory_lb(mite_chan);
        if (async->cmd.stop_src == TRIG_COUNT &&
            (int)(nbytes_lb - stop_count) > 0)
 
                return retval;
 
        /* read alloc the entire buffer */
-       comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz);
+       comedi_buf_read_alloc(s, s->async->prealloc_bufsz);
 
        spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
        if (devpriv->ao_mite_chan) {
        s->async->inttrig = NULL;
 
        /* read alloc the entire buffer */
-       comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz);
+       comedi_buf_read_alloc(s, s->async->prealloc_bufsz);
 
 #ifdef PCIDMA
        spin_lock_irqsave(&devpriv->mite_channel_lock, flags);