static struct pci_driver unknown field 'name' "has initializer but incomplete type"
I am writing a PCI device driver in gnu gcc
The includes are: #include <linux/kernel.h> #include <pci/config.h> #include "/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/pci.h" #include <stdio.h> #include <stdlib.h> //#include <unistd.h> //#include <linux/types.h> #include <sys/types.h> //#include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <ctype.h> The static struct pci_device_id NHI_15504_idtable [] = { { vendor : NHI_15504_VENDOR_ID, device : NHI_15504_DEVICE_ID, subvendor : PCI_ANY_ID, subdevice : PCI_ANY_ID, class : 0, class_mask : 0, driver_data :0, }, {0,}, }; compiles cleanly. I have stubbed out the probe callback function. The problem arises in the declaration of the static struct pci_driver NHI_15504_driver = { .name = "NHI_15504", .id_table = NHI_15504_idtable, .probe = &NHI_15504_probe, .remove = NULL, }; I get the following errors make all Building file: ../NHI_15504.c Invoking: GCC C Compiler gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"NHI_15504.d" -MT"NHI_15504.d" -o"NHI_15504.o" "../NHI_15504.c" In file included from ../NHI_15504.c:46: /usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/mod_devicetable.h:310: error: ‘BITS_PER_LONG’ undeclared here (not in a function) ../NHI_15504.c:91: error: variable ‘NHI_15504_driver’ has initializer but incomplete type ../NHI_15504.c:92: error: unknown field ‘name’ specified in initializer ../NHI_15504.c:92: warning: excess elements in struct initializer ../NHI_15504.c:92: warning: (near initialization for ‘NHI_15504_driver’) ../NHI_15504.c:93: error: unknown field specified in initializer ../NHI_15504.c:93: warning: excess elements in struct initializer ../NHI_15504.c:93: warning: (near initialization for ‘NHI_15504_driver’) ../NHI_15504.c:94: error: unknown field ‘probe’ specified in initializer ../NHI_15504.c:94: warning: excess elements in struct initializer ../NHI_15504.c:94: warning: (near initialization for ‘NHI_15504_driver’) ../NHI_15504.c:95: error: unknown field ‘remove’ specified in initializer ../NHI_15504.c:95: warning: excess elements in struct initializer ../NHI_15504.c:95: warning: (near initialization for ‘NHI_15504_driver’) ../NHI_15504.c: In function ‘__init’: ../NHI_15504.c:115: warning: implicit declaration of function ‘pci_register_driver’ make: *** [NHI_15504.o] Error 1 Questions: 1) The Error mod_devicetable.h:310: error: ‘BITS_PER_LONG’ undeclared here (not in a function) The BITS_PER_LONG are define in file2alias.c as as result of #if KERNEL_ELFCLASS == ELFCLASS32 (a) Where should KERNEL_ELFCLASS be #defined? (b) Should it not be define already?? 2) The Error ../NHI_15504.c:91: error: variable ‘NHI_15504_driver’ has initializer but incomplete type (a) What am I missing in this struct declaration? (b) Why are the fields 'name', ‘id_table’ 'probe" 'remove' unknown fields in this struct? |
All times are GMT -5. The time now is 03:02 AM. |