unsigned int channel_id;
dev_t devno;
size_t mbo_offs;
- struct mbo *stacked_mbo;
DECLARE_KFIFO_PTR(fifo, typeof(struct mbo *));
int access_ref;
struct list_head list;
while (kfifo_out((struct kfifo *)&c->fifo, &mbo, 1))
most_put_mbo(mbo);
- if (c->stacked_mbo)
- most_put_mbo(c->stacked_mbo);
- c->stacked_mbo = NULL;
most_stop_channel(c->iface, c->channel_id, &cdev_aim);
}
return -EBUSY;
}
+ c->mbo_offs = 0;
ret = most_start_channel(c->iface, c->channel_id, &cdev_aim);
if (!ret)
c->access_ref = 1;
struct aim_channel *c = filp->private_data;
mutex_lock(&c->io_mutex);
- if (c->stacked_mbo) {
- mbo = c->stacked_mbo;
- goto start_copy;
- }
- while ((!kfifo_out(&c->fifo, &mbo, 1)) && (c->dev)) {
+ while (c->dev && !kfifo_peek(&c->fifo, &mbo)) {
mutex_unlock(&c->io_mutex);
if (filp->f_flags & O_NONBLOCK)
return -EAGAIN;
return -ERESTARTSYS;
mutex_lock(&c->io_mutex);
}
- c->stacked_mbo = mbo;
-start_copy:
/* make sure we don't submit to gone devices */
if (unlikely(!c->dev)) {
mutex_unlock(&c->io_mutex);
c->mbo_offs += copied;
if (c->mbo_offs >= mbo->processed_length) {
+ kfifo_skip(&c->fifo);
most_put_mbo(mbo);
c->mbo_offs = 0;
- c->stacked_mbo = NULL;
}
mutex_unlock(&c->io_mutex);
return copied;
c->iface = iface;
c->cfg = cfg;
c->channel_id = channel_id;
- c->mbo_offs = 0;
c->access_ref = 0;
spin_lock_init(&c->unlink);
INIT_KFIFO(c->fifo);