AnsweredAssumed Answered

Problem width linux driver for fxos8700/fxas2100x

Question asked by Maksim Cherkanov on Dec 6, 2018
Latest reply on Dec 7, 2018 by Maksim Cherkanov

Hey.
I connected FXAS21002C and FXOS8700CQ to my system via spi and i2c. Devices normally work if they are accessed directly. Now I wanted to add the drivers of these devices to the kernel, but when I compile, I get a bunch of errors. What can be wrong?

 

root@Cherkanov-M:~/linux-socfpga-rel_socfpga-4.19_18.11.03_pr# make -j 4 uImage
scripts/kconfig/conf --syncconfig Kconfig
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
GZIP kernel/config_data.gz
UPD kernel/config_data.h
CC kernel/configs.o
AR kernel/built-in.a
CC drivers/misc/fxos8700.o
CC drivers/misc/fxas2100x.o
drivers/misc/fxos8700.c: In function ‘fxos8700_acc_ioctl’:
drivers/misc/fxos8700.c:299:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(copy_from_user(&delay,argp,sizeof(int)));
^~
drivers/misc/fxos8700.c:300:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
{
^
drivers/misc/fxos8700.c: In function ‘fxos8700_mag_ioctl’:
drivers/misc/fxos8700.c:405:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(copy_from_user(&delay,argp,sizeof(int)));
^~
drivers/misc/fxos8700.c:406:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
{
^
In file included from ./include/linux/kernel.h:15:0,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from drivers/misc/fxos8700.c:22:
drivers/misc/fxos8700.c: At top level:
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxos8700.c:595:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(enable, 0666,fxos8700_enable_show, fxos8700_enable_store);
^~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxos8700.c:597:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(poll_delay,0666,fxos8700_poll_delay_show, fxos8700_poll_delay_store);
^~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxos8700.c:599:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(position, 0666,fxos8700_position_show, fxos8700_position_store);
^~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxos8700.c:601:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(data, 0666,fxos8700_data_show, NULL);
^~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxos8700.c:628:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(motion_detect, 0666,fxos8700_motion_detect_show, fxos8700_motion_detect_store);
^~~~~~~~~~~
drivers/misc/fxos8700.c:807:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fxos8700_probe’
static int __devinit fxos8700_probe(struct i2c_client *client,
^~~~~~~~~~~~~~
drivers/misc/fxos8700.c:896:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fxos8700_remove’
static int __devexit fxos8700_remove(struct i2c_client *client)
^~~~~~~~~~~~~~~
drivers/misc/fxos8700.c:946:11: error: ‘fxos8700_probe’ undeclared here (not in a function); did you mean ‘fxos8700_driver’?
.probe = fxos8700_probe,
^~~~~~~~~~~~~~
fxos8700_driver
drivers/misc/fxos8700.c:947:12: error: implicit declaration of function ‘__devexit_p’; did you mean ‘__exit_p’? [-Werror=implicit-function-declaration]
.remove = __devexit_p(fxos8700_remove),
^~~~~~~~~~~
__exit_p
drivers/misc/fxas2100x.c: In function ‘fxas2100x_ioctl’:
drivers/misc/fxas2100x.c:320:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if(copy_from_user(&delay,argp,sizeof(int)));
^~
drivers/misc/fxas2100x.c:321:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
{
^
drivers/misc/fxos8700.c:947:24: error: ‘fxos8700_remove’ undeclared here (not in a function); did you mean ‘fxos8700_resume’?
.remove = __devexit_p(fxos8700_remove),
^~~~~~~~~~~~~~~
fxos8700_resume
In file included from ./include/linux/kernel.h:15:0,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from drivers/misc/fxas2100x.c:20:
drivers/misc/fxas2100x.c: At top level:
drivers/misc/fxos8700.c:764:20: warning: ‘fxos8700_irq_handler’ defined but not used [-Wunused-function]
static irqreturn_t fxos8700_irq_handler(int irq, void *dev)
^~~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxas2100x.c:460:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(enable, 0666, fxas2100x_enable_show, fxas2100x_enable_store);
^~~~~~~~~~~
drivers/misc/fxos8700.c:748:12: warning: ‘fxos8700_unregister_input_device’ defined but not used [-Wunused-function]
static int fxos8700_unregister_input_device(struct fxos8700_data *pdata)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxas2100x.c:462:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(poll_delay, 0666,fxas2100x_poll_delay_show, fxas2100x_poll_delay_store);
^~~~~~~~~~~
drivers/misc/fxos8700.c:696:12: warning: ‘fxos8700_register_input_device’ defined but not used [-Wunused-function]
static int fxos8700_register_input_device(struct fxos8700_data *pdata)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxas2100x.c:464:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(position, 0666,fxas2100x_position_show, fxas2100x_position_store);
^~~~~~~~~~~
drivers/misc/fxos8700.c:682:12: warning: ‘fxos8700_unregister_sysfs_device’ defined but not used [-Wunused-function]
static int fxos8700_unregister_sysfs_device(struct fxos8700_data *pdata)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:29:45: error: negative width in bit-field ‘<anonymous>’
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/kernel.h:1033:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
BUILD_BUG_ON_ZERO((perms) & 2) + \
^~~~~~~~~~~~~~~~~
./include/linux/sysfs.h:103:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’
.mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
^~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/device.h:591:45: note: in expansion of macro ‘__ATTR’
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
^~~~~~
drivers/misc/fxas2100x.c:466:8: note: in expansion of macro ‘DEVICE_ATTR’
static DEVICE_ATTR(data, 0666,fxas2100x_data_show, NULL);
^~~~~~~~~~~
drivers/misc/fxos8700.c:656:12: warning: ‘fxos8700_register_sysfs_device’ defined but not used [-Wunused-function]
static int fxos8700_register_sysfs_device(struct fxos8700_data *pdata)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/fxas2100x.c:503:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fxas2100x_probe’
static int __devinit fxas2100x_probe(struct i2c_client *client,
^~~~~~~~~~~~~~~
drivers/misc/fxos8700.c:462:26: warning: ‘fxos8700_mag_device’ defined but not used [-Wunused-variable]
static struct miscdevice fxos8700_mag_device = {
^~~~~~~~~~~~~~~~~~~
drivers/misc/fxas2100x.c:595:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fxas2100x_remove’
static int __devexit fxas2100x_remove(struct i2c_client *client)
^~~~~~~~~~~~~~~~
drivers/misc/fxos8700.c:456:26: warning: ‘fxos8700_acc_device’ defined but not used [-Wunused-variable]
static struct miscdevice fxos8700_acc_device = {
^~~~~~~~~~~~~~~~~~~
drivers/misc/fxos8700.c:187:12: warning: ‘fxos8700_device_init’ defined but not used [-Wunused-function]
static int fxos8700_device_init(struct i2c_client *client)
^~~~~~~~~~~~~~~~~~~~
drivers/misc/fxas2100x.c:647:12: error: ‘fxas2100x_probe’ undeclared here (not in a function); did you mean ‘fxas2100x_driver’?
.probe = fxas2100x_probe,
^~~~~~~~~~~~~~~
fxas2100x_driver
cc1: some warnings being treated as errors
drivers/misc/fxas2100x.c:648:13: error: implicit declaration of function ‘__devexit_p’; did you mean ‘__exit_p’? [-Werror=implicit-function-declaration]
.remove = __devexit_p(fxas2100x_remove),
^~~~~~~~~~~
__exit_p
scripts/Makefile.build:305: recipe for target 'drivers/misc/fxos8700.o' failed
make[2]: *** [drivers/misc/fxos8700.o] Error 1
make[2]: *** Waiting for unfinished jobs....
drivers/misc/fxas2100x.c:648:25: error: ‘fxas2100x_remove’ undeclared here (not in a function); did you mean ‘fxas2100x_resume’?
.remove = __devexit_p(fxas2100x_remove),
^~~~~~~~~~~~~~~~
fxas2100x_resume
drivers/misc/fxas2100x.c:481:20: warning: ‘fxas2100x_irq_handler’ defined but not used [-Wunused-function]
static irqreturn_t fxas2100x_irq_handler(int irq, void *dev)
^~~~~~~~~~~~~~~~~~~~~
drivers/misc/fxas2100x.c:370:26: warning: ‘fxas2100x_device’ defined but not used [-Wunused-variable]
static struct miscdevice fxas2100x_device = {
^~~~~~~~~~~~~~~~
drivers/misc/fxas2100x.c:137:12: warning: ‘fxas2100x_device_init’ defined but not used [-Wunused-function]
static int fxas2100x_device_init(struct i2c_client *client)
^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:305: recipe for target 'drivers/misc/fxas2100x.o' failed
make[2]: *** [drivers/misc/fxas2100x.o] Error 1
scripts/Makefile.build:546: recipe for target 'drivers/misc' failed
make[1]: *** [drivers/misc] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:1052: recipe for target 'drivers' failed
make: *** [drivers] Error 2

Outcomes