summaryrefslogtreecommitdiffstats
path: root/drivers/staging/most/aim-cdev
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2015-09-28 17:18:45 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-29 03:18:51 +0200
commit71457d482751a38e78da32fde80e87b6f670c389 (patch)
tree5a5c845fb2a78d9c33ee48b1448473316af73cfa /drivers/staging/most/aim-cdev
parentc81c9c3e0fd5170e7bede7d06202062338644e93 (diff)
downloadlinux-71457d482751a38e78da32fde80e87b6f670c389.tar.bz2
staging: most: add fair buffer distribution
This patch ensures a fair distribution of buffers, when two AIMs share a single channel. The AIMs then won't be able to use more than half of all pre-allocated buffers of the linked channel. However, in case the channel is not shared, the AIM can exclusively use all available buffers. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most/aim-cdev')
-rw-r--r--drivers/staging/most/aim-cdev/cdev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index a8a7689231ac..23c3f6e7340c 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -165,7 +165,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
}
mutex_unlock(&channel->io_mutex);
- mbo = most_get_mbo(channel->iface, channel->channel_id);
+ mbo = most_get_mbo(channel->iface, channel->channel_id, &cdev_aim);
if (!mbo) {
if ((filp->f_flags & O_NONBLOCK))
@@ -173,7 +173,8 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
if (wait_event_interruptible(
channel->wq,
(mbo = most_get_mbo(channel->iface,
- channel->channel_id)) ||
+ channel->channel_id,
+ &cdev_aim)) ||
(!channel->dev)))
return -ERESTARTSYS;
}