}
 
 /* transfers a chunk from writer to filled buffer space */
-unsigned int comedi_buf_write_free(struct comedi_async *async,
+unsigned int comedi_buf_write_free(struct comedi_subdevice *s,
                                   unsigned int nbytes)
 {
+       struct comedi_async *async = s->async;
        unsigned int allocated = comedi_buf_write_n_allocated(async);
 
        if (nbytes > allocated)
                return 0;
        }
        *(unsigned short *)(async->prealloc_buf + async->buf_write_ptr) = x;
-       comedi_buf_write_free(async, sizeof(short));
+       comedi_buf_write_free(s, sizeof(short));
        return 1;
 }
 EXPORT_SYMBOL_GPL(comedi_buf_put);
 
        if (bi.bytes_written && (s->subdev_flags & SDF_CMD_WRITE)) {
                bi.bytes_written =
                    comedi_buf_write_alloc(s, bi.bytes_written);
-               comedi_buf_write_free(async, bi.bytes_written);
+               comedi_buf_write_free(s, bi.bytes_written);
        }
 
 copyback_position:
                        n -= m;
                        retval = -EFAULT;
                }
-               comedi_buf_write_free(async, n);
+               comedi_buf_write_free(s, n);
 
                count += n;
                nbytes -= n;
 
 int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev);
 
 unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n);
-unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int);
+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);
 
                                ui_ScanValueArray, (7 + 12) * sizeof(unsigned int));
 
                        /*  Update comedi buffer pinters indexes */
-                       comedi_buf_write_free(s->async,
+                       comedi_buf_write_free(s,
                                (7 + 12) * sizeof(unsigned int));
 
                        /*  Send events */
 
        }
 
        comedi_buf_memcpy_to(s, 0, data, num_bytes);
-       comedi_buf_write_free(async, num_bytes);
+       comedi_buf_write_free(s, num_bytes);
        cfc_inc_scan_progress(s, num_bytes);
        async->events |= COMEDI_CB_BLOCK;
 
 
        if (count <= 0)
                return 0;
 
-       comedi_buf_write_free(async, count);
+       comedi_buf_write_free(s, count);
        cfc_inc_scan_progress(s, count);
        async->events |= COMEDI_CB_BLOCK;
        return 0;