Hi. I have problems when compiling the adxl345 driver as a module on the 3.5.0 kernel.
I'm using the classic method of create a makefile.
I get all those errors for the file adxl34x.c :
c2a@boxC2A:~/test$ sudo make
make -C /usr/src/linux-headers-3.5.0-28-generic SUBDIRS=/home/c2a/test modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-28-generic'
CC [M] /home/c2a/test/adxl34x.o
/home/c2a/test/adxl34x.c: In function ‘adxl34x_get_triple’:
/home/c2a/test/adxl34x.c:243:10: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘adxl34x_irq’:
/home/c2a/test/adxl34x.c:311:14: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:315:13: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:343:12: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:372:14: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘__adxl34x_disable’:
/home/c2a/test/adxl34x.c:408:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘__adxl34x_enable’:
/home/c2a/test/adxl34x.c:413:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘adxl34x_calibrate_store’:
/home/c2a/test/adxl34x.c:520:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:521:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:522:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘adxl34x_rate_store’:
/home/c2a/test/adxl34x.c:554:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘adxl34x_autosleep_store’:
/home/c2a/test/adxl34x.c:594:3: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c: In function ‘adxl34x_probe’:
/home/c2a/test/adxl34x.c:735:10: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:755:30: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:812:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:830:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:832:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:834:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:836:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:837:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:838:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:839:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:840:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:841:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:842:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:843:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:844:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:845:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:846:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:847:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:849:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:850:2: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:855:3: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:858:3: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:862:3: error: dereferencing pointer to incomplete type
/home/c2a/test/adxl34x.c:882:2: error: dereferencing pointer to incomplete type
make[2]: *** [/home/c2a/test/adxl34x.o] Error 1
make[1]: *** [_module_/home/c2a/test] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-28-generic'
make: *** [default] Error 2
And for the file adxl34x-i2c.c :
c2a@boxC2A:~/test$ sudo make
make -C /usr/src/linux-headers-3.5.0-28-generic SUBDIRS=/home/c2a/test modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-28-generic'
CC [M] /home/c2a/test/adxl34x-i2c.o
/home/c2a/test/adxl34x-i2c.c:62:21: error: variable ‘adxl34x_smbus_bops’ has initializer but incomplete type
/home/c2a/test/adxl34x-i2c.c:63:2: error: unknown field ‘bustype’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:63:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:63:2: warning: (near initialization for ‘adxl34x_smbus_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:64:2: error: unknown field ‘write’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:64:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:64:2: warning: (near initialization for ‘adxl34x_smbus_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:65:2: error: unknown field ‘read’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:65:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:65:2: warning: (near initialization for ‘adxl34x_smbus_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:66:2: error: unknown field ‘read_block’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:66:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:66:2: warning: (near initialization for ‘adxl34x_smbus_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:69:21: error: variable ‘adxl34x_i2c_bops’ has initializer but incomplete type
/home/c2a/test/adxl34x-i2c.c:70:2: error: unknown field ‘bustype’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:70:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:70:2: warning: (near initialization for ‘adxl34x_i2c_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:71:2: error: unknown field ‘write’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:71:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:71:2: warning: (near initialization for ‘adxl34x_i2c_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:72:2: error: unknown field ‘read’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:72:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:72:2: warning: (near initialization for ‘adxl34x_i2c_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c:73:2: error: unknown field ‘read_block’ specified in initializer
/home/c2a/test/adxl34x-i2c.c:73:2: warning: excess elements in struct initializer [enabled by default]
/home/c2a/test/adxl34x-i2c.c:73:2: warning: (near initialization for ‘adxl34x_i2c_bops’) [enabled by default]
/home/c2a/test/adxl34x-i2c.c: In function ‘adxl34x_i2c_probe’:
/home/c2a/test/adxl34x-i2c.c:89:2: error: implicit declaration of function ‘adxl34x_probe’ [-Werror=implicit-function-declaration]
/home/c2a/test/adxl34x-i2c.c:89:5: warning: assignment makes pointer from integer without a cast [enabled by default]
/home/c2a/test/adxl34x-i2c.c: In function ‘adxl34x_i2c_remove’:
/home/c2a/test/adxl34x-i2c.c:105:2: error: implicit declaration of function ‘adxl34x_remove’ [-Werror=implicit-function-declaration]
/home/c2a/test/adxl34x-i2c.c: In function ‘adxl34x_i2c_suspend’:
/home/c2a/test/adxl34x-i2c.c:114:2: error: implicit declaration of function ‘adxl34x_suspend’ [-Werror=implicit-function-declaration]
/home/c2a/test/adxl34x-i2c.c: In function ‘adxl34x_i2c_resume’:
/home/c2a/test/adxl34x-i2c.c:124:2: error: implicit declaration of function ‘adxl34x_resume’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [/home/c2a/test/adxl34x-i2c.o] Error 1
make[1]: *** [_module_/home/c2a/test] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-28-generic'
make: *** [default] Error 2
Please anyone for help ?
C2A team