Sorry that the title is a bit vague. Here is what I want to do.
First lets say there is the following struct.
struct info {
struct device *dev
int a;
int b;
}
I allocate memory for this struct and assign values as the following.
struct info *i0;
i0 = kzalloc(sizeof(*i), GFP_KERNEL);
i0->dev = dev0; //dev is pre-initialized
i0->a = 0;
i0->b = 1;
I am unsure if I can use container_of
with pre-initialized dev0
that I used to assign to i0->dev
. Something like below.
struct info * i1 = container_of(dev0, struct info, dev);
do_something(i1->a, i1->b);
Doing so gives the following error in the line of container_of
.
error: undefined symbol: __compiletime_assert_###
Can someone help me understand the error and guide me on correct use of container_of
? What would be a good workaround?
Thank you very much.