summaryrefslogtreecommitdiffstats
path: root/drivers/staging/most/aim-cdev
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2016-01-12 14:00:03 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 17:34:58 -0800
commitcdc293d58945527f36b13771822be69277c21bd6 (patch)
treebd20a7a458ccc59c0ec561c55ac0c1ee602e2d20 /drivers/staging/most/aim-cdev
parent5f858a61a8b4f5fec7b3c0618646ed6f7bfcd3a7 (diff)
downloadlinux-cdc293d58945527f36b13771822be69277c21bd6.tar.bz2
staging: most: fix retrieval of buffer availability
This patch fixes the function channel_has_mbo that delivers the false information in case two AIMs are using the same tx channel. 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.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 533e2900ad63..c4bbf7d296e8 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -50,6 +50,11 @@ struct aim_channel {
static struct list_head channel_list;
static spinlock_t ch_list_lock;
+static inline bool ch_has_mbo(struct aim_channel *c)
+{
+ return channel_has_mbo(c->iface, c->channel_id, &cdev_aim) > 0;
+}
+
static struct aim_channel *get_channel(struct most_interface *iface, int id)
{
struct aim_channel *channel, *tmp;
@@ -279,11 +284,6 @@ start_copy:
return copied;
}
-static inline bool __must_check IS_ERR_OR_FALSE(int x)
-{
- return x <= 0;
-}
-
static unsigned int aim_poll(struct file *filp, poll_table *wait)
{
struct aim_channel *c = filp->private_data;
@@ -295,7 +295,7 @@ static unsigned int aim_poll(struct file *filp, poll_table *wait)
if (!kfifo_is_empty(&c->fifo))
mask |= POLLIN | POLLRDNORM;
} else {
- if (!IS_ERR_OR_FALSE(channel_has_mbo(c->iface, c->channel_id)))
+ if (ch_has_mbo(c))
mask |= POLLOUT | POLLWRNORM;
}
return mask;