summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorchannel.c
diff options
context:
space:
mode:
authorNeil Horman2015-08-01 00:56:32 +0200
committerGreg Kroah-Hartman2015-08-04 02:45:02 +0200
commitfdc792cd1b5c86cb34770707aa1b04edce5288cf (patch)
tree4a47e45329aa668ed914812fbfa7a15b9f20d011 /drivers/staging/unisys/visorbus/visorchannel.c
parentstaging: android: Allow compile test of GPIO consumers if !GPIOLIB (diff)
downloadkernel-qcow2-linux-fdc792cd1b5c86cb34770707aa1b04edce5288cf.tar.gz
kernel-qcow2-linux-fdc792cd1b5c86cb34770707aa1b04edce5288cf.tar.xz
kernel-qcow2-linux-fdc792cd1b5c86cb34770707aa1b04edce5288cf.zip
staging: unisys: visorchannel: Add peek function
According to unisys, the s_par hypervisor has a bug in which it never triggers an interrupt. That makes the visornic effectively a 2ms poll loop. In order to just have the rx thread shceduling a napi poll every 2ms, lets instead give it the chance to check the response queue for data before we schedule. This helper provides that functionality Signed-off-by: Neil Horman <nhorman@redhat.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visorbus/visorchannel.c')
-rw-r--r--drivers/staging/unisys/visorbus/visorchannel.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 242246492b7a..6da7e49a6627 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -430,6 +430,27 @@ visorchannel_signalremove(struct visorchannel *channel, u32 queue, void *msg)
}
EXPORT_SYMBOL_GPL(visorchannel_signalremove);
+bool
+visorchannel_signalempty(struct visorchannel *channel, u32 queue)
+{
+ unsigned long flags = 0;
+ struct signal_queue_header sig_hdr;
+ bool rc = false;
+
+ if (channel->needs_lock)
+ spin_lock_irqsave(&channel->remove_lock, flags);
+
+ if (!sig_read_header(channel, queue, &sig_hdr))
+ rc = true;
+ if (sig_hdr.head == sig_hdr.tail)
+ rc = true;
+ if (channel->needs_lock)
+ spin_unlock_irqrestore(&channel->remove_lock, flags);
+
+ return rc;
+}
+EXPORT_SYMBOL_GPL(visorchannel_signalempty);
+
static bool
signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg)
{