Commit a1911764 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: remove unnecessary keep_mbo variable

The MBO pointer stacked_mbo and the boolean variable keep_mbo are
always changed together and therefore provide the same information.
This patch removes keep_mbo and uses stacked_mbo instead.
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9305b0fe
...@@ -39,7 +39,6 @@ struct aim_channel { ...@@ -39,7 +39,6 @@ struct aim_channel {
struct most_channel_config *cfg; struct most_channel_config *cfg;
unsigned int channel_id; unsigned int channel_id;
dev_t devno; dev_t devno;
bool keep_mbo;
unsigned int mbo_offs; unsigned int mbo_offs;
struct mbo *stacked_mbo; struct mbo *stacked_mbo;
DECLARE_KFIFO_PTR(fifo, typeof(struct mbo *)); DECLARE_KFIFO_PTR(fifo, typeof(struct mbo *));
...@@ -136,7 +135,7 @@ static int aim_close(struct inode *inode, struct file *filp) ...@@ -136,7 +135,7 @@ static int aim_close(struct inode *inode, struct file *filp)
while (kfifo_out((struct kfifo *)&channel->fifo, &mbo, 1)) while (kfifo_out((struct kfifo *)&channel->fifo, &mbo, 1))
most_put_mbo(mbo); most_put_mbo(mbo);
if (channel->keep_mbo) if (channel->stacked_mbo)
most_put_mbo(channel->stacked_mbo); most_put_mbo(channel->stacked_mbo);
ret = most_stop_channel(channel->iface, channel->channel_id, &cdev_aim); ret = most_stop_channel(channel->iface, channel->channel_id, &cdev_aim);
atomic_dec(&channel->access_ref); atomic_dec(&channel->access_ref);
...@@ -227,9 +226,8 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) ...@@ -227,9 +226,8 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
struct mbo *mbo; struct mbo *mbo;
struct aim_channel *channel = filp->private_data; struct aim_channel *channel = filp->private_data;
if (channel->keep_mbo) { if (channel->stacked_mbo) {
mbo = channel->stacked_mbo; mbo = channel->stacked_mbo;
channel->keep_mbo = false;
goto start_copy; goto start_copy;
} }
while ((!kfifo_out(&channel->fifo, &mbo, 1)) && (channel->dev)) { while ((!kfifo_out(&channel->fifo, &mbo, 1)) && (channel->dev)) {
...@@ -249,9 +247,6 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) ...@@ -249,9 +247,6 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
return -EIO; return -EIO;
} }
if (count < mbo->processed_length)
channel->keep_mbo = true;
proc_len = min((int)count, proc_len = min((int)count,
(int)(mbo->processed_length - channel->mbo_offs)); (int)(mbo->processed_length - channel->mbo_offs));
...@@ -261,12 +256,13 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) ...@@ -261,12 +256,13 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
retval = not_copied ? proc_len - not_copied : proc_len; retval = not_copied ? proc_len - not_copied : proc_len;
if (channel->keep_mbo) { if (count < mbo->processed_length) {
channel->mbo_offs = retval; channel->mbo_offs = retval;
channel->stacked_mbo = mbo; channel->stacked_mbo = mbo;
} else { } else {
most_put_mbo(mbo); most_put_mbo(mbo);
channel->mbo_offs = 0; channel->mbo_offs = 0;
channel->stacked_mbo = NULL;
} }
mutex_unlock(&channel->io_mutex); mutex_unlock(&channel->io_mutex);
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment