Hi All,
I am porting a Windows device driver to Linux.
I defined a macro for CONTANING_RECORD like
#define CONTAINING_RECORD(ptr, type, member) list_entry((ptr), (type), (member))
When i compiled my module, i got following errors
$ make 2>&1 | grep 1132
alloc.c:1132: error: expected _expression_ before ‘)’ token
alloc.c:1132: error: expected identifier before ‘(’ token
alloc.c:1132: warning: type defaults to ‘int’ in declaration of ‘__mptr’
alloc.c:1132: warning: initialization from incompatible pointer type
alloc.c:1132: error: expected _expression_ before ‘)’ token
Corresponding code snippet
1130 list_for_each(Entry, &Ptr->ActiveList[target]) {
1131
1132 node = CONTAINING_RECORD(Entry, IFTL_EU, link);
1133
1134 die = DIE_FROM_EU(node->eu);
1135
1136 if (Ptr->LastDie != die) {
1137 Ptr->LastDie = die;
1138 break;
1139 }
1140 }
Then I changed macro with
#define CONTAINING_RECORD list_entry
$ make 2>&1 | grep 1132
$
And it worked, but I am not getting what was problem with the first macro definition.
Thanks and Regards,
Prasad