This fixes the usage of structure members that are declared const to get
a pointer to the embedding parent structure.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
*/
#ifndef container_of
#define container_of(ptr, type, member) __extension__ ({ \
- typeof(((type *)0)->member) *_ptr = (ptr); \
- (type *)(((char *)_ptr) - offsetof(type, member)); })
+ const typeof(((type *)0)->member) *_ptr = (ptr); \
+ (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \
+ })
#endif
#define _RTE_STR(x) #x