From 39a81cdd7d7b44330451eefaf6daaac80fa8afa9 Mon Sep 17 00:00:00 2001 From: midipix Date: Oct 26 2016 02:47:15 +0000 Subject: driver: internals: added the static inlined sfrt_get_driver_ictx() helper. --- 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