aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/sxg/sxghif.h
diff options
context:
space:
mode:
authorMithlesh Thukral <mithlesh@linsyssoft.com>2009-01-19 20:23:22 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 14:53:10 -0700
commitd9d578bff771229c017582d746259ac282ee01e2 (patch)
treed9ee56c1568acc1065d54c5554035521bf0bb6d1 /drivers/staging/sxg/sxghif.h
parent371d7a9e6f0486fb814582c46785fdb147d7215e (diff)
Staging: sxg: SXG SGL related cleanup in data structures and code
* Cleanup in allocation of SXG_SGLs. * Locking issues related to SglQLock. * XmtCmd and XmtZeroLock consistency fixes. Signed-off-by: LinSysSoft Sahara Team <saharaproj@linsyssoft.com> Signed-off-by: Christopher Harrer <charrer@alacritech.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/sxg/sxghif.h')
-rw-r--r--drivers/staging/sxg/sxghif.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/staging/sxg/sxghif.h b/drivers/staging/sxg/sxghif.h
index 5a9e2712c89..faba61529dd 100644
--- a/drivers/staging/sxg/sxghif.h
+++ b/drivers/staging/sxg/sxghif.h
@@ -486,6 +486,20 @@ struct sxg_ring_info {
SXG_RING_ADVANCE_TAIL(_ringinfo); \
}
+/*
+ * For a given ring find out how much the first pointer is ahead of
+ * the second pointer. "ahead" recognises the fact that the ring can wrap
+ */
+static inline int sxg_ring_get_forward_diff (struct sxg_ring_info *ringinfo,
+ int a, int b) {
+ if ((a < 0 || a > ringinfo->Size ) || (b < 0 || b > ringinfo->Size))
+ return -1;
+ if (a > b) /* _a is lagging _b and _b has not wrapped around */
+ return (a - b);
+ else
+ return ((ringinfo->Size - (b - a)));
+}
+
/***************************************************************
* Host Command Buffer - commands to INIC via the Cmd Rings
*