The container_of macro can be used by many modules. This commit moves it
to common header to prevent duplication.
Change-Id: I3d87766b561db8f67354d0abe8784ea62d05016d
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
extern "C" {
#endif
+#include <stddef.h>
#include <stdint.h>
#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
__attribute__ ((visibility("default"))) \
struct hw_info HARDWARE_INFO_SYM
+#ifndef container_of
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+
+
#ifdef __cplusplus
}
#endif
*/
#define USB_GADGET_DEVICE_VERSION MAKE_VERSION(0,1)
-#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-#endif
-
#define _HELPER_Y(x) ((x) & -(x))
/* Count number of trailing zeros using Dean Gaudet's algorithm */