msm: smd: add packet checking API
Add an API to allow clients to poll for incoming packets when they have
interrupts disabled, otherwise internal SMD structures will never update
and the client can never get the packet they are waiting for.
Change-Id: I50bb8d466fe6a19db01e9cec6eb61b4ea89c18d9
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index 6b42325..dac0a37 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -2207,6 +2207,20 @@
}
EXPORT_SYMBOL(smd_tiocmset);
+int smd_is_pkt_avail(smd_channel_t *ch)
+{
+ if (!ch || !ch->is_pkt_ch)
+ return -EINVAL;
+
+ if (ch->current_packet)
+ return 1;
+
+ update_packet_state(ch);
+
+ return ch->current_packet ? 1 : 0;
+}
+EXPORT_SYMBOL(smd_is_pkt_avail);
+
/* -------------------------------------------------------------------------- */