From 3a9f95ab03988cd1d4755f6da7c9a24b0c9ff121 Mon Sep 17 00:00:00 2001 From: midipix Date: Nov 11 2016 05:22:48 +0000 Subject: driver: internals: added the static inlined mdso_get_driver_ictx() helper. --- diff --git a/src/internal/mdso_driver_impl.h b/src/internal/mdso_driver_impl.h index c6131b8..f43b790 100644 --- a/src/internal/mdso_driver_impl.h +++ b/src/internal/mdso_driver_impl.h @@ -46,4 +46,17 @@ struct mdso_unit_ctx_impl { struct mdso_unit_ctx uctx; }; +static inline struct mdso_driver_ctx_impl * mdso_get_driver_ictx( + const struct mdso_driver_ctx * dctx) +{ + uintptr_t addr; + + if (dctx) { + addr = (uintptr_t)dctx - offsetof(struct mdso_driver_ctx_impl,ctx); + return (struct mdso_driver_ctx_impl *)addr; + } + + return 0; +} + #endif