Extract container_of definition out of individual bindings
This will make possible reuse this portion on code in the future.
Testing: no change in functionality; compiles successfuly
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Change-Id: Ie92161c547e275d9aa00d643d8d4879d2f5dd199
diff --git a/astlpc.c b/astlpc.c
index f8cf42e..66fa930 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -21,6 +21,7 @@
#include "libmctp-alloc.h"
#include "libmctp-log.h"
#include "libmctp-astlpc.h"
+#include "container_of.h"
#ifdef MCTP_HAVE_FILEIO
@@ -60,11 +61,6 @@
uint8_t txbuf[256];
};
-#ifndef container_of
-#define container_of(ptr, type, member) \
- (type *)((char *)(ptr) - (char *)&((type *)0)->member)
-#endif
-
#define binding_to_astlpc(b) \
container_of(b, struct mctp_binding_astlpc, binding)