summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-25 22:28:27 -0400
committermidipix <writeonce@midipix.org>2016-10-25 22:47:15 -0400
commit39a81cdd7d7b44330451eefaf6daaac80fa8afa9 (patch)
tree5703f6e9cee6215cd7a749fafcfc64d458cc018c
parent1cf7fa03099e1a80385791f281a00622cf429296 (diff)
downloadsofort-39a81cdd7d7b44330451eefaf6daaac80fa8afa9.tar.bz2
sofort-39a81cdd7d7b44330451eefaf6daaac80fa8afa9.tar.xz
driver: internals: added the static inlined sfrt_get_driver_ictx() helper.
-rw-r--r--src/internal/sofort_driver_impl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/internal/sofort_driver_impl.h b/src/internal/sofort_driver_impl.h
index 0808b55..4fdcf96 100644
--- a/src/internal/sofort_driver_impl.h
+++ b/src/internal/sofort_driver_impl.h
@@ -35,4 +35,17 @@ struct sfrt_unit_ctx_impl {
struct sfrt_unit_ctx uctx;
};
+static inline struct sfrt_driver_ctx_impl * sfrt_get_driver_ictx(
+ const struct sfrt_driver_ctx * dctx)
+{
+ uintptr_t addr;
+
+ if (dctx) {
+ addr = (uintptr_t)dctx - offsetof(struct sfrt_driver_ctx_impl,ctx);
+ return (struct sfrt_driver_ctx_impl *)addr;
+ }
+
+ return 0;
+}
+
#endif